Package org.apache.jackrabbit.spi

Examples of org.apache.jackrabbit.spi.Batch


        }

        public Batch createBatch(final SessionInfo sessionInfo, final ItemId itemId)
                throws RepositoryException {

            Batch result = super.createBatch(sessionInfo, itemId);
            return result == null
                ? null
                : create(result, logWriterProvider);
        }
View Full Code Here


            super.tearDown();
        }
    }

    private void createTestNode(String testPath) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
        String name = Text.getName(testPath);
        b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);
    }
View Full Code Here

        b.addNode(getNodeId("/"), resolver.getQName(name), NameConstants.NT_UNSTRUCTURED, null);
        rs.submit(b);
    }

    private void removeTestNode(String path) throws RepositoryException {
        Batch b = rs.createBatch(si, getNodeId("/"));
        b.remove(getNodeId(path));
        rs.submit(b);
    }
View Full Code Here

        resolver = new DefaultNamePathResolver(nsResolver);

        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }
    }
View Full Code Here

    }

    protected void tearDown() throws Exception {
        try {
            if (si != null) {
                Batch b = rs.createBatch(si, getNodeId("/"));
                b.remove(getNodeId(testPath));
                rs.submit(b);
            }
            if (sInfo != null && copiedId != null) {
                Batch b = rs.createBatch(sInfo, getNodeId("/"));
                b.remove(copiedId);
                rs.submit(b);
            }
        } catch (RepositoryException e) {
            // cleanup failed... ignore.
        } finally {
View Full Code Here

            NodeInfo nInfo2 = (NodeInfo) it.next();
            assertEquals(nInfo.getId(), nInfo2.getId());
            assertEquals(nInfo.getNodetype(), nInfo2.getNodetype());
        } finally {
            if (nid != null) {
                Batch b = rs.createBatch(si, getNodeId("/"));
                b.remove(nid);
                rs.submit(b);
            }
        }
    }
View Full Code Here

        resolver = new DefaultNamePathResolver(nsResolver);
       
        try {
            rs.getNodeInfo(si, getNodeId(testPath));
        } catch (RepositoryException e) {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.addNode(getNodeId("/"), resolver.getQName("test"), NameConstants.NT_UNSTRUCTURED, null);
            rs.submit(b);
        }
    }
View Full Code Here

        }
    }

    protected void tearDown() throws Exception {
        try {
            Batch b = rs.createBatch(si, getNodeId("/"));
            b.remove(getNodeId(testPath));
            rs.submit(b);
        } finally {
            rs.dispose(si);
            super.tearDown();
        }
View Full Code Here

        }
    }

    public void testAddNode() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);

        b.addNode(nid, resolver.getQName("aNode"), NameConstants.NT_UNSTRUCTURED, null);
        b.addProperty(nid, resolver.getQName("aString"), rs.getQValueFactory().create("ba", PropertyType.STRING));
        b.addProperty(nid, resolver.getQName("aName"), new QValue[] {rs.getQValueFactory().create(NameConstants.JCR_ENCODING), rs.getQValueFactory().create(NameConstants.JCR_DATA)});
        b.addProperty(nid, resolver.getQName("aBinary"), rs.getQValueFactory().create(new byte[] { 'a', 'b', 'c'}));

        rs.submit(b);

        NodeId id = rs.getIdFactory().createNodeId(nid, resolver.getQPath("aNode"));
        Iterator it = rs.getItemInfos(si, id);
        while (it.hasNext()) {
            ItemInfo info = (ItemInfo) it.next();
            if (info.denotesNode()) {
                NodeInfo nInfo = (NodeInfo) info;
                assertEquals(NameConstants.NT_UNSTRUCTURED, nInfo.getNodetype());
                Iterator childIt = nInfo.getChildInfos();
                assertTrue(childIt == null || !childIt.hasNext());
                assertEquals(id, nInfo.getId());
            }
        }

        b = rs.createBatch(si, nid);
        b.remove(id);
        rs.submit(b);
    }
View Full Code Here

        rs.submit(b);
    }

    public void testImport() throws RepositoryException {
        NodeId nid = getNodeId(testPath);
        Batch b = rs.createBatch(si, nid);

        String uuid = UUID.randomUUID().toString();
        b.addNode(nid, resolver.getQName("testUUIDNode"), NameConstants.NT_UNSTRUCTURED, uuid);

        NodeId id = getNodeId(testPath + "/testUUIDNode");
        b.setMixins(id, new Name[] {NameConstants.MIX_REFERENCEABLE});

        rs.submit(b);

        NodeInfo nInfo = rs.getNodeInfo(si, id);
        assertEquals(uuid, nInfo.getId().getUniqueID());
        Name[] mixins = nInfo.getMixins();
        assertEquals(1, mixins.length);
        assertEquals(NameConstants.MIX_REFERENCEABLE, mixins[0]);

        b = rs.createBatch(si, nid);
        b.remove(rs.getIdFactory().createNodeId(uuid));
        rs.submit(b);

        try {
            rs.getItemInfos(si, id);
            fail();
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.spi.Batch

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.