use of org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats in project jackrabbit-oak by apache.
the class AbstractDataStoreService method activate.
protected void activate(ComponentContext context, Map<String, Object> config) throws RepositoryException {
// change to mutable map. may be modified in createDS call
config = Maps.newHashMap(config);
DataStore ds = createDataStore(context, config);
boolean encodeLengthInId = PropertiesUtil.toBoolean(config.get(PROP_ENCODE_LENGTH), true);
int cacheSizeInMB = PropertiesUtil.toInteger(config.get(PROP_CACHE_SIZE), DataStoreBlobStore.DEFAULT_CACHE_SIZE);
String homeDir = lookup(context, PROP_HOME);
if (config.containsKey(PATH) && !Strings.isNullOrEmpty((String) config.get(PATH))) {
log.info("Initializing the DataStore with path [{}]", config.get(PATH));
} else if (homeDir != null) {
log.info("Initializing the DataStore with homeDir [{}]", homeDir);
}
PropertiesUtil.populate(ds, config, false);
ds.init(homeDir);
BlobStoreStats stats = new BlobStoreStats(getStatisticsProvider());
this.dataStore = new DataStoreBlobStore(ds, encodeLengthInId, cacheSizeInMB);
this.dataStore.setBlobStatsCollector(stats);
PropertiesUtil.populate(dataStore, config, false);
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(Constants.SERVICE_PID, ds.getClass().getName());
props.put(DESCRIPTION, getDescription());
if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
}
reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, dataStore, props);
mbeanReg = registerMBeans(context.getBundleContext(), dataStore, stats);
}
Aggregations