Examples of Mongo


Examples of com.mongodb.Mongo

        ManagedService service = (ManagedService) context.getService(serviceRef);
        try
        {
            service.updated(null);

            Mongo mongo = new Mongo();
            DB db = mongo.getDB("ua_repo");
            DBCollection collection = db.getCollection("useradmin");
            // we always get a collection back, regardless if there is an actual MongoDB listening, hence we should do
            // some actual calls that cause a connection to MongoDB to be created...
            collection.remove(new BasicDBObject(), WriteConcern.SAFE);
View Full Code Here

Examples of com.mongodb.Mongo

    }

    @Provides
    Mongo create(final Application application) {
        try {
            return new Mongo(new MongoURI(application.configuration().getString("mongodb.uri")));
        } catch (UnknownHostException e) {
            addError(e);
            return null;
        }
    }
View Full Code Here

Examples of com.mongodb.Mongo

    private DBCollection _collection;

    @Override
    public void start() {
        try {
            _mongo = new Mongo(_dbHost, _dbPort);
            DB db = _mongo.getDB(_dbName);
            _collection = db.getCollection(super.getName());
        } catch (Exception e) {
            addStatus(new ErrorStatus("Failed to initialize MondoDB", this, e));
            return;
View Full Code Here

Examples of com.mongodb.Mongo

  public Mongo getMongo() {
    MongoInstance mongoInstance = MeclipsePlugin.getDefault()
        .getMongoInstance(this.getName());
    Exception ex;
    if (mongoInstance.getMongo() == null) {
      Mongo mongo;
      try {
        mongo = new Mongo(mongoInstance.getHost(),
            mongoInstance.getPort());
        mongo.getDatabaseNames();
        mongoInstance.setMongo(mongo); // add the active Mongo instance
                        // to the plug-in's state
        isDown = false;
        return mongo;
        /* catch some possible exceptions */
 
View Full Code Here

Examples of com.mongodb.Mongo

  }

  @Override
  public TreeObject[] getChildren() {
    List<Database> children = new ArrayList<Database>();
    Mongo mongo = getMongo();
    if (mongo != null) {
      try {
        for (String name : mongo.getDatabaseNames()) {
          Database database = new Database(name);
          database.setParent(this);
          database.setViewer(view);
          children.add(database);
        }
View Full Code Here

Examples of com.mongodb.Mongo

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        if (isConfigured()) {
            Mongo mongo = new Mongo(getHostname());
            db = mongo.getDB(getDatabaseName());
        }
    }
View Full Code Here

Examples of com.mongodb.Mongo

        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
        Connection connection = DriverManager.getConnection("jdbc:derby:jar:(" + dbFile.getAbsolutePath()
                + ")derby_testdb;territory=en");
        connection.setReadOnly(true);

        DB db = new Mongo().getDB("orderdb_copy");

        DataContext sourceDataContext = new JdbcDataContext(connection);

        new MongoDbDataCopyer(db, "orders", sourceDataContext, "APP", "orders").copy();
        new MongoDbDataCopyer(db, "offices", sourceDataContext, "APP", "offices").copy();
View Full Code Here

Examples of com.mongodb.Mongo

    private final String remoteServer = "remote:27017/test";

    @Ignore
    @Test
    public void performBenchMark() throws UnknownHostException, InterruptedException {
        Mongo local = new Mongo(new DBAddress(localServer));
        Mongo remote = new Mongo(new DBAddress(remoteServer));

        run(local, false, false);
        run(local, true, false);
        run(remote, false, true);
        run(remote, true, true);
View Full Code Here

Examples of com.mongodb.Mongo

    }

    @Ignore
    @Test
    public void performBenchMark_WriteConcern() throws UnknownHostException, InterruptedException {
        Mongo mongo = new Mongo(new DBAddress(remoteServer));
        final DB db = mongo.getDB(TEST_DB1);
        final DBCollection nodes = db.getCollection("nodes");
        final DBCollection blobs = db.getCollection("blobs");
        int readers = 0;
        int writers = 2;
        for(WriteConcern wc : namedConcerns.keySet()){
View Full Code Here

Examples of com.mongodb.Mongo

     * @param port The port.
     * @param database The database name.
     * @throws Exception If an error occurred while trying to connect.
     */
    public MongoConnection(String host, int port, String database) throws Exception {
        mongo = new Mongo(host, port);
        db = mongo.getDB(database);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.