jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r111514 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . nodetype state version
Date Fri, 10 Dec 2004 15:40:36 GMT
Author: stefan
Date: Fri Dec 10 07:40:34 2004
New Revision: 111514

URL: http://svn.apache.org/viewcvs?view=rev&rev=111514
Log:
adding internal namespace prefix: rep
adding internal node type for root node: rep:root
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	Fri Dec 10
07:40:34 2004
@@ -801,15 +801,19 @@
     }
 
     private void removeTransientItems(Iterator iter) throws RepositoryException {
-        // walk through list of transient items marked 'removed'
-        // and definitively remove each one
+        /**
+         * walk through list of transient items marked 'removed' and
+         * definitively remove each one
+         */
         while (iter.hasNext()) {
             ItemState transientState = (ItemState) iter.next();
             PersistableItemState persistentState = (PersistableItemState) transientState.getOverlayedState();
-            // remove persistent state (incl. descendents, if there are any)
-
-            // this will indirectly (through stateDestroyed listener method)
-            // permanently invalidate all Item instances wrapping it
+            /**
+             * remove persistent state (incl. descendents, if there are any)
+             *
+             * this will indirectly (through stateDestroyed listener method)
+             * permanently invalidate all Item instances wrapping it
+             */
             try {
                 persistentState.destroy();
             } catch (ItemStateException ise) {
@@ -842,8 +846,7 @@
      */
     private boolean initVersionHistories(Iterator iter) throws RepositoryException {
         // todo consolidate version history creation code (currently in NodeImpl.addMixin
& ItemImpl.initVersionHistories
-        // walk through list of transient items and
-        // search for new versionable nodes
+        // walk through list of transient items and search for new versionable nodes
         boolean createdTransientState = false;
         while (iter.hasNext()) {
             ItemState itemState = (ItemState) iter.next();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
Fri Dec 10 07:40:34 2004
@@ -40,7 +40,11 @@
     public static final String NS_EMPTY_PREFIX = "";
     public static final String NS_DEFAULT_URI = "";
 
-    // reserved namespace for items defined within built-in node types
+    // reserved namespace for repository internal node types
+    public static final String NS_REP_PREFIX = "rep";
+    public static final String NS_REP_URI = "internal";
+
+    // reserved namespace for items defined by built-in node types
     public static final String NS_JCR_PREFIX = "jcr";
     public static final String NS_JCR_URI = "http://www.jcp.org/jcr/1.0";
 
@@ -52,10 +56,6 @@
     public static final String NS_MIX_PREFIX = "mix";
     public static final String NS_MIX_URI = "http://www.jcp.org/jcr/mix/1.0";
 
-    // reserved namespace for the names of property types
-    public static final String NS_PT_PREFIX = "pt";
-    public static final String NS_PT_URI = "http://www.jcp.org/jcr/pt/1.0";
-
     // reserved namespace used in the system view XML serialization format
     public static final String NS_SV_PREFIX = "sv";
     public static final String NS_SV_URI = "http://www.jcp.org/jcr/sv/1.0";
@@ -76,19 +76,19 @@
         reservedPrefixes.add(NS_XML_PREFIX);
         reservedPrefixes.add(NS_XMLNS_PREFIX);
         // predefined (e.g. built-in) prefixes
+        reservedPrefixes.add(NS_REP_PREFIX);
         reservedPrefixes.add(NS_JCR_PREFIX);
         reservedPrefixes.add(NS_NT_PREFIX);
         reservedPrefixes.add(NS_MIX_PREFIX);
-        reservedPrefixes.add(NS_PT_PREFIX);
         reservedPrefixes.add(NS_SV_PREFIX);
         // reserved namespace URI's
         reservedURIs.add(NS_XML_URI);
         reservedURIs.add(NS_XMLNS_URI);
         // predefined (e.g. built-in) namespace URI's
+        reservedURIs.add(NS_REP_URI);
         reservedURIs.add(NS_JCR_URI);
         reservedURIs.add(NS_NT_URI);
         reservedURIs.add(NS_MIX_URI);
-        reservedURIs.add(NS_PT_URI);
         reservedURIs.add(NS_SV_URI);
     }
 
@@ -120,6 +120,9 @@
                 prefixToURI.put(NS_EMPTY_PREFIX, NS_DEFAULT_URI);
                 uriToPrefix.put(NS_DEFAULT_URI, NS_EMPTY_PREFIX);
                 // declare the predefined mappings
+                // rep:
+                prefixToURI.put(NS_REP_PREFIX, NS_REP_URI);
+                uriToPrefix.put(NS_REP_URI, NS_REP_PREFIX);
                 // jcr:
                 prefixToURI.put(NS_JCR_PREFIX, NS_JCR_URI);
                 uriToPrefix.put(NS_JCR_URI, NS_JCR_PREFIX);
@@ -129,9 +132,6 @@
                 // mix:
                 prefixToURI.put(NS_MIX_PREFIX, NS_MIX_URI);
                 uriToPrefix.put(NS_MIX_URI, NS_MIX_PREFIX);
-                // pt:
-                prefixToURI.put(NS_PT_PREFIX, NS_PT_URI);
-                uriToPrefix.put(NS_PT_URI, NS_PT_PREFIX);
                 // sv:
                 prefixToURI.put(NS_SV_PREFIX, NS_SV_URI);
                 uriToPrefix.put(NS_SV_URI, NS_SV_PREFIX);
@@ -230,17 +230,20 @@
             throw new NamespaceException("default namespace is reserved and can not be changed");
         }
         if (reservedURIs.contains(uri)) {
-            throw new NamespaceException("failed to register namespace " + prefix + " ->
" + uri + ": reserved URI");
+            throw new NamespaceException("failed to register namespace "
+                    + prefix + " -> " + uri + ": reserved URI");
         }
         if (reservedPrefixes.contains(prefix)) {
-            throw new NamespaceException("failed to register namespace " + prefix + " ->
" + uri + ": reserved prefix");
+            throw new NamespaceException("failed to register namespace "
+                    + prefix + " -> " + uri + ": reserved prefix");
         }
 
         String oldPrefix = (String) uriToPrefix.get(uri);
         if (oldPrefix != null) {
             // existing namespace
             if (oldPrefix.equals(prefix)) {
-                throw new NamespaceException("failed to register namespace " + prefix + "
-> " + uri + ": mapping already exists");
+                throw new NamespaceException("failed to register namespace "
+                        + prefix + " -> " + uri + ": mapping already exists");
             }
             // remove old prefix
             prefixToURI.remove(oldPrefix);
@@ -252,7 +255,8 @@
             // remove the previously assigned namespace;
             // as we can't guarantee that there are no references to this namespace
             // (in names of nodes/properties/node types etc.) we simply don't allow it.
-            throw new NamespaceException("failed to register namespace " + prefix + " ->
" + uri + ": remapping existing prefixes is not supported.");
+            throw new NamespaceException("failed to register namespace "
+                    + prefix + " -> " + uri + ": remapping existing prefixes is not supported.");
         }
 
         prefixToURI.put(prefix, uri);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/RepositoryImpl.java	Fri
Dec 10 07:40:34 2004
@@ -274,7 +274,7 @@
             String wspName = (String) wspNames.next();
             NodeImpl rootNode = (NodeImpl) getSystemSession(wspName).getRootNode();
             if (!rootNode.hasNode(SYSTEM_ROOT_NAME)) {
-                rootNode.addNode(SYSTEM_ROOT_NAME, NodeTypeRegistry.NT_UNSTRUCTURED);
+                rootNode.addNode(SYSTEM_ROOT_NAME, NodeTypeRegistry.REP_SYSTEM);
                 rootNode.save();
             }
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Fri Dec 10 07:40:34 2004
@@ -42,6 +42,12 @@
     private static Logger log = Logger.getLogger(NodeTypeRegistry.class);
 
     // some well known node type names
+    // rep:root
+    public static final QName REP_ROOT =
+            new QName(NamespaceRegistryImpl.NS_REP_URI, "root");
+    // rep:system
+    public static final QName REP_SYSTEM =
+            new QName(NamespaceRegistryImpl.NS_REP_URI, "system");
     // nt:unstructured
     public static final QName NT_UNSTRUCTURED =
             new QName(NamespaceRegistryImpl.NS_NT_URI, "unstructured");
@@ -255,8 +261,8 @@
 
         // FIXME need a fake declaring node type
         def.setDeclaringNodeType(new QName(NamespaceRegistryImpl.NS_DEFAULT_URI, ""));
-        def.setRequiredPrimaryTypes(new QName[]{NT_BASE});
-        def.setDefaultPrimaryType(NT_UNSTRUCTURED);
+        def.setRequiredPrimaryTypes(new QName[]{REP_ROOT});
+        def.setDefaultPrimaryType(REP_ROOT);
         def.setMandatory(true);
         def.setProtected(false);
         def.setOnParentVersion(OnParentVersionAction.VERSION);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
Fri Dec 10 07:40:34 2004
@@ -59,6 +59,7 @@
 		<!ELEMENT requiredPrimaryType (CDATA)>
 ]>
 <nodeTypes
+    xmlns:rep="internal"
     xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
     xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
     xmlns:jcr="http://www.jcp.org/jcr/1.0">
@@ -273,4 +274,27 @@
             </valueConstraints>
         </propertyDef>
     </nodeType>
+
+    <!-- internal node types -->
+    <nodeType name="rep:root" mixin="false" orderableChildNodes="true">
+        <supertypes>
+            <supertype>nt:unstructured</supertype>
+        </supertypes>
+        <childNodeDef name="jcr:system" defaultPrimaryType="rep:system" autoCreate="false"
mandatory="false" onParentVersion="COPY" protected="true" primaryItem="false" sameNameSibs="false">
+            <requiredPrimaryTypes>
+                <requiredPrimaryType>rep:system</requiredPrimaryType>
+            </requiredPrimaryTypes>
+        </childNodeDef>
+    </nodeType>
+    <nodeType name="rep:system" mixin="false" orderableChildNodes="true">
+        <supertypes>
+            <supertype>nt:unstructured</supertype>
+        </supertypes>
+        <childNodeDef name="jcr:versionStorage" defaultPrimaryType="nt:unstructured" autoCreate="false"
mandatory="false" onParentVersion="COPY" protected="true" primaryItem="false" sameNameSibs="false">
+            <requiredPrimaryTypes>
+                <requiredPrimaryType>nt:base</requiredPrimaryType>
+            </requiredPrimaryTypes>
+        </childNodeDef>
+    </nodeType>
+
 </nodeTypes>

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/PersistentItemStateManager.java
Fri Dec 10 07:40:34 2004
@@ -72,16 +72,15 @@
     private PersistentNodeState createPersistentRootNodeState(String rootNodeUUID,
                                                               NodeTypeRegistry ntReg)
             throws ItemStateException {
-        PersistentNodeState rootState = createNodeState(rootNodeUUID, NodeTypeRegistry.NT_UNSTRUCTURED,
null);
+        PersistentNodeState rootState = createNodeState(rootNodeUUID, NodeTypeRegistry.REP_ROOT,
null);
 
         // @todo FIXME need to manually setup root node by creating mandatory jcr:primaryType
property
         NodeDefId nodeDefId = null;
         PropDefId propDefId = null;
 
         try {
-            // FIXME relies on definition of nt:unstructured and nt:base:
-            // first (and only) child node definition in nt:unstructured is applied to root
node
-            nodeDefId = new NodeDefId(ntReg.getNodeTypeDef(NodeTypeRegistry.NT_UNSTRUCTURED).getChildNodeDefs()[0]);
+            nodeDefId = new NodeDefId(ntReg.getRootNodeDef());
+            // FIXME relies on definition of nt:base:
             // first property definition in nt:base is jcr:primaryType
             propDefId = new PropDefId(ntReg.getNodeTypeDef(NodeTypeRegistry.NT_BASE).getPropertyDefs()[0]);
         } catch (NoSuchNodeTypeException nsnte) {
@@ -95,7 +94,7 @@
         rootState.addPropertyEntry(propName);
 
         PersistentPropertyState prop = createPropertyState(rootNodeUUID, propName);
-        prop.setValues(new InternalValue[]{InternalValue.create(NodeTypeRegistry.NT_UNSTRUCTURED)});
+        prop.setValues(new InternalValue[]{InternalValue.create(NodeTypeRegistry.REP_ROOT)});
         prop.setType(PropertyType.NAME);
         prop.setMultiValued(false);
         prop.setDefinitionId(propDefId);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java?view=diff&rev=111514&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java&r1=111513&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java&r2=111514
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/PersistentVersionManager.java
Fri Dec 10 07:40:34 2004
@@ -142,7 +142,7 @@
     }
 
     /**
-     * Creates a new Version History..
+     * Creates a new Version History.
      *
      * @param node the node for which the version history is to be initialized
      * @return the newly created version history.

Mime
View raw message