List of usage examples for com.mongodb MongoURI MongoURI
@SuppressWarnings("deprecation") @Deprecated public MongoURI(final MongoClientURI proxied)
From source file:com.jelastic.campitos.SpringMongoConfig.java
public @Bean SimpleMongoDbFactory mongoDbFactory() throws Exception { //MongoURI uri=new MongoURI("mongodb://campitos:celiesita1951@paulo.mongohq.com:10017/htxiBv8O8SYnF8rGqmUQhw"); MongoURI uri = new MongoURI("mongodb://campitos:celiesita@paulo.mongohq.com:10037/campitos-base"); return new SimpleMongoDbFactory(uri); }
From source file:com.kurento.kmf.repository.internal.repoimpl.mongo.MongoConfiguration.java
License:Open Source License
@Override public Mongo mongo() throws UnknownHostException { return new Mongo(new MongoURI(config.getMongoURLConnection())); }
From source file:com.nlp.twitterstream.MongoUtil.java
License:Open Source License
/** * Initialize MongoDB client - Singleton Currently commented for Heroku * functionality//from w w w. j ava 2 s.c om * * @throws Exception */ public void initMongo() throws Exception { // if(mongoClient == null) { // mongoClient = new MongoClient( "localhost" , 27017 ); // } if (mongoURI == null) { mongoURI = new MongoURI(System.getenv("MONGOHQ_URL")); } if (mongodb == null) { try { mongodb = mongoURI.connectDB(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } } mongodb.authenticate(mongoURI.getUsername(), mongoURI.getPassword()); }
From source file:com.zjy.mongo.util.MongoConfigUtil.java
License:Apache License
/** * @deprecated use {@link #getMongoClientURI(Configuration, String)} instead * @param conf the Configuration// www . ja v a2 s . c om * @param key the key for the setting * @return the MongoURI stored for the given key */ @Deprecated @SuppressWarnings("deprecation") public static MongoURI getMongoURI(final Configuration conf, final String key) { final String raw = conf.get(key); if (raw != null && !raw.trim().isEmpty()) { return new MongoURI(raw); } else { return null; } }
From source file:de.belaso.mongolyn.ui.MongolynUtils.java
License:Open Source License
public static DBCollection getDBCollection(final TaskRepository repository) throws CoreException { MongoURI mongoURI = new MongoURI(repository.getRepositoryUrl()); String collection = mongoURI.getCollection(); if (collection == null || collection.isEmpty()) { collection = "mongolyn"; // using hard coded collection }//ww w .ja v a 2 s. c o m return openDB(repository).getCollection(collection); }
From source file:de.belaso.mongolyn.ui.MongolynUtils.java
License:Open Source License
public static DB openNewDB(final TaskRepository repository) throws CoreException { try {//from w ww. jav a2 s .c o m MongoURI mongoURI = new MongoURI(repository.getRepositoryUrl()); DB db = new Mongo(mongoURI).getDB(mongoURI.getDatabase()); AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY); if (credentials != null) { db.authenticate(credentials.getUserName(), credentials.getPassword().toCharArray()); } return db; } catch (UnknownHostException unknownHostException) { throw new CoreException(Activator.INSTANCE.getErrorStatus(unknownHostException)); } }
From source file:de.belaso.mongolyn.ui.RepositorySettingsPage.java
License:Open Source License
@Override protected boolean isValidUrl(String url) { try {/*from www . ja v a2 s .co m*/ MongoURI mongoURI = new MongoURI(url); if (mongoURI.getDatabase() == null) return false; else return true; } catch (RuntimeException runtimeException) { return false; } }
From source file:doge.Application.java
License:Apache License
@Bean public GridFsTemplate gridFsTemplate(MongoProperties properties, MongoTemplate mongo) throws Exception { MongoURI mongoURI = new MongoURI(properties.getUri()); SimpleMongoDbFactory simpleMongoDbFactory = new SimpleMongoDbFactory(mongoURI); return new GridFsTemplate(simpleMongoDbFactory, mongo.getConverter()); }
From source file:fi.vm.sade.osoitepalvelu.kooste.config.MongoConfig.java
License:EUPL
@Bean @Override//from www . j a v a 2 s. co m public SimpleMongoDbFactory mongoDbFactory() throws MongoException, UnknownHostException { return new SimpleMongoDbFactory(new MongoURI(new MongoClientURI(mongoUri))); }
From source file:fi.vm.sade.osoitepalvelu.kooste.config.MongoConfig.java
License:EUPL
@Bean @Override//from w w w. j a v a 2 s . c om public Mongo mongo() throws UnknownHostException { return new Mongo(new MongoURI(new MongoClientURI(mongoUri))); }