Examples of Mongo


Examples of com.mongodb.Mongo

    public static UpdateableDataContext createMongoDbDataContext(String hostname, Integer port, String databaseName,
            String username, char[] password, SimpleTableDef[] tableDefs) {
        try {
            DB mongoDb;
            if (port == null) {
                mongoDb = new Mongo(hostname).getDB(databaseName);
            } else {
                mongoDb = new Mongo(hostname, port).getDB(databaseName);
            }
            if (username != null) {
                mongoDb.authenticate(username, password);
            }
View Full Code Here

Examples of com.mongodb.Mongo

    protected Datastore ds;

    @BeforeClass
    public void initDB() throws Exception {
        connection = new Mongo("127.0.0.1");

        morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);

        ds = morphia.createDatastore(connection, "rhqtest");
    }
View Full Code Here

Examples of com.mongodb.Mongo

    private MessageDigestGenerator digestGenerator;

    @BeforeClass
    public void initDB() throws Exception {
        connection = new Mongo("127.0.0.1");

        morphia = new Morphia()
            .map(MongoDBChangeSet.class)
            .map(MongoDBChangeSetEntry.class)
            .map(MongoDBFile.class);
View Full Code Here

Examples of com.mongodb.Mongo

        this.fileDAO = fileDAO;
    }

    @Override
    public void initialize(ServerPluginContext context) throws Exception {
        connection = new Mongo("127.0.0.1");
        morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
        ds = morphia.createDatastore(connection, "rhq");
        changeSetDAO =  new ChangeSetDAO(morphia, connection, "rhq");
        fileDAO = new FileDAO(ds.getDB());
View Full Code Here

Examples of com.mongodb.Mongo

     * @return
     * @throws StandardCodedException
     */
    public final List<String> getDBNames() throws StandardCodedException {
        try {
            final Mongo mongo = this.getMongo();
            if (null != mongo) {
                return mongo.getDatabaseNames();
            }
            return new ArrayList<String>();
        } catch (UnknownHostException t) {
            throw this.getError503(t.getMessage());
        } catch (Throwable t) {
View Full Code Here

Examples of com.mongodb.Mongo

     * @param dbName name of database to drop
     * @throws StandardCodedException
     */
    public final void dropDB(final String name) throws StandardCodedException {
        try {
            final Mongo mongo = this.getMongo();
            if (null != mongo) {
                mongo.dropDatabase(name);
            }
        } catch (UnknownHostException t) {
            throw this.getError503(t.getMessage());
        } catch (Throwable t) {
            throw this.getError500(t.getMessage());
View Full Code Here

Examples of com.mongodb.Mongo

     * @return the maximum size
     * @throws StandardCodedException
     */
    public final int getMaxBsonObjectSize() throws StandardCodedException {
        try {
            final Mongo mongo = this.getMongo();
            if (null != mongo) {
                return mongo.getMaxBsonObjectSize();
            }
            return 0;
        } catch (UnknownHostException t) {
            throw this.getError503(t.getMessage());
        } catch (Throwable t) {
View Full Code Here

Examples of com.mongodb.Mongo

        if (null != __mongo) {
            return __mongo;
        }
        //-- creates new mongo --//
        final ServerAddress address = new ServerAddress(_host, _port);
        __mongo = new Mongo(address);
        return __mongo;
    }
View Full Code Here

Examples of com.mongodb.Mongo

            private Mongo mongo;
            @Override
            public Repository[] setUpCluster(int n) throws Exception {
                Repository[] cluster = new Repository[n];
                stores = new FileStore[cluster.length];
                mongo = new Mongo(host, port);
                for (int i = 0; i < cluster.length; i++) {
                    stores[i] = new MongoStore(mongo.getDB(unique), cacheSize);
                    Oak oak = new Oak(new SegmentNodeStore(stores[i]));
                    cluster[i] = new Jcr(oak).createRepository();
                }
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.