本文整理了Java中org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore.
方法的一些代码示例,展示了OakFileDataStore.
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OakFileDataStore.
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore
类名称:OakFileDataStore
方法名:
暂无
代码示例来源:origin: apache/jackrabbit-oak
@Override
protected DataStore createDataStore(ComponentContext context, Map
long cacheSize = PropertiesUtil.toLong(config.get(CACHE_SIZE), 0L);
// return CachingFDS when cacheSize > 0
if (cacheSize > 0) {
String fsBackendPath = PropertiesUtil.toString(config.get(PATH), null);
Preconditions.checkNotNull(fsBackendPath, "Cannot create " +
"FileDataStoreService with caching. [{path}] property not configured.");
config.remove(PATH);
config.remove(CACHE_SIZE);
config.put(FS_BACKEND_PATH, fsBackendPath);
config.put("cacheSize", cacheSize);
String cachePath = PropertiesUtil.toString(config.get(CACHE_PATH), null);
if (cachePath != null) {
config.remove(CACHE_PATH);
config.put(PATH, cachePath);
}
Properties properties = new Properties();
properties.putAll(config);
log.info("Initializing with properties " + properties);
return getCachingDataStore(properties, context);
} else {
log.info("OakFileDataStore initialized");
return new OakFileDataStore();
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins
@Override
protected DataStore createDataStore(ComponentContext context, Map
long cacheSize = PropertiesUtil.toLong(config.get(CACHE_SIZE), 0L);
// return CachingFDS when cacheSize > 0
if (cacheSize > 0) {
String fsBackendPath = PropertiesUtil.toString(config.get(PATH), null);
Preconditions.checkNotNull(fsBackendPath, "Cannot create " +
"FileDataStoreService with caching. [{path}] property not configured.");
config.remove(PATH);
config.remove(CACHE_SIZE);
config.put(FS_BACKEND_PATH, fsBackendPath);
config.put("cacheSize", cacheSize);
String cachePath = PropertiesUtil.toString(config.get(CACHE_PATH), null);
if (cachePath != null) {
config.remove(CACHE_PATH);
config.put(PATH, cachePath);
}
Properties properties = new Properties();
properties.putAll(config);
log.info("Initializing with properties " + properties);
return getCachingDataStore(properties, context);
} else {
log.info("OakFileDataStore initialized");
return new OakFileDataStore();
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
@Override
protected DataStore createDataStore(ComponentContext context, Map
long cacheSize = PropertiesUtil.toLong(config.get(CACHE_SIZE), 0L);
// return CachingFDS when cacheSize > 0
if (cacheSize > 0) {
String fsBackendPath = PropertiesUtil.toString(config.get(PATH), null);
Preconditions.checkNotNull(fsBackendPath, "Cannot create " +
"FileDataStoreService with caching. [{path}] property not configured.");
config.remove(PATH);
config.remove(CACHE_SIZE);
config.put(FS_BACKEND_PATH, fsBackendPath);
config.put("cacheSize", cacheSize);
String cachePath = PropertiesUtil.toString(config.get(CACHE_PATH), null);
if (cachePath != null) {
config.remove(CACHE_PATH);
config.put(PATH, cachePath);
}
Properties properties = new Properties();
properties.putAll(config);
log.info("Initializing with properties " + properties);
return getCachingDataStore(properties, context);
} else {
log.info("OakFileDataStore initialized");
return new OakFileDataStore();
}
}
代码示例来源:origin: apache/jackrabbit-oak
private DataStoreBlobStore createDataStore() {
FileDataStore fds = new OakFileDataStore();
fds.setPath(dir.getAbsolutePath());
fds.setMinRecordLength(maxInlineSize);
fds.init(null);
return new DataStoreBlobStore(fds);
}
代码示例来源:origin: org.apache.jackrabbit/oak-blob-plugins
private DataStoreBlobStore createDataStore() {
FileDataStore fds = new OakFileDataStore();
fds.setPath(dir.getAbsolutePath());
fds.setMinRecordLength(maxInlineSize);
fds.init(null);
return new DataStoreBlobStore(fds);
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
private DataStoreBlobStore createDataStore() {
FileDataStore fds = new OakFileDataStore();
fds.setPath(dir.getAbsolutePath());
fds.setMinRecordLength(maxInlineSize);
fds.init(null);
return new DataStoreBlobStore(fds);
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public BlobStore create(Closer closer) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory);
delegate.init(null);
closer.register(asCloseable(delegate));
if (ignoreMissingBlobs) {
return new SafeDataStoreBlobStore(delegate);
} else {
return new DataStoreBlobStore(delegate);
}
}
代码示例来源:origin: org.apache.jackrabbit/oak-upgrade
@Override
public BlobStore create(Closer closer) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory);
delegate.init(null);
closer.register(asCloseable(delegate));
if (ignoreMissingBlobs) {
return new SafeDataStoreBlobStore(delegate);
} else {
return new DataStoreBlobStore(delegate);
}
}
代码示例来源:origin: apache/jackrabbit-oak
private DataStoreBlobStore registerSharedDataStore(File home) {
OakFileDataStore ds = new OakFileDataStore();
ds.init(home.getAbsolutePath());
DataStoreBlobStore dataStoreBlobStore = new DataStoreBlobStore(ds);
blobStore = context.bundleContext().registerService(BlobStore.class.getName(), dataStoreBlobStore, null);
return dataStoreBlobStore;
}
代码示例来源:origin: apache/jackrabbit-oak
private static OakFileDataStore datastore(String path) {
OakFileDataStore fds = new OakFileDataStore();
fds.setPath(path);
fds.init(null);
return fds;
}
}
代码示例来源:origin: apache/jackrabbit-oak
private static BlobStore createBlobStore(){
File file = getTestDir("datastore");
OakFileDataStore fds = new OakFileDataStore();
byte[] key = new byte[256];
new Random().nextBytes(key);
fds.setReferenceKeyEncoded(BaseEncoding.base64().encode(key));
fds.setMinRecordLength(4092);
fds.init(file.getAbsolutePath());
return new DataStoreBlobStore(fds);
}
代码示例来源:origin: apache/jackrabbit-oak
private static BlobStore newBlobStore(File directory) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory.getAbsolutePath());
delegate.init(null);
return new DataStoreBlobStore(delegate);
}
代码示例来源:origin: apache/jackrabbit-oak
public static FileDataStore createFDS(File root, int minRecordLength) {
OakFileDataStore fds = new OakFileDataStore();
fds.setPath(root.getAbsolutePath());
fds.setMinRecordLength(minRecordLength);
fds.init(null);
return fds;
}
代码示例来源:origin: apache/jackrabbit-oak
@Override public DataStoreBlobStore init(TemporaryFolder folder) throws Exception {
OakFileDataStore delegate = new OakFileDataStore();
cOntainer= folder.newFolder().getAbsolutePath();
delegate.setPath(container);
delegate.init(null);
blobStore = new DataStoreBlobStore(delegate);
File cfgFile = folder.newFile();
Properties props = new Properties();
props.put("path", container);
props.put("minRecordLength", new Long(4096));
cfgFilePath = createTempConfig(cfgFile, props);
return blobStore;
}
代码示例来源:origin: apache/jackrabbit-oak
private static BlobStore newBlobStore(File directory) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory.getAbsolutePath());
delegate.init(null);
return new DataStoreBlobStore(delegate);
}
代码示例来源:origin: apache/jackrabbit-oak
private static BlobStore newBlobStore(File directory) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory.getAbsolutePath());
delegate.init(null);
return new DataStoreBlobStore(delegate);
}
代码示例来源:origin: apache/jackrabbit-oak
private void testGetAllIdentifiers(String path, String unnormalizedPath) throws Exception {
File testDir = new File(path);
FileUtils.touch(new File(testDir, "ab/cd/ef/abcdef"));
FileUtils.touch(new File(testDir, "bc/de/fg/bcdefg"));
FileUtils.touch(new File(testDir, "cd/ef/gh/cdefgh"));
FileUtils.touch(new File(testDir, "c"));
FileDataStore fds = new OakFileDataStore();
fds.setPath(unnormalizedPath);
fds.init(null);
Iterator
Set
@Override
public String apply(@Nullable DataIdentifier input) {
return input.toString();
}
}));
Set
assertEquals(expectedNames, fileNames);
FileUtils.cleanDirectory(testDir);
}
代码示例来源:origin: apache/jackrabbit-oak
private void testGetAllIdentifiers(String path, String unnormalizedPath) throws Exception {
File testDir = new File(path);
FileUtils.touch(new File(testDir, "ab/cd/ef/abcdef"));
FileUtils.touch(new File(testDir, "bc/de/fg/bcdefg"));
FileUtils.touch(new File(testDir, "cd/ef/gh/cdefgh"));
FileUtils.touch(new File(testDir, "c"));
FileDataStore fds = new OakFileDataStore();
fds.setPath(unnormalizedPath);
fds.init(null);
Iterator
Set
@Override
public String apply(@Nullable DataIdentifier input) {
return input.toString();
}
}));
Set
assertEquals(expectedNames, fileNames);
FileUtils.cleanDirectory(testDir);
}
代码示例来源:origin: apache/jackrabbit-oak
@Before
public void setup() throws Exception {
if (type == CACHING_FDS) {
CachingFileDataStore ds = new CachingFileDataStore();
Properties props = new Properties();
props.setProperty("fsBackendPath", folder.newFolder().getAbsolutePath());
PropertiesUtil.populate(ds, Maps.fromProperties(props), false);
ds.setProperties(props);
ds.init(folder.newFolder().getAbsolutePath());
dataStore = ds;
} else {
OakFileDataStore ds = new OakFileDataStore();
ds.init(folder.newFolder().getAbsolutePath());
dataStore = ds;
}
}
代码示例来源:origin: apache/jackrabbit-oak
private BlobStore createBlobStore() {
FileDataStore fds = new OakFileDataStore();
fdsDir = "target/fds-" + codec + copyOnRW + minRecordLength + mergePolicy;
fds.setPath(fdsDir);
if (minRecordLength > 0) {
fds.setMinRecordLength(minRecordLength);
}
fds.init(null);
dataStoreBlobStore = new DataStoreBlobStore(fds);
StatisticsProvider sp = new DefaultStatisticsProvider(scheduledExecutorService);
BlobStatsCollector collector = new BlobStoreStats(sp);
dataStoreBlobStore.setBlobStatsCollector(collector);
return dataStoreBlobStore;
}