Search in sources :

Example 21 with NamespaceResolver

use of org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver in project jackrabbit by apache.

the class CreateFileTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    rs = helper.getRepositoryService();
    si = helper.getAdminSessionInfo();
    NamespaceResolver nsResolver = new AbstractNamespaceResolver() {

        public String getURI(String prefix) {
            return ("jcr".equals(prefix)) ? "http://www.jcp.org/jcr/1.0" : prefix;
        }

        public String getPrefix(String uri) {
            return ("http://www.jcp.org/jcr/1.0".equals(uri)) ? "jcr" : uri;
        }
    };
    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);
    }
    lastModified = rs.getQValueFactory().create(Calendar.getInstance());
    mimeType = rs.getQValueFactory().create("text/plain", PropertyType.STRING);
    enc = rs.getQValueFactory().create("utf-8", PropertyType.STRING);
}
Also used : Batch(org.apache.jackrabbit.spi.Batch) AbstractNamespaceResolver(org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver) NamespaceResolver(org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) RepositoryException(javax.jcr.RepositoryException) AbstractNamespaceResolver(org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver)

Aggregations

NamespaceResolver (org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver)21 DefaultNamePathResolver (org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver)12 RepositoryException (javax.jcr.RepositoryException)10 AbstractNamespaceResolver (org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver)8 ClusterConfig (org.apache.jackrabbit.core.config.ClusterConfig)6 Batch (org.apache.jackrabbit.spi.Batch)6 ClusterNode (org.apache.jackrabbit.core.cluster.ClusterNode)4 SimpleClusterContext (org.apache.jackrabbit.core.cluster.SimpleClusterContext)4 JournalFactory (org.apache.jackrabbit.core.journal.JournalFactory)4 MemoryJournal (org.apache.jackrabbit.core.journal.MemoryJournal)3 QValue (org.apache.jackrabbit.spi.QValue)3 ArrayList (java.util.ArrayList)2 Name (org.apache.jackrabbit.spi.Name)2 NamePathResolver (org.apache.jackrabbit.spi.commons.conversion.NamePathResolver)2 File (java.io.File)1 HashMap (java.util.HashMap)1 NamespaceException (javax.jcr.NamespaceException)1 Value (javax.jcr.Value)1 AssertionFailedError (junit.framework.AssertionFailedError)1 HierarchyManagerImpl (org.apache.jackrabbit.core.HierarchyManagerImpl)1