Search in sources :

Example 21 with DefaultNamePathResolver

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

the class PropertyDefinitionTemplateImplTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    NamePathResolver resolver = new DefaultNamePathResolver(new DummyNamespaceResolver());
    tmpl = new PropertyDefinitionTemplateImpl(resolver);
}
Also used : NamePathResolver(org.apache.jackrabbit.spi.commons.conversion.NamePathResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) DummyNamespaceResolver(org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver)

Example 22 with DefaultNamePathResolver

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

the class PathFactoryTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    factory = PathFactoryImpl.getInstance();
    NamespaceResolver nsresolver = new NamespaceResolver() {

        public String getURI(String prefix) throws NamespaceException {
            throw new UnsupportedOperationException();
        }

        public String getPrefix(String uri) throws NamespaceException {
            if (uri.equals(Name.NS_JCR_URI)) {
                return Name.NS_JCR_PREFIX;
            } else {
                return uri;
            }
        }
    };
    resolver = new DefaultNamePathResolver(nsresolver);
}
Also used : NamespaceResolver(org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver)

Example 23 with DefaultNamePathResolver

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

the class ParserTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    NamePathResolver resolver = new DefaultNamePathResolver(new DummyNamespaceResolver());
    QueryObjectModelFactoryImpl factory = new QOMF(resolver);
    ValueFactory vf = new ValueFactoryQImpl(QValueFactoryImpl.getInstance(), resolver);
    parser = new Parser(factory, vf);
}
Also used : QueryObjectModelFactoryImpl(org.apache.jackrabbit.spi.commons.query.qom.QueryObjectModelFactoryImpl) NamePathResolver(org.apache.jackrabbit.spi.commons.conversion.NamePathResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) DummyNamespaceResolver(org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) ValueFactory(javax.jcr.ValueFactory) ValueFactoryQImpl(org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl) Parser(org.apache.jackrabbit.commons.query.sql2.Parser)

Example 24 with DefaultNamePathResolver

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

the class ValueFormatTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    idResolver = new IdentifierResolver() {

        public Path getPath(String identifier) throws MalformedPathException {
            throw new UnsupportedOperationException();
        }

        public void checkFormat(String identifier) throws MalformedPathException {
        // nop
        }
    };
    NameResolver nResolver = new ParsingNameResolver(NameFactoryImpl.getInstance(), new DummyNamespaceResolver());
    PathResolver pResolver = new ParsingPathResolver(PathFactoryImpl.getInstance(), nResolver, idResolver);
    resolver = new DefaultNamePathResolver(nResolver, pResolver);
    qvFactory = QValueFactoryImpl.getInstance();
    vFactory = new ValueFactoryQImpl(qvFactory, resolver);
}
Also used : IdentifierResolver(org.apache.jackrabbit.spi.commons.conversion.IdentifierResolver) Path(org.apache.jackrabbit.spi.Path) ParsingNameResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingNameResolver) DummyNamespaceResolver(org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver) MalformedPathException(org.apache.jackrabbit.spi.commons.conversion.MalformedPathException) NamePathResolver(org.apache.jackrabbit.spi.commons.conversion.NamePathResolver) PathResolver(org.apache.jackrabbit.spi.commons.conversion.PathResolver) ParsingPathResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) DefaultNamePathResolver(org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver) NameResolver(org.apache.jackrabbit.spi.commons.conversion.NameResolver) ParsingNameResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingNameResolver) ParsingPathResolver(org.apache.jackrabbit.spi.commons.conversion.ParsingPathResolver)

Example 25 with DefaultNamePathResolver

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

the class DavPropertyTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    repoURI = helper.getProperty(ServiceStubImpl.PROP_REPOSITORY_URI);
    rs = (RepositoryServiceImpl) 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);
        QValueFactory qvf = rs.getQValueFactory();
        b.addProperty(getNodeId("/test"), resolver.getQName("prop"), qvf.create("value", PropertyType.STRING));
        b.addProperty(getNodeId("/test"), resolver.getQName("propMV"), new QValue[] { qvf.create(1), qvf.create(2) });
        rs.submit(b);
    }
}
Also used : QValue(org.apache.jackrabbit.spi.QValue) 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) QValueFactory(org.apache.jackrabbit.spi.QValueFactory)

Aggregations

DefaultNamePathResolver (org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver)28 NamespaceResolver (org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver)12 NamePathResolver (org.apache.jackrabbit.spi.commons.conversion.NamePathResolver)10 RepositoryException (javax.jcr.RepositoryException)8 AbstractNamespaceResolver (org.apache.jackrabbit.spi.commons.namespace.AbstractNamespaceResolver)8 Batch (org.apache.jackrabbit.spi.Batch)6 QValue (org.apache.jackrabbit.spi.QValue)5 DummyNamespaceResolver (org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver)4 Value (javax.jcr.Value)3 Session (javax.jcr.Session)2 Path (org.apache.jackrabbit.spi.Path)2 PathResolver (org.apache.jackrabbit.spi.commons.conversion.PathResolver)2 ValueFactoryQImpl (org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl)2 InputStreamReader (java.io.InputStreamReader)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Principal (java.security.Principal)1 HashMap (java.util.HashMap)1 ValueFactory (javax.jcr.ValueFactory)1