Search in sources :

Example 1 with OakOSGiRepositoryFactory

use of org.apache.jackrabbit.oak.run.osgi.OakOSGiRepositoryFactory in project jackrabbit-oak by apache.

the class RepositoryInitializer method createRepository.

private Repository createRepository(List<String> repoConfigs, File repoHomeDir) throws RepositoryException {
    Map<String, Object> config = Maps.newHashMap();
    config.put(OakOSGiRepositoryFactory.REPOSITORY_HOME, repoHomeDir.getAbsolutePath());
    config.put(OakOSGiRepositoryFactory.REPOSITORY_CONFIG_FILE, commaSepFilePaths(repoConfigs));
    config.put(OakOSGiRepositoryFactory.REPOSITORY_SHUTDOWN_ON_TIMEOUT, false);
    config.put(OakOSGiRepositoryFactory.REPOSITORY_ENV_SPRING_BOOT, true);
    config.put(OakOSGiRepositoryFactory.REPOSITORY_TIMEOUT_IN_SECS, 10);
    //Set of properties used to perform property substitution in
    //OSGi configs
    config.put("repo.home", repoHomeDir.getAbsolutePath());
    config.put("oak.mongo.db", mongoDbName);
    config.put("oak.mongo.uri", getMongoURI());
    //Configures BundleActivator to get notified of
    //OSGi startup and shutdown
    configureActivator(config);
    return new OakOSGiRepositoryFactory().getRepository(config);
}
Also used : OakOSGiRepositoryFactory(org.apache.jackrabbit.oak.run.osgi.OakOSGiRepositoryFactory)

Example 2 with OakOSGiRepositoryFactory

use of org.apache.jackrabbit.oak.run.osgi.OakOSGiRepositoryFactory in project jackrabbit-oak by apache.

the class RepositoryStartupServlet method createRepository.

/**
     * Creates the repository instance for the given config and homedir.
     * Subclasses may override this method of providing own implementations of
     * a {@link Repository}.
     *
     * @param configJson input source of the repository config
     * @param homedir the repository home directory
     * @return a new jcr repository.
     * @throws RepositoryException if an error during creation occurs.
     */
protected Repository createRepository(File configJson, File homedir) throws RepositoryException {
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(OakOSGiRepositoryFactory.REPOSITORY_HOME, homedir.getAbsolutePath());
    config.put(OakOSGiRepositoryFactory.REPOSITORY_CONFIG_FILE, configJson.getAbsolutePath());
    config.put(OakOSGiRepositoryFactory.REPOSITORY_BUNDLE_FILTER, getBootstrapConfig().getBundleFilter());
    config.put(OakOSGiRepositoryFactory.REPOSITORY_SHUTDOWN_ON_TIMEOUT, getBootstrapConfig().isShutdownOnTimeout());
    config.put(OakOSGiRepositoryFactory.REPOSITORY_TIMEOUT_IN_SECS, getBootstrapConfig().getStartupTimeout());
    configureActivator(config);
    //TODO oak-jcr also provides a dummy RepositoryFactory. Hence this
    //cannot be used
    //return JcrUtils.getRepository(config);
    Repository repository = new OakOSGiRepositoryFactory().getRepository(config);
    configWebConsoleSecurityProvider(repository);
    return repository;
}
Also used : Repository(javax.jcr.Repository) JackrabbitRepository(org.apache.jackrabbit.api.JackrabbitRepository) HashMap(java.util.HashMap) UnicastRemoteObject(java.rmi.server.UnicastRemoteObject) OakOSGiRepositoryFactory(org.apache.jackrabbit.oak.run.osgi.OakOSGiRepositoryFactory)

Aggregations

OakOSGiRepositoryFactory (org.apache.jackrabbit.oak.run.osgi.OakOSGiRepositoryFactory)2 UnicastRemoteObject (java.rmi.server.UnicastRemoteObject)1 HashMap (java.util.HashMap)1 Repository (javax.jcr.Repository)1 JackrabbitRepository (org.apache.jackrabbit.api.JackrabbitRepository)1