Package com.mongodb

Examples of com.mongodb.Mongo$Holder


    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


        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

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

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

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

        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

            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

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

            String host = String.valueOf(properties.get(HOST));
            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), 100 * 1024 * 1024))));
            jcr.with(Executors.newScheduledThreadPool(1));
            this.repository = jcr.createRepository();

View Full Code Here

TOP

Related Classes of com.mongodb.Mongo$Holder

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.