Examples of Mongo


Examples of co.ohba.autumn.AutumnConfig.Mongo

     
      properties.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.CREATE_OR_EXTEND);
      properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);

    } else if (dsType == DataStoreType.MONGO) {
      Mongo mongo = atmnCnf.getMongo();
      properties.put(PersistenceUnitProperties.TARGET_DATABASE, "org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform");
      properties.put(PersistenceUnitProperties.NOSQL_CONNECTION_SPEC, "org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec");
      properties.put(PersistenceUnitProperties.NOSQL_PROPERTY+MongoConnectionSpec.PORT, mongo.getPort());
      properties.put(PersistenceUnitProperties.NOSQL_PROPERTY+MongoConnectionSpec.HOST, mongo.getHost());
      properties.put(PersistenceUnitProperties.NOSQL_PROPERTY+MongoConnectionSpec.DB, mongo.getDb());
      properties.put(PersistenceUnitProperties.NOSQL_PROPERTY+MongoConnectionSpec.USER, mongo.getUser());
      properties.put(PersistenceUnitProperties.NOSQL_PROPERTY+MongoConnectionSpec.PASSWORD, mongo.getPassword());
    }
       
    Reflections reflections = new Reflections(atmnCnf.getEntityPackage());
    Set<Class<?>> entityTypes =  reflections.getTypesAnnotatedWith(Entity.class);
    List<String> entityTypeNames = Lists.newArrayList();
View Full Code Here

Examples of com.massivecraft.mcore.xlib.mongodb.Mongo

        if ( args.length < 1 ){
            printUsage();
            return;
        }
       
        Mongo m = null;

        for ( int i=0; i<args.length; i++ ){
            String s = args[i];
           
            if ( s.equals( "--db" ) ){
View Full Code Here

Examples of com.mongodb.Mongo

  private static MongodForTestsFactory factory;

  @BeforeClass
  public static void setUp() throws IOException {
    factory = MongodForTestsFactory.with(Version.Main.V2_2);
    Mongo mongo = factory.newMongo();
    db = mongo.getDB("test");

    userService = new DefaultUserService(new MongoUserRepository(db));
    userReadService = new MongoUserReadService(db);
  }
View Full Code Here

Examples of com.mongodb.Mongo

  public void beforeEach() throws Exception {

    MongodStarter runtime = MongodStarter.getDefaultInstance();
    mongodExecutable = runtime.prepare(new MongodConfig(Version.V2_2_1, 12345, Network.localhostIsIPv6()));
    mongodProcess = mongodExecutable.start();
    Mongo mongo = new Mongo("localhost", 12345);
    db = mongo.getDB(DATABASE_NAME);

    // Create collections
    db.createCollection("soilData", new BasicDBObject());

  }
View Full Code Here

Examples of com.mongodb.Mongo

        final DBAddress address = new DBAddress(host, port, db);
        final MongoOptions options = new MongoOptions();
       
        options.connectionsPerHost = PropertiesUtil.toInteger(props.get(PROP_NUM_CONNECTIONS), DEFAULT_NUMCONNECTIONS);
        options.threadsAllowedToBlockForConnectionMultiplier = PropertiesUtil.toInteger(props.get(PROP_THREAD_MULTIPLIER), DEFAULT_THREAD_MULTIPLIER);
        final Mongo m = new Mongo(address, options);

        final DB database = m.getDB( db );
        logger.info("Connected to database {}", database);

        this.context = new MongoDBContext(database,
                roots[0],
                PropertiesUtil.toStringArray(props.get(PROP_FILTER_COLLECTIONS)),
View Full Code Here

Examples of com.mongodb.Mongo

  }

  @Override
  public void run(HelloWorldConfiguration config, Environment environment) throws UnknownHostException
  {
    Mongo mongo = new Mongo(config.mongohost, config.mongoport);
    MongoManaged mongoManaged = new MongoManaged(mongo);
    environment.manage(mongoManaged);
    environment.addHealthCheck(new MongoHealthCheck(mongo));
    DB db = mongo.getDB(config.mongodb);
    JacksonDBCollection<World, String> worlds = JacksonDBCollection.wrap(db.getCollection("world"), World.class, String.class);
    environment.addResource(new WorldResource(worlds));
    environment.addResource(new JsonResource());
  }
View Full Code Here

Examples of com.mongodb.Mongo

                httpServer.stop();
            }
        });

        MongoURI mongolabUri = new MongoURI(System.getenv("MONGOLAB_URI") != null ? System.getenv("MONGOLAB_URI") : "mongodb://127.0.0.1:27017/hello");
        Mongo m = new Mongo(mongolabUri);
        mongoDB = m.getDB(mongolabUri.getDatabase());
        if ((mongolabUri.getUsername() != null) && (mongolabUri.getPassword() != null)) {
            mongoDB.authenticate(mongolabUri.getUsername(), mongolabUri.getPassword());
        }

        contentUrl = System.getenv("CONTENT_URL") != null ? System.getenv("CONTENT_URL") : CONTENT_PATH;
View Full Code Here

Examples of com.mongodb.Mongo

     * @param userName the optional user name to use;
     * @param password the optional password to use.
     * @return <code>true</code> if the connection was succesful, <code>false</code> otherwise.
     */
    public boolean connect(String userName, String password) {
        Mongo newMongo = new Mongo(m_servers);

        Mongo oldMongo;
        do {
            oldMongo = m_mongoRef.get();
        } while (!m_mongoRef.compareAndSet(oldMongo, newMongo));
       
        DB db = newMongo.getDB(m_dbName);
View Full Code Here

Examples of com.mongodb.Mongo

     *
     * @return the {@link DBCollection}, never <code>null</code>.
     * @throws MongoException in case no connection to Mongo exists.
     */
    public DBCollection getCollection() {
        Mongo mongo = m_mongoRef.get();
        if (mongo == null) {
            throw new MongoException("Not connected to MongoDB!");
        }
        DB db = mongo.getDB(m_dbName);
        return db.getCollection(m_collectionName);
    }
View Full Code Here

Examples of com.mongodb.Mongo

    /**
     * Disconnects from the MongoDB.
     */
    public void disconnect() {
        Mongo mongo = m_mongoRef.get();
        if (mongo != null) {
            try {
                mongo.close();
            } finally {
                m_mongoRef.compareAndSet(mongo, null);
            }
        }
    }
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.