Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.TransientRepository$RepositoryFactory


    // similar to above, but disconnects version history before damaging the repository
    public void testMissingRootVersion2() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);

        String oldVersionRecoveryProp = System
                .getProperty("org.apache.jackrabbit.version.recovery");
View Full Code Here


    // tests recovery from a broken hierarchy in the version store
    public void testBrokenVhrParent() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);

        try {
            Node root = s.getRootNode();
View Full Code Here

    }

    public void testAutoFix() throws Exception {

        // new repository
        TransientRepository rep = new TransientRepository(new File(TEST_DIR));
        Session s = openSession(rep, false);
        Node root = s.getRootNode();

        // add nodes /test and /test/missing
        Node test = root.addNode("test");
        Node missing = test.addNode("missing");
        missing.addMixin("mix:referenceable");
        UUID id = UUID.fromString(missing.getIdentifier());
        s.save();
        s.logout();

        destroyBundle(id, "workspaces/default");

        // login and try the operation
        s = openSession(rep, false);
        test = s.getRootNode().getNode("test");

        // try to add a node with the same name
        try {
            test.addNode("missing");
            s.save();
        } catch (RepositoryException e) {
            // expected
        }

        s.logout();

        s = openSession(rep, true);
        test = s.getRootNode().getNode("test");
        // iterate over all child nodes fixes the corruption
        NodeIterator it = test.getNodes();
        while (it.hasNext()) {
            it.nextNode();
        }

        // try to add a node with the same name
        test.addNode("missing");
        s.save();

        // try to delete the parent node
        test.remove();
        s.save();

        s.logout();
        rep.shutdown();

        FileUtils.deleteDirectory(new File("repository"));
    }
View Full Code Here

        FileUtils.deleteDirectory( dir );

        assertTrue( confFile.exists() );
        assertFalse( dir.exists() );

        TransientRepository repository = new TransientRepository( confFile, dir );
        session = repository.login( new SimpleCredentials( "username", "password".toCharArray() ) );

        // TODO: perhaps have an archiva-jcr-utils module shared by these plugins that does this and can contain
        //      structure information
        Workspace workspace = session.getWorkspace();
        NamespaceRegistry registry = workspace.getNamespaceRegistry();
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();

    jcrProvider = new DefaultProvider();

    repository = new TransientRepository();
   
    JcrCollectionAdapter cp = new JcrCollectionAdapter();
    cp.setTitle("My Entries");
    cp.setAuthor("Apache Abdera");
    cp.setCollectionNodePath("entries");        
View Full Code Here

    String derbyLog = repositoryDirFile.getAbsolutePath()+File.separator+"derby.log";
    System.setProperty("derby.stream.error.file", derbyLog);

    // setup Jackrabbit JCR repository JNDI resource
    String repositoryConfig = repositoryDirFile.getAbsolutePath()+File.separator+"repository.xml";
    Repository repository = new TransientRepository(repositoryConfig, repositoryDirFile.getAbsolutePath());
    new Resource(JCRPersistenceManager.WIDGET_REPOSITORY_JNDI_REPOSITORY_NAME, repository);
   
  }
View Full Code Here

            repositoryDirFile.mkdirs();
        }
        String derbyLog = repositoryDir+File.separator+"derby.log";
        System.setProperty("derby.stream.error.file", derbyLog);
        String repositoryConfig = repositoryDir+File.separator+"repository.xml";
        Repository repository = new TransientRepository(repositoryConfig, repositoryDir);
       
        // create JNDI context
        rootContext = new InitialContext();
        Context namingContext = lookupOrCreateNamingContext(rootContext, "java:comp");
        namingContext = lookupOrCreateNamingContext(namingContext, "env");
View Full Code Here

     */
    private synchronized void initializeRepository() {
        logger.fine("Initializing JCR repository");
        try {
            if( repository == null) {
                repository = new TransientRepository(new File(repositoryHome));
            }
            session = repository.login(new SimpleCredentials("photarkUser", "passwordDoesNotMatter".toCharArray()));               
        } catch (Exception e) {
            logger.log(Level.INFO, ">>>Error initializing JCR repository : " + e.getMessage(), e);
        }
View Full Code Here

    }

    @Override
    protected Context createJndiContext() throws Exception {
        Context context = super.createJndiContext();
        repository = new TransientRepository("target/repository.xml", "target/repository");
        context.bind("repository", repository);
        return context;
    }
View Full Code Here

    public static void beforeAll() throws Exception {
        // Clean up the test data ...
        FileUtil.delete(JACKRABBIT_DATA_PATH);

        // Set up the transient repository (this shouldn't do anything yet)...
        repository = new TransientRepository(REPOSITORY_CONFIG_PATH, REPOSITORY_DIRECTORY_PATH);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.TransientRepository$RepositoryFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.