com.mongodb.gridfs.GridFS.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中com.mongodb.gridfs.GridFS.<init>()方法的一些代码示例,展示了GridFS.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridFS.<init>()方法的具体详情如下:
包路径:com.mongodb.gridfs.GridFS
类名称:GridFS
方法名:<init>

GridFS.<init>介绍

[英]Creates a GridFS instance for the default bucket "fs" in the given database. Set the preferred WriteConcern on the give DB with DB.setWriteConcern
[中]为给定数据库中的默认bucket“fs”创建GridFS实例。在带有DB的给定DB上设置首选WriteConcern。setWriteConcern

代码示例

代码示例来源:origin: org.mongodb/mongo-java-driver

@SuppressWarnings("deprecation") // We know GridFS uses the old API. A new API version will be address later.
private static GridFS getGridFS() throws Exception {
  if (gridFS == null) {
    gridFS = new GridFS(getMongo().getDB(db));
  }
  return gridFS;
}

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

throw new NullPointerException(MongoDBRiver.MONGODB_ID_FIELD);
GridFS grid = new GridFS(mongoShardClient.getDB(definition.getMongoDb()), collection);
GridFSDBFile file = grid.findOne(new ObjectId(objectId));
if (file != null) {

代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb

GridFS grid = new GridFS(mongoClient.getDB(definition.getMongoDb()), definition.getMongoCollection());

代码示例来源:origin: apache/incubator-wave

MongoDbStore(DB database) {
 this.database = database;
 attachmentGrid = new GridFS(database, "attachments");
 thumbnailGrid = new GridFS(database, "thumbnails");
 metadataGrid = new GridFS(database, "metadata");
}

代码示例来源:origin: org.apache.jackrabbit/oak-mongomk

/**
 * Constructs a new {@code BlobStoreMongoGridFS}
 *
 * @param db The DB.
 */
public MongoGridFSBlobStore(DB db) {
  commandExecutor = new DefaultCommandExecutor();
  gridFS = new GridFS(db);
}

代码示例来源:origin: org.craftercms/crafter-commons-mongo

@Required
public void setJongo(final Jongo jongo) {
  this.jongo = jongo;
  this.gridfs = new GridFS(jongo.getDatabase());
}

代码示例来源:origin: org.kurento/kurento-repository-internal

@PostConstruct
private void postConstruct() {
 gridFS = new GridFS(mongoTemplate.getDb());
}

代码示例来源:origin: Kurento/kurento-java

@PostConstruct
private void postConstruct() {
 gridFS = new GridFS(mongoTemplate.getDb());
}

代码示例来源:origin: Findwise/Hydra

public MongoPipelineReader(DB db) {
  stages = db.getCollection(STAGES_COLLECTION);
  pipelinefs = new GridFS(db, PIPELINE_FS); 
}

代码示例来源:origin: lmco/streamflow

@Inject
public MongoGridFsFileContentDao(Mongo mongo, DatastoreConfig datastoreConfig) {
  String dbName = (String) datastoreConfig.properties().get("dbName");
  if (dbName == null || dbName.isEmpty()) {
    dbName = "streamflow";
  }
  
  DB db = mongo.getDB(dbName);
  gridFs = new GridFS(db);
}

代码示例来源:origin: org.mongodb/mongodb-driver

@SuppressWarnings("deprecation") // We know GridFS uses the old API. A new API version will be address later.
private static GridFS getGridFS() throws Exception {
  if (gridFS == null) {
    gridFS = new GridFS(getMongo().getDB(db));
  }
  return gridFS;
}

代码示例来源:origin: org.mongodb.mongo-hadoop/mongo-hadoop-core

private GridFS getGridFS() {
  if (null == gridFS) {
    DBCollection rootCollection =
     MongoConfigUtil.getCollection(inputURI);
    gridFS = new GridFS(
     rootCollection.getDB(), rootCollection.getName());
  }
  return gridFS;
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-mongodb

GridFS setupGridFS(Mongo mongo) {
  DB db = database() == null ? mongo.getDB("gridfs") : mongo.getDB(database());
  return bucket() == null ? new GridFS(db) : new GridFS(db, bucket());
 }
}

代码示例来源:origin: com.effektif/effektif-mongo

@Override
public Object supply(Brewery brewery) {
 MongoConfiguration mongoConfiguration = brewery.get(MongoConfiguration.class);
 MongoClient mongoClient = brewery.get(MongoClient.class);
 String filedatabaseName = mongoConfiguration.getFileDatabaseName();
 DB db = mongoClient.getDB(filedatabaseName);
 return new GridFS(db);
}

代码示例来源:origin: effektif/effektif

@Override
public Object supply(Brewery brewery) {
 MongoConfiguration mongoConfiguration = brewery.get(MongoConfiguration.class);
 MongoClient mongoClient = brewery.get(MongoClient.class);
 String filedatabaseName = mongoConfiguration.getFileDatabaseName();
 DB db = mongoClient.getDB(filedatabaseName);
 return new GridFS(db);
}

代码示例来源:origin: com.cognifide.aet/datastorage

private GridFS getGridFS(DBKey dbKey) {
  final String dbName = MongoDBClient.getDbName(dbKey.getCompany(), dbKey.getProject());
  return new GridFS(client.getDB(dbName, true), ARTIFACTS_COLLECTION_NAME);
 }
}

代码示例来源:origin: Cognifide/aet

private GridFS getGridFS(DBKey dbKey) {
  final String dbName = MongoDBClient.getDbName(dbKey.getCompany(), dbKey.getProject());
  return new GridFS(client.getDB(dbName, true), ARTIFACTS_COLLECTION_NAME);
 }
}

代码示例来源:origin: xbwen/bugu-mongo

public BuguFS(String connectionName, String bucket, int chunkSize){
  this.bucket = bucket;
  this.chunkSize = chunkSize;
  DB db = BuguFramework.getInstance().getConnection(connectionName).getDB();
  fs = new GridFS(db, bucket);
  files = db.getCollection(bucket + ".files");
  //ensure the DBCursor can be cast to GridFSDBFile
  files.setObjectClass(GridFSDBFile.class);
}

代码示例来源:origin: de.adorsys.cryptoutils/mongodbstoreconnection

@Override
public StorageMetadata getStorageMetadata(BucketPath bucketPath) {
  SPECIAL_LOGGER.debug("readmetadata " + bucketPath); // Dies LogZeile ist fuer den JUNIT-Tests StorageMetaDataTest
  LOGGER.debug("readmetadata " + bucketPath);
  GridFSBucket bucket = getGridFSBucket(bucketPath);
  checkBucketExists(bucket);
  GridFS gridFS = new GridFS(databaseDeprecated, bucketPath.getObjectHandle().getContainer());
  GridFSDBFile one = gridFS.findOne(bucketPath.getObjectHandle().getName());
  String jsonString = (String) one.getMetaData().get(STORAGE_METADATA_KEY);
  return gsonHelper.fromJson(jsonString);
}

代码示例来源:origin: suninformation/ymate-platform-v2

public MongoGridFSSession(IMongoDataSourceAdapter dataSourceAdapter, String bucketName) throws Exception {
  this.__id = UUIDUtils.UUID();
  this.__dataSourceHolder = dataSourceAdapter;
  this.__bucketName = StringUtils.defaultIfBlank(bucketName, GridFS.DEFAULT_BUCKET);
  //
  __gridFS = new GridFS(new DB(dataSourceAdapter.getMongoClient(), dataSourceAdapter.getDataSourceCfgMeta().getDatabaseName()), __bucketName);
  __dbCollection = __gridFS.getDB().getCollection(__bucketName.concat(".files"));
}

相关文章