org.apache.jackrabbit.core.data.DataStore.init()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(119)

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

DataStore.init介绍

[英]Initialized the data store
[中]初始化数据存储

代码示例

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

@Override
public BlobStore setUp() {
  String className = System.getProperty("dataStore");
  checkNotNull(className, "No system property named 'dataStore' defined");
  try {
    dataStore = Class.forName(className).asSubclass(DataStore.class).newInstance();
    config = getConfig();
    configure(dataStore, config);
    dataStore = configureIfCloudDataStore(className, dataStore, config, unique.toLowerCase(), statisticsProvider);
    storeDir = new File(basedir, unique);
    dataStore.init(storeDir.getAbsolutePath());
    blobStore = new DataStoreBlobStore(dataStore, true, fdsCacheInMB);
    configure(blobStore);
    return blobStore;
  } catch (Exception e) {
    throw new IllegalStateException("Cannot instantiate DataStore " + className, e);
  }
}

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

@Override
public BlobStore setUp() {
  String className = System.getProperty("dataStore");
  checkNotNull(className, "No system property named 'dataStore' defined");
  try {
    dataStore = Class.forName(className).asSubclass(DataStore.class).newInstance();
    config = getConfig();
    configure(dataStore, config);
    dataStore = configureIfCloudDataStore(className, dataStore, config, unique.toLowerCase(), statisticsProvider);
    storeDir = new File(basedir, unique);
    dataStore.init(storeDir.getAbsolutePath());
    blobStore = new DataStoreBlobStore(dataStore, true, fdsCacheInMB);
    configure(blobStore);
    return blobStore;
  } catch (Exception e) {
    throw new IllegalStateException("Cannot instantiate DataStore " + className, e);
  }
}

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

private void initializeDelegate(String homeDir) throws RepositoryException {
  checkNotNull(delegateClass, "No delegate DataStore class defined via 'delegateClass' property");
  try {
    delegate = (DataStore) getClass().getClassLoader().loadClass(delegateClass).newInstance();
  } catch (InstantiationException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  } catch (IllegalAccessException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  } catch (ClassNotFoundException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  }
  log.info("Using {} as the delegating DataStore", delegateClass);
  if (delegateConfigFilePath != null) {
    File configFile = new File(delegateConfigFilePath);
    checkArgument(configFile.exists(), "Delegate DataStore config file %s does not exist", configFile.getAbsolutePath());
    InputStream is = null;
    try {
      Properties props = new Properties();
      is = Files.asByteSource(configFile).openStream();
      props.load(is);
      PropertiesUtil.populate(delegate, propsToMap(props), false);
      log.info("Configured the delegating DataStore via {}", configFile.getAbsolutePath());
    } catch (IOException e) {
      throw new RepositoryException("Error reading from config file " + configFile.getAbsolutePath(), e);
    } finally {
      IOUtils.closeQuietly(is);
    }
  }
  delegate.init(homeDir);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

ds.init(homeDir);

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

private void initializeDelegate(String homeDir) throws RepositoryException {
  checkNotNull(delegateClass, "No delegate DataStore class defined via 'delegateClass' property");
  try {
    delegate = (DataStore) getClass().getClassLoader().loadClass(delegateClass).newInstance();
  } catch (InstantiationException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  } catch (IllegalAccessException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  } catch (ClassNotFoundException e) {
    throw new RepositoryException("Cannot load delegate class " + delegateClass, e);
  }
  log.info("Using {} as the delegating DataStore", delegateClass);
  if (delegateConfigFilePath != null) {
    File configFile = new File(delegateConfigFilePath);
    checkArgument(configFile.exists(), "Delegate DataStore config file %s does not exist", configFile.getAbsolutePath());
    InputStream is = null;
    try {
      Properties props = new Properties();
      is = Files.asByteSource(configFile).openStream();
      props.load(is);
      PropertiesUtil.populate(delegate, propsToMap(props), false);
      log.info("Configured the delegating DataStore via {}", configFile.getAbsolutePath());
    } catch (IOException e) {
      throw new RepositoryException("Error reading from config file " + configFile.getAbsolutePath(), e);
    } finally {
      IOUtils.closeQuietly(is);
    }
  }
  delegate.init(homeDir);
}

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

ds.init(homeDir);

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

((MultiDataStore) store).setArchiveDataStore(archive);
store.init(directory);
return store;

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

ds.init(homeDir);

代码示例来源:origin: apache/jackrabbit

((MultiDataStore) store).setArchiveDataStore(archive);
store.init(directory);
return store;

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

public static DataStore getS3DataStore(String className, Properties props, String homeDir) throws Exception {
  DataStore ds = Class.forName(className).asSubclass(DataStore.class).newInstance();
  PropertiesUtil.populate(ds, Utils.asMap(props), false);
  // Set the props object
  if (S3.getName().equals(className)) {
    ((S3DataStore) ds).setProperties(props);
  }
  ds.init(homeDir);
  return ds;
}

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

public static DataStoreBlobStore getBlobStore(String homeDir) throws Exception {
  String className = System.getProperty(DS_CLASS_NAME, OakFileDataStore.class.getName());
  DataStore ds = Class.forName(className).asSubclass(DataStore.class).newInstance();
  PropertiesUtil.populate(ds, getConfig(), false);
  ds.init(homeDir);
  return new DataStoreBlobStore(ds);
}

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

private DataStore getAssertCachingFileDataStore(String nasPath, String cachePath)
  throws RepositoryException {
  long cacheSize = 100L;
  Map<String, Object> config = new HashMap<String, Object>();
  config.put("repository.home", folder.getRoot().getAbsolutePath());
  config.put(FileDataStoreService.CACHE_SIZE, cacheSize);
  config.put(FileDataStoreService.PATH, nasPath);
  config.put(FileDataStoreService.CACHE_PATH, cachePath);
  FileDataStoreService fdsSvc = new FileDataStoreService();
  DataStore ds = fdsSvc.createDataStore(context.componentContext(), config);
  PropertiesUtil.populate(ds, config, false);
  ds.init(folder.getRoot().getAbsolutePath());
  assertTrue("not instance of CachingFDS", ds instanceof CachingFileDataStore);
  return ds;
}

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

@Override
public NodeStore createNodeStore() {
  try {
    log.info("Creating NodeStore using " + toString());
    DocumentNodeStoreBuilder<?> documentNodeStoreBuilder = DocumentNodeStoreBuilder.newDocumentNodeStoreBuilder();
    File dataStoreFolder = null;
    BlobStore blobStore = null;
    DataStore dataStore = null;
    if (dataStoreFixture != null) {
      dataStore = dataStoreFixture.createDataStore();
      // init with a new folder inside a temporary one
      dataStoreFolder = FixtureUtils.createTempFolder();
      dataStore.init(dataStoreFolder.getAbsolutePath());
      blobStore = new DataStoreBlobStore(dataStore);
      documentNodeStoreBuilder.setBlobStore(blobStore);
    }
    NodeStore nodeStore = documentNodeStoreBuilder.build();
    // track all main components
    if (dataStore != null) {
      components.put(nodeStore, DataStore.class.getName(), dataStore);
      components.put(nodeStore, DataStore.class.getName() + ":folder", dataStoreFolder);
    }
    if (blobStore != null) {
      components.put(nodeStore, BlobStore.class.getName(), blobStore);
    }
    return nodeStore;
  } catch (IOException | RepositoryException e) {
    throw new AssertionError("Cannot create test repo fixture " + toString(), e);
  }
}

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

/**
 *
 * Test to verify @FileDataStore is returned if cacheSize is not configured.
 */
@Test
public void configFileDataStore() throws Exception {
  String nasPath = folder.getRoot().getAbsolutePath() + "/NASPath";
  String cachePath = folder.getRoot().getAbsolutePath() + "/cachePath";
  Map<String, Object> config = new HashMap<String, Object>();
  config.put("repository.home", folder.getRoot().getAbsolutePath());
  config.put(FileDataStoreService.PATH, nasPath);
  config.put(FileDataStoreService.CACHE_PATH, cachePath);
  FileDataStoreService fdsSvc = new FileDataStoreService();
  DataStore ds = fdsSvc.createDataStore(context.componentContext(), config);
  PropertiesUtil.populate(ds, config, false);
  ds.init(folder.getRoot().getAbsolutePath());
  assertTrue("not instance of FileDataStore", ds instanceof FileDataStore);
  FileDataStore fds = (FileDataStore) ds;
  assertEquals("path not equal", nasPath, fds.getPath());
}

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

dataStore.init(dataStoreFolder.getAbsolutePath());

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

populate(delegate, asMap(props), true);
delegate.init(null);

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

populate(delegate, asMap(props), true);
delegate.init(null);

相关文章