/** * Copies the contents of the repository in the given source directory * to the given target node store. * * @param source source repository directory * @param target target node store * @throws RepositoryException if the copy operation fails */ public static void copy(File source, NodeStore target) throws RepositoryException { copy(RepositoryConfig.create(source), target); }
public RepositoryImpl getRepository() throws RepositoryException { return RepositoryImpl.create(RepositoryConfig.create(config)); } }, config.getHomeDir());
/** * Copies the contents of the repository in the given source directory * to the given target node store. * * @param source source repository directory * @param target target node store * @throws RepositoryException if the copy operation fails */ public static void copy(File source, NodeStore target) throws RepositoryException { copy(RepositoryConfig.create(source), target); }
public RepositoryContext create(Closer closer) throws RepositoryException { RepositoryContext source = RepositoryContext.create(RepositoryConfig.create(repositoryFile, repositoryDir)); closer.register(asCloseable(source)); return source; }
public RepositoryContext create(Closer closer) throws RepositoryException { RepositoryContext source = RepositoryContext.create(RepositoryConfig.create(repositoryFile, repositoryDir)); closer.register(asCloseable(source)); return source; }
/** * 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)); }
public static RepositoryImpl createRepository() { RepositoryConfig config; try { config = RepositoryConfig.create(new InputSource(JCRMailboxManagerTest.class.getClassLoader().getResourceAsStream("test-repository.xml")), JACKRABBIT_HOME); return RepositoryImpl.create(config); } catch (Exception e) { throw new RuntimeException(e); } }
public void testCreateWithRepositoryDirectory() { try { RepositoryConfig.create(DIR); } catch (ConfigurationException e) { fail("Valid repository directory"); } try { RepositoryConfig.create(new File(DIR, "invalid-repo-dir")); fail("Invalid repository directory"); } catch (ConfigurationException e) { } }
@Override public void setUp() throws RepositoryException { String file = "src/test/resources/org/apache/jackrabbit/core/security/simple/simple_repository.xml"; RepositoryConfig config = RepositoryConfig.create(file, "target/simple_repository"); repository = RepositoryImpl.create(config); }
private void startRepository() throws RepositoryException { repository = RepositoryImpl.create(RepositoryConfig.create(repoDescriptor.getAbsolutePath(), repoHome .getAbsolutePath())); }
private void startRepository() throws RepositoryException { repository = RepositoryImpl.create(RepositoryConfig.create(repoDescriptor.getAbsolutePath(), repoHome .getAbsolutePath())); }
protected synchronized Repository getRepository() { if (repository==null) { try { InputStream stream = ClassLoaderUtil.getStream(configuration); RepositoryConfig config = RepositoryConfig.create(stream, directory); repository = RepositoryImpl.create(config); } catch (Exception e) { // NOTE that Error's are not caught because that might halt the JVM and mask the original Error. throw new JbpmException("couldn't create new jackrabbit repository with configResource '"+configuration+"' and directory '"+directory+"'", e); } } return repository; } }
public void setUp() throws Exception { deleteAll(); FileUtils.copyFile( new File("./src/test/resources/org/apache/jackrabbit/core/cluster/repository-h2.xml"), new File("./target/descriptorClusterTest/node1/repository.xml")); FileUtils.copyFile( new File("./src/test/resources/org/apache/jackrabbit/core/cluster/repository-h2.xml"), new File("./target/descriptorClusterTest/node2/repository.xml")); rep1 = RepositoryImpl.create(RepositoryConfig.create( new File("./target/descriptorClusterTest/node1"))); rep2 = RepositoryImpl.create(RepositoryConfig.create( new File("./target/descriptorClusterTest/node2"))); }
@BeforeClass public static void before() throws RepositoryException { RepositoryConfig config = RepositoryConfig.create(new InputSource(JCRMailboxManagerTest.class.getClassLoader().getResourceAsStream("test-repository.xml")), JACKRABBIT_HOME); repository = RepositoryImpl.create(config); // Register imap cnd file JCRUtils.registerCnd(repository, workspace, user, pass); }
/** * Test that a RepositoryConfig can be copied into a new instance. * * @throws Exception if an unexpected error occurs during the test */ public void testCopyConfig() throws Exception { RepositoryConfig copyConfig = RepositoryConfig.create(config); assertNotNull("Configuration not created properly", copyConfig); assertRepositoryConfiguration(copyConfig); }
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); }
@Override protected void setUp() throws Exception { super.setUp(); deleteAll(); FileUtils.copyInputStreamToFile( getClass().getResourceAsStream("repository-with-test-journal.xml"), new File(getTestDir(), "repository.xml")); repo = RepositoryImpl.create(RepositoryConfig.create(getTestDir())); }
@Before public void setUp() throws Exception { if (Constants.WINDOWS) { return; } deleteAll(); FileUtils.copyInputStreamToFile( getClass().getResourceAsStream("repository-with-SimpleFSDirectory.xml"), new File(getTestDir(), "repository.xml")); repo = RepositoryImpl.create(RepositoryConfig.create(getTestDir())); session = repo.login(new SimpleCredentials("admin", "admin".toCharArray())); }
private void doUpgradeRepository(File source, NodeStore target, String... includes) throws RepositoryException { final RepositoryConfig config = RepositoryConfig.create(source); final RepositoryContext context = RepositoryContext.create(config); try { final RepositoryUpgrade upgrade = new RepositoryUpgrade(context, target); upgrade.setIncludes(includes); upgrade.copy(null); } finally { context.getRepository().shutdown(); } }
protected void migrate(VersionCopySetup setup, NodeStore target, String includePath) throws RepositoryException, IOException { final RepositoryConfig sourceConfig = RepositoryConfig.create(source); final RepositoryContext sourceContext = RepositoryContext.create(sourceConfig); try { final RepositoryUpgrade upgrade = new RepositoryUpgrade(sourceContext, target); upgrade.setIncludes(includePath); setup.setup(upgrade.versionCopyConfiguration); upgrade.setEarlyShutdown(false); upgrade.copy(null); } finally { sourceContext.getRepository().shutdown(); } }