You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2014/05/16 12:30:55 UTC

svn commit: r1595150 - in /sling/trunk/tooling/ide: api-test/src/test/java/org/apache/sling/ide/serialization/ api/META-INF/ api/src/org/apache/sling/ide/serialization/ api/src/org/apache/sling/ide/transport/ impl-resource/src/org/apache/sling/ide/impl...

Author: stefanegli
Date: Fri May 16 10:30:54 2014
New Revision: 1595150

URL: http://svn.apache.org/r1595150
Log:
SLING-3571 : Adding NodeTypeRegistry to the project

Added:
    sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java   (with props)
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java   (with props)
Modified:
    sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
    sling/trunk/tooling/ide/api/META-INF/MANIFEST.MF
    sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java
    sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java
    sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java

Modified: sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java (original)
+++ sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java Fri May 16 10:30:54 2014
@@ -18,6 +18,7 @@ package org.apache.sling.ide.serializati
 
 import org.apache.sling.ide.transport.Command;
 import org.apache.sling.ide.transport.FileInfo;
+import org.apache.sling.ide.transport.NodeTypeRegistry;
 import org.apache.sling.ide.transport.Repository;
 import org.apache.sling.ide.transport.RepositoryException;
 import org.apache.sling.ide.transport.RepositoryInfo;
@@ -125,4 +126,9 @@ public class StubRepository implements R
     public RepositoryInfo getRepositoryInfo() {
         return null;
     }
+    
+    @Override
+    public NodeTypeRegistry getNodeTypeRegistry() {
+        return null;
+    }
 }
\ No newline at end of file

Modified: sling/trunk/tooling/ide/api/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/META-INF/MANIFEST.MF?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/api/META-INF/MANIFEST.MF Fri May 16 10:30:54 2014
@@ -10,7 +10,8 @@ Export-Package: org.apache.sling.ide.fil
  org.apache.sling.ide.serialization,
  org.apache.sling.ide.transport,
  org.apache.sling.ide.util
-Import-Package: org.apache.commons.httpclient;version="3.1.0",
+Import-Package: javax.jcr.nodetype,
+ org.apache.commons.httpclient;version="3.1.0",
  org.apache.commons.httpclient.auth;version="3.1.0",
  org.apache.commons.httpclient.methods;version="3.1.0",
  org.apache.commons.httpclient.methods.multipart;version="3.1.0",

Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/serialization/SerializationKindManager.java Fri May 16 10:30:54 2014
@@ -18,10 +18,14 @@ package org.apache.sling.ide.serializati
 
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.sling.ide.transport.NodeTypeRegistry;
 import org.apache.sling.ide.transport.Repository;
 import org.apache.sling.ide.transport.RepositoryException;
 import org.apache.sling.ide.transport.ResourceProxy;
@@ -42,19 +46,13 @@ public class SerializationKindManager {
     public void init(Repository repository) throws RepositoryException {
 
         // first pass, init the mappings
-        Map<String, String[]> nodeTypesToParentNodeTypes = new HashMap<String, String[]>();
-
-        Result<ResourceProxy> jcrSystem = repository.newListChildrenNodeCommand("/jcr:system/jcr:nodeTypes").execute();
-        for (ResourceProxy child : jcrSystem.get().getChildren()) {
-            String nodeType = PathUtil.getName(child.getPath());
-            String[] superTypes = (String[]) child.getProperties().get("jcr:supertypes");
-
-            nodeTypesToParentNodeTypes.put(nodeType, superTypes);
-        }
+        List<NodeType> nodeTypes = repository.getNodeTypeRegistry().getNodeTypes();
 
         // detect node types which have an nt:file or nt:folder parent in the hierarchy
-        for (String nodeType : nodeTypesToParentNodeTypes.keySet()) {
-            SerializationKind serializationKind = getSerializationKind(nodeType, nodeTypesToParentNodeTypes);
+        for (Iterator it = nodeTypes.iterator(); it.hasNext();) {
+            final NodeType nt = (NodeType) it.next();
+            final String nodeType = nt.getName();
+            SerializationKind serializationKind = getSerializationKind(nodeType, repository.getNodeTypeRegistry());
             if (serializationKind == null) {
                 // don't care
                 continue;
@@ -76,7 +74,7 @@ public class SerializationKindManager {
         }
     }
 
-    private SerializationKind getSerializationKind(String nodeType, Map<String, String[]> nodeTypesToParentNodeTypes) {
+    private SerializationKind getSerializationKind(String nodeType, NodeTypeRegistry nodeTypeRegistry) {
 
         if (Repository.NT_FILE.equals(nodeType)) {
             return SerializationKind.FILE;
@@ -96,12 +94,12 @@ public class SerializationKindManager {
                 || "sling:OsgiConfig".equals(nodeType)) {
             return SerializationKind.METADATA_FULL;
         }
-        String[] parents = nodeTypesToParentNodeTypes.get(nodeType);
+        String[] parents = nodeTypeRegistry.getNodeType(nodeType).getDeclaredSupertypeNames();
         if (parents == null)
             return null;
 
         for (String parent : parents) {
-            SerializationKind parentSerializationKind = getSerializationKind(parent, nodeTypesToParentNodeTypes);
+            SerializationKind parentSerializationKind = getSerializationKind(parent, nodeTypeRegistry);
             if (parentSerializationKind != null) {
                 return parentSerializationKind;
             }

Added: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java (added)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java Fri May 16 10:30:54 2014
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.transport;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.jcr.nodetype.NodeType;
+
+/**
+ * Keeps the list of all node type definitions, provides them
+ * individually as well as with some utility methods such as
+ * calculating all allowed child node types of a particular 
+ * node type.
+ */
+public interface NodeTypeRegistry {
+    
+    public List<NodeType> getNodeTypes();
+    
+    public NodeType getNodeType(String name);
+
+    public boolean isAllowedPrimaryChildNodeType(String parentNodeType, String childNodeType) throws RepositoryException;
+
+    public Collection<String> getAllowedPrimaryChildNodeTypes(String parentNodeType) throws RepositoryException;
+
+}

Propchange: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/NodeTypeRegistry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java Fri May 16 10:30:54 2014
@@ -98,4 +98,6 @@ public interface Repository {
     Command<ResourceProxy> newGetNodeContentCommand(String path);
 
 	Command<byte[]> newGetNodeCommand(String path);
+	
+	NodeTypeRegistry getNodeTypeRegistry();
 }

Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java (original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java Fri May 16 10:30:54 2014
@@ -19,6 +19,7 @@ package org.apache.sling.ide.impl.resour
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.sling.ide.transport.Command;
 import org.apache.sling.ide.transport.FileInfo;
+import org.apache.sling.ide.transport.NodeTypeRegistry;
 import org.apache.sling.ide.transport.Repository;
 import org.apache.sling.ide.transport.RepositoryInfo;
 import org.apache.sling.ide.transport.ResourceProxy;
@@ -72,4 +73,9 @@ public class RepositoryImpl implements R
     public RepositoryInfo getRepositoryInfo() {
         return repositoryInfo;
     }
+    
+    @Override
+    public NodeTypeRegistry getNodeTypeRegistry() {
+        throw new IllegalStateException("not yet implemented");
+    }
 }

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java Fri May 16 10:30:54 2014
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.sling.ide.transport.CommandExecutionProperties;
+import org.apache.sling.ide.transport.ResourceProxy;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+
+public class ListTreeCommand extends JcrCommand<ResourceProxy> {
+
+    private final int levels;
+    private final EventAdmin eventAdmin;
+
+    public ListTreeCommand(Repository repository, Credentials credentials, String path, int levels, EventAdmin eventAdmin) {
+        super(repository, credentials, path);
+        this.levels = Math.max(1,levels);
+        this.eventAdmin = eventAdmin;
+    }
+
+    @Override
+    protected ResourceProxy execute0(Session session) throws RepositoryException {
+
+        Node node = session.getNode(getPath());
+
+        ResourceProxy parent = nodeToResource(node);
+
+        addChildren(parent, node, levels-1);
+        
+        return parent;
+    }
+    
+    private void addChildren(ResourceProxy parent, Node node, int remainingLevels) throws RepositoryException {
+        if (remainingLevels<0) {
+            // paranoia check
+            throw new IllegalArgumentException("remainingLevels must be >=0, not: "+remainingLevels);
+        }
+        final long start = System.currentTimeMillis();
+        NodeIterator nodes = node.getNodes();
+        final long end = System.currentTimeMillis();
+        log("ListTreeCommand.child -> "+node.getPath(), start, end);
+        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;
+            }
+
+            final ResourceProxy childResourceProxy = nodeToResource(childNode);
+            parent.addChild(childResourceProxy);
+            
+            if (remainingLevels>0) {
+                addChildren(childResourceProxy, childNode, remainingLevels-1);
+            }
+        }
+    }
+
+    private void log(String text, long start, long end) {
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put(CommandExecutionProperties.RESULT_TEXT, text);
+        props.put(CommandExecutionProperties.ACTION_TYPE, getClass().getSimpleName());
+        props.put(CommandExecutionProperties.ACTION_TARGET, getPath());
+        props.put(CommandExecutionProperties.TIMESTAMP_START, start);
+        props.put(CommandExecutionProperties.TIMESTAMP_END, end);
+        Event event = new Event(CommandExecutionProperties.REPOSITORY_TOPIC, props);
+        eventAdmin.postEvent(event);
+    }
+
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/ListTreeCommand.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java Fri May 16 10:30:54 2014
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+
+public class VltNodeDefinition implements NodeDefinition {
+
+    private NodeType declaringNodeType;
+    private String name;
+    private int onParentVersion;
+    private boolean autoCreated;
+    private boolean mandatory;
+    private boolean isProtected;
+    private boolean allowsSameNameSiblings;
+    private NodeType defaultPrimaryType;
+    private String defaultPrimaryTypeName;
+    private String[] requiredPrimaryTypeNames;
+    private NodeType[] requiredPrimaryTypes;
+
+    @Override
+    public NodeType getDeclaringNodeType() {
+        return declaringNodeType;
+    }
+
+    void setDeclaringNodeType(NodeType declaringNodeType) {
+        this.declaringNodeType = declaringNodeType;
+    }
+    
+    @Override
+    public String getName() {
+        return name;
+    }
+    
+    void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public int getOnParentVersion() {
+        return onParentVersion;
+    }
+    
+    void setOnParentVersion(int onParentVersion) {
+        this.onParentVersion = onParentVersion;
+    }
+
+    @Override
+    public boolean isAutoCreated() {
+        return autoCreated;
+    }
+    
+    void setAutoCreated(boolean autoCreated) {
+        this.autoCreated = autoCreated;
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return mandatory;
+    }
+    
+    void setMandatory(boolean mandatory) {
+        this.mandatory = mandatory;
+    }
+
+    @Override
+    public boolean isProtected() {
+        return isProtected;
+    }
+    
+    void setProtected(boolean isProtected) {
+        this.isProtected = isProtected;
+    }
+
+    @Override
+    public boolean allowsSameNameSiblings() {
+        return allowsSameNameSiblings;
+    }
+    
+    void setAllowsSameNameSiblings(boolean allowsSameNameSiblings) {
+        this.allowsSameNameSiblings = allowsSameNameSiblings;
+    }
+
+    @Override
+    public NodeType getDefaultPrimaryType() {
+        return defaultPrimaryType;
+    }
+    
+    void setDefaultPrimaryType(NodeType defaultPrimaryType) {
+        this.defaultPrimaryType = defaultPrimaryType;
+    }
+
+    @Override
+    public String getDefaultPrimaryTypeName() {
+        return defaultPrimaryTypeName;
+    }
+    
+    void setDefaultPrimaryTypeName(String defaultPrimaryTypeName) {
+        this.defaultPrimaryTypeName = defaultPrimaryTypeName;
+    }
+
+    @Override
+    public String[] getRequiredPrimaryTypeNames() {
+        return requiredPrimaryTypeNames;
+    }
+    
+    void setRequiredPrimaryTypeNames(String[] requiredPrimaryTypeNames) {
+        this.requiredPrimaryTypeNames = requiredPrimaryTypeNames;
+    }
+
+    @Override
+    public NodeType[] getRequiredPrimaryTypes() {
+        return requiredPrimaryTypes;
+    }
+    
+    void setRequiredPrimaryTypes(NodeType[] requiredPrimaryTypes) {
+        this.requiredPrimaryTypes = requiredPrimaryTypes;
+    }
+
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeDefinition.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java Fri May 16 10:30:54 2014
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.sling.ide.transport.ResourceProxy;
+
+public class VltNodeType implements NodeType {
+
+    private NodeDefinition[] declaredChildNodeDefinitions;
+    private PropertyDefinition[] declaredPropertyDefinitions;
+    private String[] declaredSupertypeNames;
+    private String name;
+    private String primaryItemName;
+    private boolean hasOrderableChildNodes;
+    private boolean isAbstract;
+    private boolean isMixin;
+    private boolean isQueryable;
+    private NodeDefinition[] childNodeDefinitions;
+    private NodeType[] declaredSupertypes;
+    private PropertyDefinition[] propertyDefinitions;
+    private NodeType[] superTypes;
+    
+    private Set<VltNodeType> directChildTypes = new HashSet<VltNodeType>();
+    private Set<String> allowedChildNodeTypes;
+    private ResourceProxy resourceProxy;
+
+    VltNodeType(ResourceProxy resourceProxy) {
+        this.resourceProxy = resourceProxy;
+    }
+    
+    ResourceProxy getResourceProxy() {
+        return resourceProxy;
+    }
+    
+    void addSuperType(VltNodeType aSuperType) {
+        aSuperType.directChildTypes.add(this);
+    }
+    
+    Set<VltNodeType> getDirectChildTypes() {
+        return directChildTypes;
+    }
+
+    Set<VltNodeType> getAllKnownChildTypes() {
+        Set<VltNodeType> allKnownCTs = new HashSet<VltNodeType>();
+        allKnownCTs.add(this);
+        for (Iterator<VltNodeType> it = directChildTypes.iterator(); it.hasNext();) {
+            VltNodeType simpleVltNodeType = it.next();
+            allKnownCTs.addAll(simpleVltNodeType.getAllKnownChildTypes());
+        }
+        return allKnownCTs;
+    }
+
+    void setAllowedPrimaryChildNodeTypes(Set<String> allowedChildNodeTypes) {
+        this.allowedChildNodeTypes = allowedChildNodeTypes;
+    }
+    
+    Set<String> getAllowedPrimaryChildNodeTypes() {
+        return Collections.unmodifiableSet(allowedChildNodeTypes);
+    }
+    
+    @Override
+    public String toString() {
+        return "[" + name + "]";
+    }
+    
+    @Override
+    public NodeDefinition[] getDeclaredChildNodeDefinitions() {
+        return declaredChildNodeDefinitions;
+    }
+    
+    void setDeclaredChildNodeDefinitions(NodeDefinition[] nodeDefinitions) {
+        this.declaredChildNodeDefinitions = nodeDefinitions;
+    }
+
+    @Override
+    public PropertyDefinition[] getDeclaredPropertyDefinitions() {
+        return declaredPropertyDefinitions;
+    }
+    
+    void setDeclaredPropertyDefinitions(PropertyDefinition[] pds) {
+        this.propertyDefinitions = pds;
+    }
+
+    @Override
+    public String[] getDeclaredSupertypeNames() {
+        return declaredSupertypeNames;
+    }
+    
+    void setDeclaredSupertypeNames(String[] supertypeNames) {
+        this.declaredSupertypeNames = supertypeNames;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+    
+    void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getPrimaryItemName() {
+        return primaryItemName;
+    }
+    
+    void setPrimaryItemName(String primaryItemName) {
+        this.primaryItemName = primaryItemName;
+    }
+
+    @Override
+    public boolean hasOrderableChildNodes() {
+        return hasOrderableChildNodes;
+    }
+    
+    void setHasOrderableChildNodes(boolean hasOrderableChildNodes) {
+        this.hasOrderableChildNodes = hasOrderableChildNodes;
+    }
+
+    @Override
+    public boolean isAbstract() {
+        return isAbstract;
+    }
+    
+    void setAbstract(boolean isAbstract) {
+        this.isAbstract = isAbstract;
+    }
+
+    @Override
+    public boolean isMixin() {
+        return isMixin;
+    }
+    
+    void setMixin(boolean isMixin) {
+        this.isMixin = isMixin;
+    }
+
+    @Override
+    public boolean isQueryable() {
+        return isQueryable;
+    }
+    
+    void setQueryable(boolean isQueryable) {
+        this.isQueryable = isQueryable;
+    }
+
+    @Override
+    public boolean canAddChildNode(String arg0) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canAddChildNode(String arg0, String arg1) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canRemoveItem(String arg0) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canRemoveNode(String arg0) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canRemoveProperty(String arg0) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canSetProperty(String arg0, Value arg1) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public boolean canSetProperty(String arg0, Value[] arg1) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public NodeDefinition[] getChildNodeDefinitions() {
+        return childNodeDefinitions;
+    }
+    
+    void setChildNodeDefinitions(NodeDefinition[] childNodeDefinitions) {
+        this.childNodeDefinitions = childNodeDefinitions;
+    }
+
+    @Override
+    public NodeTypeIterator getDeclaredSubtypes() {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public NodeType[] getDeclaredSupertypes() {
+        return declaredSupertypes;
+    }
+    
+    void setDeclaredSupertypes(NodeType[] declaredSupertypes) {
+        this.declaredSupertypes = declaredSupertypes;
+    }
+
+    @Override
+    public PropertyDefinition[] getPropertyDefinitions() {
+        return propertyDefinitions;
+    }
+    
+    PropertyDefinition getPropertyDefinition(String name) {
+        for (int i = 0; i < propertyDefinitions.length; i++) {
+            PropertyDefinition pd = propertyDefinitions[i];
+            if (pd.getName().equals(name)) {
+                return pd;
+            }
+        }
+        return null;
+    }
+    
+    void setPropertyDefinitions(PropertyDefinition[] pds) {
+        propertyDefinitions = pds;
+    }
+
+    @Override
+    public NodeTypeIterator getSubtypes() {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+    @Override
+    public NodeType[] getSupertypes() {
+        return superTypes;
+    }
+    
+    void setSupertypes(NodeType[] superTypes) {
+        this.superTypes = superTypes;
+    }
+
+    @Override
+    public boolean isNodeType(String arg0) {
+        throw new IllegalStateException("not yet implemented");
+    }
+
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeType.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java Fri May 16 10:30:54 2014
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.PropertyType;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import org.apache.sling.ide.transport.RepositoryException;
+import org.apache.sling.ide.transport.ResourceProxy;
+import org.apache.sling.ide.transport.Result;
+import org.apache.sling.ide.util.PathUtil;
+
+public class VltNodeTypeFactory {
+
+    private Map<String,VltNodeType> nodeTypes = new HashMap<String, VltNodeType>();
+    
+    Map<String, VltNodeType> getNodeTypes() {
+        return nodeTypes;
+    }
+
+    public VltNodeType getNodeType(String name) {
+        return nodeTypes.get(name);
+    }
+
+    void init(VltRepository repository) throws RepositoryException {
+        Result<ResourceProxy> jcrSystem = repository.newListTreeNodeCommand("/jcr:system/jcr:nodeTypes", 2).execute();
+        // phase 1: create all node types
+        for (ResourceProxy child : jcrSystem.get().getChildren()) {
+            
+            VltNodeType nt = createNodeType(child);
+            nodeTypes.put(nt.getName(), nt);
+        }
+        // phase 2: init declared fields
+        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
+            VltNodeType nt = it.next();
+            initDeclaredFields(nt);
+        }
+        
+        // at this stage all declared fields are initialized, we can now calculate
+        // the rest
+        
+        // phase 2: initialize the dependency tree (eg superTypes)
+        // - this is a separate phase to make sure, all VltNodeType objects have been created (above)
+        //   hence initTypeDependencyTree can assume all nodetypes exist
+        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
+            VltNodeType nt = it.next();
+            initTypeDependencyTree(nt);
+        }
+
+        // phase 3: init property definitions
+        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
+            VltNodeType nt = it.next();
+            final ResourceProxy child = nt.getResourceProxy();
+            initPropertyDefinitions(nt);
+            initProperties(nt, child);
+        }
+        
+        // phase 4: initialize the allowed primary childnodetypes
+        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
+            VltNodeType nt = it.next();
+            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("rep:residualChildNodeDefinitions")
+                    || ntChildName.startsWith("jcr:childNodeDefinition")) {
+                VltNodeDefinition nd = handleChildNodeDefinition(ntChild);
+                nds.add(nd);
+            }
+        }
+        nt.setDeclaredChildNodeDefinitions(nds.toArray(new NodeDefinition[0]));
+        initDeclaredPropertyDefinitions(nt, child);
+    }
+
+    private VltNodeType createNodeType(ResourceProxy child) {
+        final VltNodeType nt = new VltNodeType(child);
+        final String name = PathUtil.getName(child.getPath());
+        nt.setName(name);
+        return nt;
+    }
+    
+    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));
+                        }
+                    }
+                    pds.put(jcrName, pd);
+                }
+            }
+        }
+        
+        // load mandatory
+        String[] mandatoryProperties = (String[]) child.getProperties().get("rep:mandatoryProperties");
+        for (int i = 0; i < mandatoryProperties.length; i++) {
+            String aMandatoryProperty = mandatoryProperties[i];
+            VltPropertyDefinition vpd = pds.get(aMandatoryProperty);
+            if (vpd==null) {
+                vpd = new VltPropertyDefinition();
+                vpd.setName(aMandatoryProperty);
+                pds.put(aMandatoryProperty, vpd);
+            }
+            vpd.setMandatory(true);
+        }
+        
+        // load protected
+        String[] protectedProperties = (String[]) child.getProperties().get("rep:protectedProperties");
+        for (int i = 0; i < protectedProperties.length; i++) {
+            String aProtectedProperties = protectedProperties[i];
+            VltPropertyDefinition vpd = pds.get(aProtectedProperties);
+            if (vpd==null) {
+                vpd = new VltPropertyDefinition();
+                vpd.setName(aProtectedProperties);
+                pds.put(aProtectedProperties, vpd);
+            }
+            vpd.setProtected(true);
+        }
+        
+        nt.setDeclaredPropertyDefinitions(pds.values().toArray(new VltPropertyDefinition[pds.size()]));
+    }
+    
+    private int propertyTypeFromName(String name) {
+        if (name.equalsIgnoreCase(PropertyType.TYPENAME_STRING)) {
+            return PropertyType.STRING;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_BINARY)) {
+            return PropertyType.BINARY;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_BOOLEAN)) {
+            return PropertyType.BOOLEAN;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_LONG)) {
+            return PropertyType.LONG;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_DOUBLE)) {
+            return PropertyType.DOUBLE;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_DECIMAL)) {
+            return PropertyType.DECIMAL;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_DATE)) {
+            return PropertyType.DATE;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_NAME)) {
+            return PropertyType.NAME;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_PATH)) {
+            return PropertyType.PATH;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_REFERENCE)) {
+            return PropertyType.REFERENCE;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_WEAKREFERENCE)) {
+            return PropertyType.WEAKREFERENCE;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_URI)) {
+            return PropertyType.URI;
+        } else if (name.equalsIgnoreCase(PropertyType.TYPENAME_UNDEFINED)) {
+            return PropertyType.UNDEFINED;
+        } else {
+            throw new IllegalArgumentException("unknown type: " + name);
+        }
+    }
+
+    private void initPropertyDefinitions(VltNodeType nt) {
+        Map<String,VltPropertyDefinition> pds = new HashMap<String,VltPropertyDefinition>();
+        
+        PropertyDefinition[] declaredPds = nt.getDeclaredPropertyDefinitions();
+        if (declaredPds!=null) {
+            for (int i = 0; i < declaredPds.length; i++) {
+                PropertyDefinition pd = declaredPds[i];
+                pds.put(pd.getName(), (VltPropertyDefinition) pd);
+            }
+        }
+        
+        NodeType[] superTypes = nt.getSupertypes();
+        if (superTypes!=null) {
+            for (int i = 0; i < superTypes.length; i++) {
+                VltNodeType aSuperType = (VltNodeType) superTypes[i];
+                
+                VltPropertyDefinition[] superTypePds = (VltPropertyDefinition[])aSuperType.getPropertyDefinitions();
+                for (int j = 0; j < superTypePds.length; j++) {
+                    VltPropertyDefinition pd = superTypePds[j];
+                    VltPropertyDefinition existingPd = pds.get(pd.getName());
+                    if (existingPd!=null) {
+                        // merge the two
+                        existingPd.mergeFrom(pd);
+                    } else {
+                        pds.put(pd.getName(), pd);
+                    }
+                }
+            }
+        }
+        nt.setPropertyDefinitions(pds.values().toArray(new VltPropertyDefinition[pds.size()]));
+    }
+
+    private void initProperties(VltNodeType nt, ResourceProxy child) {
+        Boolean isMixin = (Boolean) child.getProperties().get("jcr:isMixin");
+        if (isMixin==null) {
+            nt.setMixin(false);
+        } else {
+            nt.setMixin(isMixin);
+        }
+    }
+    
+    private VltNodeDefinition handleChildNodeDefinition(ResourceProxy child) {
+        
+        VltNodeDefinition nd = new VltNodeDefinition();
+        nd.setName((String) child.getProperties().get("jcr:name"));
+        String[] requiredPrimaryTypes = (String[]) child.getProperties().get(
+                "jcr:requiredPrimaryTypes");
+        nd.setRequiredPrimaryTypeNames(requiredPrimaryTypes);
+        if (requiredPrimaryTypes != null && requiredPrimaryTypes.length!=0) {
+            NodeType[] nts = new NodeType[requiredPrimaryTypes.length];
+            for (int i = 0; i < requiredPrimaryTypes.length; i++) {
+                String pt = requiredPrimaryTypes[i];
+                VltNodeType nt = getNodeType(pt);
+                nts[i] = nt;
+            }
+            nd.setRequiredPrimaryTypes(nts);
+        }
+        
+//        String[] defaultPrimaryTypes = (String[])
+//        child.getProperties().get("jcr:defaultPrimaryTypes");
+        
+        return nd;
+    }
+
+    private void initTypeDependencyTree(VltNodeType nt) {
+        final String[] superTypeNames = nt.getDeclaredSupertypeNames();
+        if (superTypeNames == null) {
+            return;
+        }
+        // collect all the supertype names
+        Set<NodeType> allSuperTypes = new HashSet<NodeType>();
+        initSuperTypes(allSuperTypes, nt);
+        nt.setSupertypes(allSuperTypes.toArray(new NodeType[0]));
+    }
+
+    private void initSuperTypes(Set<NodeType> allSuperTypes, VltNodeType nt) {
+        final NodeType[] declaredSupertypes = nt.getDeclaredSupertypes();
+        if (declaredSupertypes==null) {
+            return;
+        }
+        for (int i = 0; i < declaredSupertypes.length; i++) {
+            VltNodeType superType = (VltNodeType) declaredSupertypes[i];
+            allSuperTypes.add(superType);
+            nt.addSuperType(superType);
+            initSuperTypes(allSuperTypes, (VltNodeType) superType);
+        }
+    }
+
+    private void initAllowedPrimaryChildNodeTypes(VltNodeType nt0) throws RepositoryException {
+        NodeDefinition[] declaredCihldNodeDefinitions = nt0.getDeclaredChildNodeDefinitions();
+        Set<String> allowedChildNodeTypes = new HashSet<String>();
+        if (declaredCihldNodeDefinitions!=null) {
+            for (int i = 0; i < declaredCihldNodeDefinitions.length; i++) {
+                NodeDefinition nodeDefinition = declaredCihldNodeDefinitions[i];
+                NodeType[] requiredPrimaryTypes = nodeDefinition.getRequiredPrimaryTypes();
+                if (requiredPrimaryTypes!=null) {
+                    for (int j = 0; j < requiredPrimaryTypes.length; j++) {
+                        VltNodeType aRequiredPrimaryType = (VltNodeType) requiredPrimaryTypes[j];
+                        if (aRequiredPrimaryType==null) {
+                            System.out.println("this can not be");
+                        }
+                        Set<VltNodeType> allKnownChildTypes = aRequiredPrimaryType.getAllKnownChildTypes();
+                        for (Iterator<VltNodeType> it = allKnownChildTypes.iterator(); it.hasNext();) {
+                            VltNodeType aChildType = it.next();
+                            VltNodeType nt2 = getNodeType(aChildType.getName());
+                            if (!nt2.isMixin()) {
+                                // mixins cannot be primary node types!
+                                allowedChildNodeTypes.add(nt2.getName());
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        nt0.setAllowedPrimaryChildNodeTypes(allowedChildNodeTypes);
+    }
+
+
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java Fri May 16 10:30:54 2014
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jcr.nodetype.NodeType;
+
+import org.apache.sling.ide.transport.NodeTypeRegistry;
+import org.apache.sling.ide.transport.RepositoryException;
+
+public class VltNodeTypeRegistry implements NodeTypeRegistry {
+    
+    private Map<String,VltNodeType> nodeTypes = new HashMap<String, VltNodeType>();
+
+    public VltNodeTypeRegistry(VltRepository repo) throws RepositoryException {
+        VltNodeTypeFactory factory = new VltNodeTypeFactory();
+        factory.init(repo);
+        nodeTypes = factory.getNodeTypes();
+    }
+    
+    @Override
+    public boolean isAllowedPrimaryChildNodeType(String parentNodeType, String childNodeType) throws RepositoryException {
+        Set<String> allowedChildren = getNodeType(parentNodeType).getAllowedPrimaryChildNodeTypes();
+        return (allowedChildren.contains(childNodeType));
+    }
+
+    @Override
+    public Collection<String> getAllowedPrimaryChildNodeTypes(String parentNodeType) throws RepositoryException {
+        Set<String> allowedChildren = getNodeType(parentNodeType).getAllowedPrimaryChildNodeTypes();
+        return Collections.unmodifiableCollection(allowedChildren);
+    }
+    
+    @Override
+    public List<NodeType> getNodeTypes() {
+        List<NodeType> result = new LinkedList<NodeType>();
+        for (Iterator<VltNodeType> it = nodeTypes.values().iterator(); it.hasNext();) {
+            VltNodeType nt = it.next();
+            result.add(nt);
+        }
+        return result;
+    }
+
+    @Override
+    public VltNodeType getNodeType(String name) {
+        return nodeTypes.get(name);
+    }
+    
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltNodeTypeRegistry.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java?rev=1595150&view=auto
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java (added)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java Fri May 16 10:30:54 2014
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.ide.impl.vlt;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.PropertyDefinition;
+
+public class VltPropertyDefinition implements PropertyDefinition {
+
+    private NodeType declaringNodeType = null;
+    private String name;
+    private int onParentVersion;
+    private boolean autoCreated;
+    private boolean isMandatory;
+    private boolean isProtected;
+    private String[] availableQueryOperators;
+    private Value[] defaultValues;
+    private int requiredType;
+    private String[] valueConstraints;
+    private boolean fullTextSearchable;
+    private boolean multiple;
+    private boolean queryOrderable;
+    
+    //TODO: Current merge mechanism (or propertydefinition-inheritance) is not
+    // accurate - it should probably do that taking the input directly and
+    // apply the inheritance rules, rather than taking derived values and overwrite here..
+    void mergeFrom(VltPropertyDefinition pd) {
+        if (pd.declaringNodeType!=null) {
+            declaringNodeType = pd.declaringNodeType;
+        }
+        if (pd.onParentVersion!=0) {
+            onParentVersion = pd.onParentVersion;
+        }
+        if (pd.autoCreated) {
+            autoCreated = pd.autoCreated;
+        }
+        if (pd.isMandatory) {
+            isMandatory = pd.isMandatory;
+        }
+        if (pd.isProtected) {
+            isProtected = pd.isProtected;
+        }
+        if (pd.availableQueryOperators!=null) {
+            availableQueryOperators = pd.availableQueryOperators;
+        }
+        if (pd.defaultValues!=null) {
+            defaultValues = pd.defaultValues;
+        }
+        if (pd.requiredType!=0) {
+            requiredType = pd.requiredType;
+        }
+        if (pd.valueConstraints!=null) {
+            valueConstraints = pd.valueConstraints;
+        }
+        if (pd.fullTextSearchable) {
+            fullTextSearchable = pd.fullTextSearchable;
+        }
+        if (pd.multiple) {
+            multiple = pd.multiple;
+        }
+        if (pd.queryOrderable) {
+            queryOrderable = pd.queryOrderable;
+        }
+    }
+
+    @Override
+    public NodeType getDeclaringNodeType() {
+        return declaringNodeType;
+    }
+    
+    void setDeclaringNodeType(NodeType nt) {
+        this.declaringNodeType = nt;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+    
+    void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public int getOnParentVersion() {
+        return onParentVersion;
+    }
+    
+    void setOnParentVersion(int onParentVersion) {
+        this.onParentVersion = onParentVersion;
+    }
+
+    @Override
+    public boolean isAutoCreated() {
+        return autoCreated;
+    }
+    
+    void setAutoCreated(boolean autoCreated) {
+        this.autoCreated = autoCreated;
+    }
+
+    @Override
+    public boolean isMandatory() {
+        return isMandatory;
+    }
+    
+    void setMandatory(boolean mandatory) {
+        this.isMandatory = mandatory;
+    }
+
+    @Override
+    public boolean isProtected() {
+        return isProtected;
+    }
+    
+    void setProtected(boolean isProtected) {
+        this.isProtected = isProtected;
+    }
+
+    @Override
+    public String[] getAvailableQueryOperators() {
+        return availableQueryOperators;
+    }
+    
+    void setAvailableQueryOperators(String[] availableQueryOperators) {
+        this.availableQueryOperators = availableQueryOperators;
+    }
+
+    @Override
+    public Value[] getDefaultValues() {
+        return defaultValues;
+    }
+    
+    void setDefaultValues(Value[] values) {
+        this.defaultValues = values;
+    }
+
+    @Override
+    public int getRequiredType() {
+        return requiredType;
+    }
+    
+    void setRequiredType(int requiredType) {
+        this.requiredType = requiredType;
+    }
+
+    @Override
+    public String[] getValueConstraints() {
+        return valueConstraints;
+    }
+    
+    void setValueConstraints(String[] valueConstraints) {
+        this.valueConstraints = valueConstraints;
+    }
+
+    @Override
+    public boolean isFullTextSearchable() {
+        return fullTextSearchable;
+    }
+    
+    void setFullTextSearchable(boolean fullTextSearchable) {
+        this.fullTextSearchable = fullTextSearchable;
+    }
+
+    @Override
+    public boolean isMultiple() {
+        return multiple;
+    }
+    
+    void setMultiple(boolean multiple) {
+        this.multiple = multiple;
+    }
+
+    @Override
+    public boolean isQueryOrderable() {
+        return queryOrderable;
+    }
+    
+    void setQueryOrderable(boolean queryOrderable) {
+        this.queryOrderable = queryOrderable;
+    }
+
+}

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltPropertyDefinition.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java?rev=1595150&r1=1595149&r2=1595150&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java (original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java Fri May 16 10:30:54 2014
@@ -6,6 +6,7 @@ import javax.jcr.RepositoryException;
 import org.apache.sling.ide.jcr.RepositoryUtils;
 import org.apache.sling.ide.transport.Command;
 import org.apache.sling.ide.transport.FileInfo;
+import org.apache.sling.ide.transport.NodeTypeRegistry;
 import org.apache.sling.ide.transport.Repository;
 import org.apache.sling.ide.transport.RepositoryInfo;
 import org.apache.sling.ide.transport.ResourceProxy;
@@ -19,16 +20,26 @@ import org.osgi.service.event.EventAdmin
 public class VltRepository implements Repository {
 
     private final RepositoryInfo repositoryInfo;
-    private final EventAdmin eventAdmin;
+    private EventAdmin eventAdmin;
+    private NodeTypeRegistry ntRegistry;
 
     private javax.jcr.Repository jcrRepo;
     private Credentials credentials;
+    private boolean markedStopped = false;
 
     public VltRepository(RepositoryInfo repositoryInfo, EventAdmin eventAdmin) {
         this.repositoryInfo = repositoryInfo;
         this.eventAdmin = eventAdmin;
     }
 
+    public synchronized void markStopped() {
+        this.markedStopped = true;
+    }
+
+    public synchronized boolean isMarkedStopped() {
+        return markedStopped;
+    }
+
     public RepositoryInfo getRepositoryInfo() {
         return repositoryInfo;
     }
@@ -40,6 +51,8 @@ public class VltRepository implements Re
         } catch (RepositoryException e) {
             throw new RuntimeException(e);
         }
+        // loading nodeTypeRegistry:
+        getNodeTypeRegistry();
     }
 
     @Override
@@ -71,4 +84,35 @@ public class VltRepository implements Re
         return TracingCommand.wrap(new GetNodeCommand(jcrRepo, credentials, path), eventAdmin);
     }
 
+    protected void bindEventAdmin(EventAdmin eventAdmin) {
+
+        this.eventAdmin = eventAdmin;
+    }
+
+    protected void unbindEventAdmin(EventAdmin eventAdmin) {
+
+        this.eventAdmin = null;
+    }
+    
+    Command<ResourceProxy> newListTreeNodeCommand(String path, int levels) {
+
+        return TracingCommand.wrap(new ListTreeCommand(jcrRepo, credentials, path, levels, eventAdmin), eventAdmin);
+    }
+    
+    @Override
+    public synchronized NodeTypeRegistry getNodeTypeRegistry() {
+        if (repositoryInfo==null) {
+            throw new IllegalStateException("repositoryInfo must not be null");
+        }
+        if (ntRegistry!=null) {
+            return ntRegistry;
+        }
+        try {
+            ntRegistry = new VltNodeTypeRegistry(this);
+        } catch (org.apache.sling.ide.transport.RepositoryException e) {
+            throw new RuntimeException(e);
+        }
+        return ntRegistry;
+    }
+
 }