Package org.apache.jackrabbit.oak.namepath

Examples of org.apache.jackrabbit.oak.namepath.NamePathMapper


            @Nonnull CommitInfo commitInfo);

    @Override
    public void contentChanged(@Nonnull NodeState root, @Nullable CommitInfo info) {
        if (previousRoot != null) {
            NamePathMapper namePathMapper = new NamePathMapperImpl(
                    new GlobalNameMapper(new ImmutableRoot(root)));

            Set<String> oakPropertyNames = Sets.newHashSet();
            for (String name : propertyNames) {
                String oakName = namePathMapper.getOakNameOrNull(name);
                if (oakName == null) {
                    LOG.warn("Ignoring invalid property name: {}", name);
                } else {
                    oakPropertyNames.add(oakName);
                }
            }

            NodeState before = previousRoot;
            NodeState after = root;
            EventHandler handler = new FilteredHandler(
                    new VisibleFilter(),
                    new NodeEventHandler("/", info, namePathMapper, oakPropertyNames));

            String oakPath = namePathMapper.getOakPath(path);
            if (oakPath == null) {
                LOG.warn("Cannot listen for changes on invalid path: {}", path);
                return;
            }
View Full Code Here


    private static Query parseQuery(
            String statement, String language, ExecutionContext context,
            Map<String, String> mappings) throws ParseException {
        LOG.debug("Parsing {} statement: {}", language, statement);

        NamePathMapper mapper = new NamePathMapperImpl(
                new LocalNameMapper(context.getRoot(), mappings));

        NodeState types = context.getBaseState()
                .getChildNode(JCR_SYSTEM)
                .getChildNode(JCR_NODE_TYPES);
View Full Code Here

    @Override
    public void contentChanged(@Nonnull NodeState root, @Nullable CommitInfo info) {
        if (previousRoot != null) {
            try {
                NamePathMapper namePathMapper = new NamePathMapperImpl(
                        new GlobalNameMapper(new ImmutableRoot(root)));

                Set<String> oakPropertyNames = Sets.newHashSet();
                for (String name : propertyNames) {
                    String oakName = namePathMapper.getOakNameOrNull(name);
                    if (oakName == null) {
                        LOG.warn("Ignoring invalid property name: {}", name);
                    } else {
                        oakPropertyNames.add(oakName);
                    }
                }

                NodeState before = previousRoot;
                NodeState after = root;
                EventHandler handler = new FilteredHandler(
                        VISIBLE_FILTER,
                        new NodeEventHandler("/", info, namePathMapper, oakPropertyNames));

                String oakPath = namePathMapper.getOakPath(path);
                if (oakPath == null) {
                    LOG.warn("Cannot listen for changes on invalid path: {}", path);
                    return;
                }
View Full Code Here

    @Override
    public Principal getPrincipal() throws RepositoryException {
        Tree userTree = getTree();
        String principalName = getPrincipalName();
        NamePathMapper npMapper = getUserManager().getNamePathMapper();
        if (isAdmin()) {
            return new AdminPrincipalImpl(principalName, userTree, npMapper);
        } else {
            return new TreeBasedPrincipal(principalName, userTree, npMapper);
        }
View Full Code Here

    @Override
    public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
        List<NodeType> list = Lists.newArrayList();
        Tree types = getTypes();
        if (types != null) {
            NamePathMapper mapper = getNamePathMapper();
            for (Tree type : types.getChildren()) {
                list.add(new NodeTypeImpl(type, mapper));
            }
        }
        return new NodeTypeIteratorAdapter(list);
View Full Code Here

    @Test
    public void testGetPath() {
        NameMapper nameMapper = new GlobalNameMapper(
                Collections.singletonMap("jr", "http://jackrabbit.apache.org"));
        NamePathMapper npMapper = new NamePathMapperImpl(nameMapper);

        // map of jcr-path to standard jcr-path
        Map<String, String> paths = new HashMap<String, String>();
        paths.put(null, null);
        paths.put(getTestPath(), getTestPath());
View Full Code Here

        }
    }

    @Test
    public void testGetOakPath() {
        NamePathMapper npMapper = new NamePathMapperImpl(new LocalNameMapper(
                singletonMap("oak", "http://jackrabbit.apache.org"),
                singletonMap("jcr", "http://jackrabbit.apache.org")));
        // map of jcr-path to oak path
        Map<String, String> paths = new HashMap<String, String>();
        paths.put(null, null);
View Full Code Here

            @Override
            protected Map<String, String> getNamespaceMap() {
                return Collections.singletonMap("jr", "http://jackrabbit.apache.org");
            }
        };
        NamePathMapper npMapper = new NamePathMapperImpl(nameMapper);

        // map of jcr-path to standard jcr-path
        Map<String, String> paths = new HashMap<String, String>();
        paths.put(null, null);
        paths.put(getTestPath(), getTestPath());
View Full Code Here

        }
    }

    @Test
    public void testGetOakPath() {
        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper());
        // map of jcr-path to oak path
        Map<String, String> paths = new HashMap<String, String>();
        paths.put(null, null);
        paths.put(getTestPath(), getTestPath());
        paths.put("/", "/");
View Full Code Here

    @Before
    public void before() throws Exception {
        super.before();

        registerNamespace(TestNameMapper.TEST_PREFIX, TestNameMapper.TEST_URI);
        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper(Namespaces.getNamespaceMap(root.getTree("/")), TestNameMapper.LOCAL_MAPPING));

        name = TestNameMapper.TEST_PREFIX + ":defName";
        PropertyState property = createProperty(name);
        restriction = new RestrictionImpl(property, true, npMapper);
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.namepath.NamePathMapper

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.