You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2004/12/06 19:08:47 UTC

svn commit: r109998 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java

Author: stefan
Date: Mon Dec  6 10:08:46 2004
New Revision: 109998

URL: http://svn.apache.org/viewcvs?view=rev&rev=109998
Log:
added some inline comments
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java

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=109998&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r1=109997&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java&r2=109998
==============================================================================
--- 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	Mon Dec  6 10:08:46 2004
@@ -1121,13 +1121,18 @@
 
 	/**
 	 * todo
-	 * check if the given node type (or any node type that has dependencies
-	 * on this node type) is currently referenced by nodes in the repository.
+         * 1. apply deep locks on root nodes in every workspace or alternatively
+         *    put repository in 'single-user' mode
+         * 2. check if the given node type (or any node type that has
+         *    dependencies on this node type) is currently referenced by nodes
+         *    in the repository.
+         * 3. remove the node type if there are no direct or indirect references
+         *    to it, otherwise throw exception
 	 *
-	 * this is absolutely necessary in order to guarantee integrity of
-	 * repository content.
+	 * the above checks are absolutely necessary in order to guarantee
+         * integrity of repository content.
 	 *
-	 * throw exception until this is can be done (using search)
+	 * throw exception while this is not implemented properly yet
 	 */
 	boolean isReferenced = true;
 	if (isReferenced) {
@@ -1199,19 +1204,33 @@
 	    throw new RepositoryException(name.toString() + ": can't reregister built-in node type.");
 	}
 
+        /**
+         * collect names of node types that have dependencies on the given
+         * node type
+         */
+        Set dependentNTs = getDependentNodeTypes(name);
+
 	/**
 	 * todo
-	 * - check if this node type (or any node type that has dependencies
-	 *   on this node type) is currently referenced by any nodes;
-	 *   this is absolutely necessary in order to guarantee integrity of
-	 *   repository content
-	 * - validate new node type definition
-	 * - build diff of old & new node type definition
-	 * - check if applying changes to affected nodes would violate existing node type constraints
-	 * - re-register node type definition and update caches
-	 * - notify listeners on re-registration
-	 * - apply and persist changes to affected nodes
-	 * - what else?
+         * 1. validate new node type definition
+         * 2. determine type of change and build diff of current and new
+         *    definition
+         * 3. if the change is trivial and has no effect on current content
+         *    (e.g. when a property defintion has been changed from
+         *    single-valued to multi-valued): continue with step 7, otherwise
+         *    continue with next step
+         * 4. apply deep locks on root nodes in every workspace or alternatively
+         *    put repository in 'exclusive' or 'single-user' mode
+         * 5. check if the given node type (or any node type that has
+         *    dependencies on this node type) is currently referenced by nodes
+         *    in the repository.
+	 * 6. check if applying changes to affected nodes would violate
+         *    existing node type constraints
+	 * 7. re-register node type definition and update caches
+	 * 8. notify listeners on re-registration
+	 * 9. apply and persist changes to affected nodes (e.g. update
+         *    definition id's, etc.)
+	 * 10. what else?
 	 */
 	//unregisterNodeType(name);
 	//return registerNodeType(ntd);