Package com.mongodb

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


  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

  }

  @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

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

        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

    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

    }

    @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

     * @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

        } else {
            int port = Integer.parseInt(String.valueOf(properties.get(PORT)));
            String db = String.valueOf(properties.get(DB));
            int cache = Integer.parseInt(String.valueOf(properties.get(CACHE)));

            mongo = new Mongo(host, port);
            store = new MongoStore(mongo.getDB(db), cache * MB);
        }

        delegate = new SegmentNodeStore(store);
    }
View Full Code Here

    public OakSegmentMKRepositoryStub(Properties settings) throws RepositoryException {
        super(settings);

        Session session = null;
        try {
            this.connection = new Mongo(HOST, PORT);
            Jcr jcr = new Jcr(new Oak(new SegmentNodeStore(
                    new MongoStore(connection.getDB(DB), 4 * 1024 * 1024))));
            this.repository = jcr.createRepository();

            session = getRepository().login(superuser);
View Full Code Here

TOP

Related Classes of com.mongodb.Mongo

Copyright © 2018 www.massapicom. 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.