Search in sources :

Example 1 with NameResolver

use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.

the class EventState method setupCachingPathResolver.

private static void setupCachingPathResolver() {
    if (cachingPathResolver != null) {
        return;
    }
    PathResolver pathResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), new NameResolver() {

        public Name getQName(String name) throws IllegalNameException, NamespaceException {
            return null;
        }

        public String getJCRName(Name name) throws NamespaceException {
            return name.getLocalName();
        }
    });
    cachingPathResolver = new CachingPathResolver(pathResolver);
}
Also used : NamespaceException(javax.jcr.NamespaceException) CachingPathResolver(org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver) PathResolver(org.apache.jackrabbit.spi.commons.conversion.PathResolver) ParsingPathResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver) IllegalNameException(org.apache.jackrabbit.spi.commons.conversion.IllegalNameException) ParsingPathResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver) Name(org.apache.jackrabbit.spi.Name) CachingPathResolver(org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver)

Example 2 with NameResolver

use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.

the class ACLTemplateTest method testGetRestrictionTypes.

public void testGetRestrictionTypes() throws RepositoryException {
    JackrabbitAccessControlList acl = createEmptyTemplate(getTestPath());
    NameResolver resolver = (NameResolver) superuser;
    assertEquals(PropertyType.PATH, acl.getRestrictionType(resolver.getJCRName(ACLTemplate.P_NODE_PATH)));
    assertEquals(PropertyType.STRING, acl.getRestrictionType(resolver.getJCRName(ACLTemplate.P_GLOB)));
}
Also used : JackrabbitAccessControlList(org.apache.jackrabbit.api.security.JackrabbitAccessControlList) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver)

Example 3 with NameResolver

use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.

the class ACLTemplateTest method testGetRestrictionNames.

public void testGetRestrictionNames() throws RepositoryException {
    List<String> names = Arrays.asList(createEmptyTemplate(getTestPath()).getRestrictionNames());
    assertEquals(2, names.size());
    NameResolver resolver = (NameResolver) superuser;
    assertTrue(names.contains(resolver.getJCRName(ACLTemplate.P_NODE_PATH)));
    assertTrue(names.contains(resolver.getJCRName(ACLTemplate.P_GLOB)));
}
Also used : NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver)

Example 4 with NameResolver

use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.

the class AuthorizableImplTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    if (superuser instanceof SessionImpl) {
        NameResolver resolver = (SessionImpl) superuser;
        protectedUserProps.add(resolver.getJCRName(UserConstants.P_PASSWORD));
        protectedUserProps.add(resolver.getJCRName(UserConstants.P_IMPERSONATORS));
        protectedUserProps.add(resolver.getJCRName(UserConstants.P_PRINCIPAL_NAME));
        protectedUserProps.add(resolver.getJCRName(UserConstants.P_DISABLED));
        protectedGroupProps.add(resolver.getJCRName(UserConstants.P_MEMBERS));
        protectedGroupProps.add(resolver.getJCRName(UserConstants.P_PRINCIPAL_NAME));
    } else {
        throw new NotExecutableException();
    }
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) SessionImpl(org.apache.jackrabbit.core.SessionImpl) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver)

Example 5 with NameResolver

use of org.apache.jackrabbit.spi.commons.conversion.NameResolver in project jackrabbit by apache.

the class NodeTypeImplTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    ntMgr = superuser.getWorkspace().getNodeTypeManager();
    NodeType nt = ntMgr.getNodeType(testNodeType);
    if (nt instanceof NodeTypeImpl) {
        nodeType = (NodeTypeImpl) nt;
    } else {
        cleanUp();
        throw new NotExecutableException("NodeTypeImpl expected.");
    }
    if (superuser instanceof NameResolver) {
        resolver = (NameResolver) superuser;
    } else {
        cleanUp();
        throw new NotExecutableException();
    }
}
Also used : NotExecutableException(org.apache.jackrabbit.test.NotExecutableException) NodeType(javax.jcr.nodetype.NodeType) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver)

Aggregations

NameResolver (org.apache.jackrabbit.spi.commons.conversion.NameResolver)10 NotExecutableException (org.apache.jackrabbit.test.NotExecutableException)5 SessionImpl (org.apache.jackrabbit.core.SessionImpl)4 ParsingPathResolver (org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver)3 PathResolver (org.apache.jackrabbit.spi.commons.conversion.PathResolver)3 DefaultNamePathResolver (org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver)2 NamePathResolver (org.apache.jackrabbit.spi.commons.conversion.NamePathResolver)2 NamespaceException (javax.jcr.NamespaceException)1 Node (javax.jcr.Node)1 Session (javax.jcr.Session)1 Value (javax.jcr.Value)1 NodeType (javax.jcr.nodetype.NodeType)1 JackrabbitAccessControlList (org.apache.jackrabbit.api.security.JackrabbitAccessControlList)1 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)1 NodeImpl (org.apache.jackrabbit.core.NodeImpl)1 NodeId (org.apache.jackrabbit.core.id.NodeId)1 Name (org.apache.jackrabbit.spi.Name)1 Path (org.apache.jackrabbit.spi.Path)1 CachingPathResolver (org.apache.jackrabbit.spi.commons.conversion.CachingPathResolver)1 DummyNamespaceResolver (org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver)1