/** * Returns the configuration of a repository in a given repository * directory. The repository configuration is read from a "repository.xml" * file inside the repository directory. * <p> * The directory is created if it does not exist. If the repository * configuration file does not exist, then it is created using the * default Jackrabbit configuration settings. * * @param dir repository home directory * @return repository configuration * @throws ConfigurationException on configuration errors * @throws java.io.IOException If an error occurs. * @since Apache Jackrabbit 1.6 */ public static RepositoryConfig install(File dir) throws IOException, ConfigurationException { return install(new File(dir, REPOSITORY_XML), dir); }
/** * Returns the configuration of a repository in a given repository * directory. The repository configuration is read from a "repository.xml" * file inside the repository directory. * <p> * The directory is created if it does not exist. If the repository * configuration file does not exist, then it is created using the * default Jackrabbit configuration settings. * * @param dir repository home directory * @return repository configuration * @throws ConfigurationException on configuration errors * @throws java.io.IOException If an error occurs. * @since Apache Jackrabbit 1.6 */ public static RepositoryConfig install(File dir) throws IOException, ConfigurationException { return install(new File(dir, REPOSITORY_XML), dir); }
/** * Sets up the test case by creating the repository home directory * and copying the repository configuration file in place. */ protected void setUp() throws Exception { config = RepositoryConfig.install(DIR); }
/** * Copies the contents of the repository with the given configuration * to a repository in the given target directory. * * @param source source repository configuration * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(RepositoryConfig source, File target) throws RepositoryException, IOException { copy(source, RepositoryConfig.install(target)); }
/** * Copies the contents of the repository with the given configuration * to a repository in the given target directory. * * @param source source repository configuration * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(RepositoryConfig source, File target) throws RepositoryException, IOException { copy(source, RepositoryConfig.install(target)); }
/** * Copies the contents of the given source repository to a repository in * the given target directory. * <p> * The source repository <strong>must not be modified</strong> while * the copy operation is running to avoid an inconsistent copy. * * @param source source repository directory * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(RepositoryImpl source, File target) throws RepositoryException, IOException { copy(source, RepositoryConfig.install(target)); }
/** * Starts a repository in the given directory and returns the * internal component context of the started repository. If needed, * the directory is created and a default repository configuration * is installed inside it. * * @since Apache Jackrabbit 2.3.1 * @see RepositoryConfig#install(File) * @param dir repository directory * @return component context of the repository * @throws RepositoryException if the repository could not be started * @throws IOException if the directory could not be initialized */ public static RepositoryContext install(File dir) throws RepositoryException, IOException { return create(RepositoryConfig.install(dir)); }
/** * Copies the contents of the given source repository to a repository in * the given target directory. * <p> * The source repository <strong>must not be modified</strong> while * the copy operation is running to avoid an inconsistent copy. * * @param source source repository directory * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(RepositoryImpl source, File target) throws RepositoryException, IOException { copy(source, RepositoryConfig.install(target)); }
/** * Starts a repository in the given directory and returns the * internal component context of the started repository. If needed, * the directory is created and a default repository configuration * is installed inside it. * * @since Apache Jackrabbit 2.3.1 * @see RepositoryConfig#install(File) * @param dir repository directory * @return component context of the repository * @throws RepositoryException if the repository could not be started * @throws IOException if the directory could not be initialized */ public static RepositoryContext install(File dir) throws RepositoryException, IOException { return create(RepositoryConfig.install(dir)); }
public void start(BundleContext context) throws Exception { repository = RepositoryImpl.create( RepositoryConfig.install(new File("jackrabbit"))); Hashtable<String, String> properties = new Hashtable<String, String>(); for (String key : repository.getDescriptorKeys()) { String descriptor = repository.getDescriptor(key); if (descriptor != null) { properties.put(key, descriptor); } } registration = context.registerService( Repository.class.getName(), repository, properties); }
/** * Copies the contents of the repository in the given source directory * to a repository in the given target directory. * * @param source source repository directory * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(File source, File target) throws RepositoryException, IOException { copy(RepositoryConfig.create(source), RepositoryConfig.install(target)); }
/** * Copies the contents of the repository in the given source directory * to a repository in the given target directory. * * @param source source repository directory * @param target target repository directory * @throws RepositoryException if the copy operation fails * @throws IOException if the target repository can not be initialized */ public static void copy(File source, File target) throws RepositoryException, IOException { copy(RepositoryConfig.create(source), RepositoryConfig.install(target)); }
private void backup(File sourceDir) throws Exception { RepositoryConfig source; if (command.hasOption("conf")) { source = RepositoryConfig.create( new File(command.getOptionValue("conf")), sourceDir); } else { source = RepositoryConfig.create(sourceDir); } File targetDir; if (command.hasOption("backup-repo")) { targetDir = new File(command.getOptionValue("backup-repo")); } else { int i = 1; do { targetDir = new File("jackrabbit-backup" + i++); } while (targetDir.exists()); } RepositoryConfig target; if (command.hasOption("backup-conf")) { target = RepositoryConfig.install( new File(command.getOptionValue("backup-conf")), targetDir); } else { target = RepositoryConfig.install(targetDir); } message("Creating a repository copy in " + targetDir); RepositoryCopier.copy(source, target); message("The repository has been successfully copied."); }
public RepositoryImpl getRepository() throws RepositoryException { try { return RepositoryImpl.create( RepositoryConfig.install(xml, dir)); } catch (IOException e) { throw new RepositoryException( "Automatic repository configuration failed", e); } catch (ConfigurationException e) { throw new RepositoryException( "Invalid repository configuration file: " + xml, e); } } }, dir.getAbsolutePath());
public RepositoryImpl getRepository() throws RepositoryException { try { return RepositoryImpl.create( RepositoryConfig.install(xml, dir)); } catch (IOException e) { throw new RepositoryException( "Automatic repository configuration failed", e); } catch (ConfigurationException e) { throw new RepositoryException( "Invalid repository configuration file: " + xml, e); } } }, dir.getAbsolutePath());
public RepositoryImpl getRepository() throws RepositoryException { try { return RepositoryImpl.create( RepositoryConfig.install(properties)); } catch (IOException e) { throw new RepositoryException( "Automatic repository configuration failed: " + properties, e); } catch (ConfigurationException e) { throw new RepositoryException( "Invalid repository configuration: " + properties, e); } } }, RepositoryConfig.getRepositoryHome(properties).getAbsolutePath());
public RepositoryImpl getRepository() throws RepositoryException { try { return RepositoryImpl.create( RepositoryConfig.install(properties)); } catch (IOException e) { throw new RepositoryException( "Automatic repository configuration failed: " + properties, e); } catch (ConfigurationException e) { throw new RepositoryException( "Invalid repository configuration: " + properties, e); } } }, RepositoryConfig.getRepositoryHome(properties).getAbsolutePath());
protected RepositoryImpl createSourceRepository(File repositoryHome) throws IOException, RepositoryException { InputStream repoConfig = getRepositoryConfig(); RepositoryConfig config; if (repoConfig == null) { config = RepositoryConfig.install(repositoryHome); } else { OutputStream out = FileUtils.openOutputStream(new File(repositoryHome, "repository.xml")); IOUtils.copy(repoConfig, out); out.close(); repoConfig.close(); config = RepositoryConfig.create(repositoryHome); } return RepositoryImpl.create(config); }
private DocumentNodeStore migrate(SourceDataCreator sourceDataCreator) throws RepositoryException, IOException { RepositoryConfig config = RepositoryConfig.install(crx2RepoDir); RepositoryImpl repository = RepositoryImpl.create(config); try { Session session = repository.login(CREDENTIALS); sourceDataCreator.create(session); session.logout(); } finally { repository.shutdown(); } config = RepositoryConfig.install(crx2RepoDir); // re-create the config RepositoryContext context = RepositoryContext.create(config); DocumentNodeStore target = newDocumentNodeStoreBuilder().build(); try { RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target); upgrade.copy(null); } finally { context.getRepository().shutdown(); } return target; }
File source = new File(root, "source"); source.mkdirs(); RepositoryImpl sourceRepository = RepositoryContext.create(RepositoryConfig.install(source)).getRepository(); Session session = sourceRepository.login(new SimpleCredentials("admin", "admin".toCharArray())); try { RepositoryContext ctx = RepositoryContext.create(RepositoryConfig.install(source)); RepositoryUpgrade upgrade = new RepositoryUpgrade(ctx, dst); upgrade.setCheckLongNames(true); ctx = RepositoryContext.create(RepositoryConfig.install(source)); upgrade = new RepositoryUpgrade(ctx, dst); upgrade.setCheckLongNames(false);