List of usage examples for com.mongodb Mongo Mongo
@Deprecated
public Mongo()
From source file:com.linuxbox.enkive.docstore.mongogrid.ConvenienceMongoGridDocStoreService.java
License:Open Source License
public ConvenienceMongoGridDocStoreService(String dbName, String bucketName) throws UnknownHostException, MongoException { this(new Mongo(), dbName, bucketName); createdMongo = true;/*from ww w . j av a 2 s . co m*/ }
From source file:com.linuxbox.enkive.docstore.mongogrid.MongoGridDocStoreService.java
License:Open Source License
public MongoGridDocStoreService(String dbName, String bucketName) throws UnknownHostException { this(new Mongo(), dbName, bucketName); createdMongo = true;/*from ww w . ja v a 2s. c o m*/ }
From source file:com.linuxbox.enkive.tool.mongodb.MongoDBMsgRetriever.java
License:Open Source License
public static void main(String[] args) { System.out.println("Starting"); MongoRetrieverService retriever = null; MongoGridDocStoreService docStoreService = null; try {/*from w w w.ja v a2s .c om*/ Mongo m = new Mongo(); retriever = new MongoRetrieverService(m, DATABASE_NAME, EMAIL_COLLECTION_NAME); docStoreService = new ConvenienceMongoGridDocStoreService(DATABASE_NAME, GRIDFS_COLLECTION_NAME); docStoreService.startup(); retriever.setDocStoreService(docStoreService); String identifier = getIdentifierOpt(args); if (identifier == null) { System.out.println("usage: program <identifier>"); return; } System.out.println("Try retrieve message with id " + identifier); Message msg = retriever.retrieve(identifier); storeAsFile(msg, identifier, StoreHow.RAW); storeAsFile(msg, identifier, StoreHow.RECONSTITUTED); } catch (Exception e) { System.err.println(e); e.printStackTrace(System.err); } finally { // empty } System.out.println("Done"); }
From source file:com.linuxbox.util.lockservice.mongodb.MongoLockService.java
License:Open Source License
public MongoLockService(String database, String collection) throws UnknownHostException, MongoException { this(new Mongo(), database, collection); mongoCreated = true;/* ww w .j av a2 s.c o m*/ }
From source file:com.linuxbox.util.mongodb.Dropper.java
License:Open Source License
public static void dropDatabase(String dbName) throws UnknownHostException, MongoException { Mongo m = new Mongo(); DB db = m.getDB(dbName);//from www. jav a 2 s. c om db.dropDatabase(); }
From source file:com.linuxbox.util.mongodb.Dropper.java
License:Open Source License
public static void dropCollection(String dbName, String collection) throws UnknownHostException, MongoException { Mongo m = new Mongo(); DB db = m.getDB(dbName);//from w ww.ja v a2 s .c om DBCollection c = db.getCollection(collection); c.drop(); }
From source file:com.linuxbox.util.queueservice.mongodb.MongoQueueService.java
License:Open Source License
public MongoQueueService(String database, String collection) throws UnknownHostException, MongoException { this(new Mongo(), database, collection); createdMongo = true;/* ww w.j a v a2s. c o m*/ }
From source file:com.mongo.gridfs.GridFSFileLoader.java
License:Open Source License
public GridFSFileLoader() { try {// ww w . java 2 s .co m mon = new Mongo(); } catch (UnknownHostException e) { throw new IllegalStateException(e); } catch (MongoException e) { throw new IllegalStateException(e); } gridfs = new GridFS(mon.getDB("filernd")); }
From source file:com.oreilly.springdata.mongodb.ApplicationConfig.java
License:Apache License
@Override public Mongo mongo() throws Exception { Mongo mongo = new Mongo(); mongo.setWriteConcern(WriteConcern.SAFE); return mongo; }
From source file:dbscan.DBScanMapper.java
License:Apache License
DBScanMapper() throws java.net.UnknownHostException { super();/*from w w w . j av a 2 s .co m*/ m = new Mongo(); db = m.getDB("p"); boolean auth = db.authenticate("username", "password".toCharArray()); if (!auth) throw new RuntimeException("Login error"); collection = db.getCollection("points"); }