Package org.apache.sling.ide.transport

Examples of org.apache.sling.ide.transport.ResourceProxy


            initAllowedPrimaryChildNodeTypes(nt);
        }
    }
   
    private void initDeclaredFields(VltNodeType nt) {
        final ResourceProxy child = nt.getResourceProxy();
        String[] superTypeNamess = (String[]) child.getProperties()
                .get("jcr:supertypes");
        nt.setDeclaredSupertypeNames(superTypeNamess);
        if (superTypeNamess!=null) {
            NodeType[] superTypes = new NodeType[superTypeNamess.length];
            for (int i = 0; i < superTypeNamess.length; i++) {
                superTypes[i] = getNodeType(superTypeNamess[i]);
            }
            nt.setDeclaredSupertypes(superTypes);
        }

        Set<VltNodeDefinition> nds = new HashSet<VltNodeDefinition>();
        for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it
                .hasNext();) {
            ResourceProxy ntChild = it.next();
            String ntChildName = PathUtil.getName(ntChild.getPath());
            if (ntChildName.startsWith("jcr:childNodeDefinition")) {
                VltNodeDefinition nd = handleChildNodeDefinition(ntChild);
                nds.add(nd);
            } else if (ntChildName.startsWith("rep:residualChildNodeDefinitions")) {
                // go through children
                List<ResourceProxy> residualChildren = ntChild.getChildren();
                for (Iterator it2 = residualChildren.iterator(); it2
                        .hasNext();) {
                    ResourceProxy residualChild = (ResourceProxy) it2
                            .next();
                    VltNodeDefinition nd = handleChildNodeDefinition(residualChild);
                    nds.add(nd);
                }
            }
View Full Code Here


    private void initDeclaredPropertyDefinitions(VltNodeType nt, ResourceProxy child) {
        Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
       
        // load propertyDefinition children
        for (Iterator<ResourceProxy> it = child.getChildren().iterator(); it.hasNext();) {
            ResourceProxy aChild = it.next();
            String childName = PathUtil.getName(aChild.getPath());
            if (childName.startsWith("jcr:propertyDefinition")) {
                String jcrName = (String)aChild.getProperties().get("jcr:name");
                if (jcrName!=null) {
                    VltPropertyDefinition pd = new VltPropertyDefinition();
                    pd.setName(jcrName);
                    Boolean autoCreated = (Boolean)aChild.getProperties().get("jcr:autoCreated");
                    if (autoCreated!=null) {
                        pd.setAutoCreated(autoCreated);
                    }
                    Boolean multiple = (Boolean)aChild.getProperties().get("jcr:multiple");
                    if (multiple!=null) {
                        pd.setMultiple(multiple);
                    }
                    Boolean mandatory = (Boolean)aChild.getProperties().get("jcr:mandatory");
                    if (mandatory!=null) {
                        pd.setMandatory(mandatory);
                    }
                    Boolean isProtected = (Boolean)aChild.getProperties().get("jcr:protected");
                    if (isProtected!=null) {
                        pd.setProtected(isProtected);
                    }
                    final Object object = aChild.getProperties().get("jcr:requiredType");
                    if (object!=null) {
                        String requiredType = (String)object;
                        if (requiredType!=null) {
                            pd.setRequiredType(propertyTypeFromName(requiredType));
                        }
View Full Code Here

    protected ResourceProxy execute0(Session session) throws RepositoryException {

        Node node = session.getNode(getPath());
        NodeIterator nodes = node.getNodes();

        ResourceProxy parent = nodeToResource(node);

        while (nodes.hasNext()) {
            Node childNode = nodes.nextNode();

            // TODO - this should not be needed if we obey the vlt filters
            if (childNode.getPath().equals("/jcr:system")) {
                continue;
            }

            parent.addChild(nodeToResource(childNode));
        }

        return parent;
    }
View Full Code Here

                contentNode.setProperty(PROP_NAME, (String[]) initialPropertyValues);
            }

            session.save();

            ResourceProxy resource = newResource("/content", NodeType.NT_UNSTRUCTURED);
            if (newPropertyValues != null) {
                resource.addProperty(PROP_NAME, newPropertyValues);
            }

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();
View Full Code Here

        try {
            session.getRootNode().addNode("content", "nt:folder");

            session.save();

            ResourceProxy resource = newResource("/content", "sling:Folder");
            resource.getProperties().put("newProperty", "some/value");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();

            session.refresh(false);
View Full Code Here

            Node content = session.getRootNode().addNode("content", "sling:Folder");
            content.setProperty("newProperty", "some/value");

            session.save();

            ResourceProxy resource = newResource("/content", "nt:folder");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();

            session.refresh(false);
View Full Code Here

        try {
            Node content = session.getRootNode().addNode("content", "nt:unstructured");

            session.save();

            ResourceProxy resource = newResource("/content", "custom");
            resource.getProperties().put("attribute", "some value");

            AddOrUpdateNodeCommand cmd = new AddOrUpdateNodeCommand(repo, credentials, null, resource, logger);
            cmd.execute().get();

            session.refresh(false);
View Full Code Here

        }
    }

    private ResourceProxy newResource(String path, String primaryType) {

        ResourceProxy resource = new ResourceProxy(path);
        resource.addProperty("jcr:primaryType", primaryType);
        return resource;
    }
View Full Code Here

    private static final String JCR_ROOT = "jcr:root";
    private final ResourceProxy root;
    private final Deque<ResourceProxy> queue = new LinkedList<ResourceProxy>();

    public ContentXmlHandler(String rootResourcePath) {
        root = new ResourceProxy(rootResourcePath);
    }
View Full Code Here

    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {

        ResourceProxy current;
        if (qName.equals(JCR_ROOT)) {
            current = root;
        } else {
            ResourceProxy parent = queue.peekLast();

            StringBuilder path = new StringBuilder(parent.getPath());
            if (path.charAt(path.length() - 1) != '/')
                path.append('/');
            path.append(qName);


            current = new ResourceProxy(ISO9075.decode(path.toString()));
            parent.addChild(current);
        }

        for (int i = 0; i < attributes.getLength(); i++) {

            String attributeQName = attributes.getQName(i);
View Full Code Here

TOP

Related Classes of org.apache.sling.ide.transport.ResourceProxy

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.