jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r161260 [2/7] - in incubator/jackrabbit/trunk: ./ applications/test/ applications/test/repository/nodetypes/ contrib/orm-persistence/applications/test/ contrib/orm-persistence/applications/test/repository/nodetypes/ src/java/org/apache/jackrabbit/core/ src/java/org/apache/jackrabbit/core/lock/ src/java/org/apache/jackrabbit/core/nodetype/ src/java/org/apache/jackrabbit/core/nodetype/virtual/ src/java/org/apache/jackrabbit/core/nodetype/xml/ src/java/org/apache/jackrabbit/core/observation/ src/java/org/apache/jackrabbit/core/search/ src/java/org/apache/jackrabbit/core/search/lucene/ src/java/org/apache/jackrabbit/core/security/ src/java/org/apache/jackrabbit/core/util/ src/java/org/apache/jackrabbit/core/version/ src/java/org/apache/jackrabbit/core/virtual/ src/java/org/apache/jackrabbit/core/xml/ src/test/org/apache/jackrabbit/core/nodetype/xml/ src/test/org/apache/jackrabbit/core/observation/ src/test/org/apache/jackrabbit/core/search/ src/test/org/apache/jackrabbit/test/api/ src/test/org/apache/jackrabbit/test/api/lock/ src/test/org/apache/jackrabbit/test/api/nodetype/ src/test/org/apache/jackrabbit/test/api/nodetype/spec/ src/test/org/apache/jackrabbit/test/api/observation/ src/test/org/apache/jackrabbit/test/api/query/ src/test/org/apache/jackrabbit/test/api/version/
Date Thu, 14 Apr 2005 11:51:03 GMT
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&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java Thu Apr 14 04:50:38 2005
@@ -18,11 +18,11 @@
 
 import org.apache.commons.collections.ReferenceMap;
 import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.jackrabbit.core.nodetype.ChildNodeDef;
+import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.nodetype.PropDef;
-import org.apache.jackrabbit.core.nodetype.PropertyDefImpl;
+import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -46,11 +46,13 @@
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.ItemExistsException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NodeDef;
 import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
 import java.util.ArrayList;
@@ -484,7 +486,7 @@
                 NodeState nodeState = (NodeState) itemState;
                 ItemId id = nodeState.getId();
                 NodeImpl node = (NodeImpl) itemMgr.getItem(id);
-                NodeDef def = node.getDefinition();
+                NodeDefinition def = node.getDefinition();
                 // primary type
                 NodeTypeImpl pnt = (NodeTypeImpl) node.getPrimaryNodeType();
                 // effective node type (primary type incl. mixins)
@@ -522,9 +524,9 @@
                     }
                 }
                 // mandatory child nodes
-                ChildNodeDef[] cnda = ent.getMandatoryNodeDefs();
+                NodeDef[] cnda = ent.getMandatoryNodeDefs();
                 for (int i = 0; i < cnda.length; i++) {
-                    ChildNodeDef cnd = cnda[i];
+                    NodeDef cnd = cnda[i];
                     if (!nodeState.hasChildNodeEntry(cnd.getName())) {
                         String msg = node.safeGetJCRPath() + ": mandatory child node " + cnd.getName() + " does not exist";
                         log.debug(msg);
@@ -536,7 +538,7 @@
                 PropertyState propState = (PropertyState) itemState;
                 ItemId propId = propState.getId();
                 PropertyImpl prop = (PropertyImpl) itemMgr.getItem(propId);
-                PropertyDefImpl def = (PropertyDefImpl) prop.getDefinition();
+                PropertyDefinitionImpl def = (PropertyDefinitionImpl) prop.getDefinition();
 
                 /**
                  * check value constraints
@@ -880,7 +882,8 @@
      * @throws RepositoryException
      */
     protected void internalRemove(boolean noChecks)
-            throws VersionException, LockException, RepositoryException {
+            throws VersionException, LockException,
+            ConstraintViolationException, RepositoryException {
 
         // check state of this instance
         sanityCheck();
@@ -897,7 +900,7 @@
                 throw new RepositoryException(msg);
             }
 
-            NodeDef def = node.getDefinition();
+            NodeDefinition def = node.getDefinition();
             // check protected flag
             if (!noChecks && def.isProtected()) {
                 String msg = safeGetJCRPath() + ": cannot remove a protected node";
@@ -906,7 +909,7 @@
             }
         } else {
             PropertyImpl prop = (PropertyImpl) this;
-            PropertyDef def = prop.getDefinition();
+            PropertyDefinition def = prop.getDefinition();
             // check protected flag
             if (!noChecks && def.isProtected()) {
                 String msg = safeGetJCRPath() + ": cannot remove a protected property";
@@ -1111,7 +1114,9 @@
     /**
      * {@inheritDoc}
      */
-    public void remove() throws VersionException, LockException, RepositoryException {
+    public void remove()
+            throws VersionException, LockException,
+            ConstraintViolationException, RepositoryException {
         internalRemove(false);
     }
 
@@ -1119,9 +1124,10 @@
      * {@inheritDoc}
      */
     public void save()
-            throws AccessDeniedException, ConstraintViolationException,
-            InvalidItemStateException, ReferentialIntegrityException,
-            VersionException, LockException, RepositoryException {
+            throws AccessDeniedException, ItemExistsException,
+            ConstraintViolationException, InvalidItemStateException,
+            ReferentialIntegrityException, VersionException, LockException,
+            NoSuchNodeTypeException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1464,7 +1470,10 @@
     /**
      * {@inheritDoc}
      */
-    public boolean isSame(Item otherItem) {
+    public boolean isSame(Item otherItem) throws RepositoryException {
+        // check state of this instance
+        sanityCheck();
+
         if (this == otherItem) {
             return true;
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemManager.java Thu Apr 14 04:50:38 2005
@@ -18,9 +18,9 @@
 
 import org.apache.commons.collections.ReferenceMap;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.NodeDefImpl;
+import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
 import org.apache.jackrabbit.core.nodetype.PropDefId;
-import org.apache.jackrabbit.core.nodetype.PropertyDefImpl;
+import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -40,8 +40,8 @@
 import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyIterator;
 import javax.jcr.RepositoryException;
-import javax.jcr.nodetype.NodeDef;
-import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -74,7 +74,7 @@
 
     private static Logger log = Logger.getLogger(ItemManager.class);
 
-    private final NodeDef rootNodeDef;
+    private final NodeDefinition rootNodeDef;
     private final NodeId rootNodeId;
 
     private final SessionImpl session;
@@ -99,7 +99,8 @@
      * @param rootNodeUUID      the UUID of the root node
      */
     ItemManager(ItemStateManager itemStateProvider, HierarchyManager hierMgr,
-                SessionImpl session, NodeDef rootNodeDef, String rootNodeUUID) {
+                SessionImpl session, NodeDefinition rootNodeDef,
+                String rootNodeUUID) {
         this.itemStateProvider = itemStateProvider;
         this.hierMgr = hierMgr;
         this.session = session;
@@ -161,10 +162,10 @@
         itemCache.clear();
     }
 
-    private NodeDef getDefinition(NodeState state)
+    private NodeDefinition getDefinition(NodeState state)
             throws RepositoryException {
         NodeDefId defId = state.getDefinitionId();
-        NodeDefImpl def = session.getNodeTypeManager().getNodeDef(defId);
+        NodeDefinitionImpl def = session.getNodeTypeManager().getNodeDefinition(defId);
         if (def == null) {
             log.warn("node at " + safeGetJCRPath(state.getId()) + " has invalid definitionId (" + defId + ")");
 
@@ -173,23 +174,23 @@
             NodeImpl parent = (NodeImpl) getItem(parentId);
             NodeState parentState = (NodeState) parent.getItemState();
             NodeState.ChildNodeEntry cne = (NodeState.ChildNodeEntry) parentState.getChildNodeEntries(state.getUUID()).get(0);
-            def = parent.getApplicableChildNodeDef(cne.getName(), state.getNodeTypeName());
+            def = parent.getApplicableChildNodeDefinition(cne.getName(), state.getNodeTypeName());
             state.setDefinitionId(new NodeDefId(def.unwrap()));
         }
         return def;
     }
 
-    private PropertyDef getDefinition(PropertyState state)
+    private PropertyDefinition getDefinition(PropertyState state)
             throws RepositoryException {
         PropDefId defId = state.getDefinitionId();
-        PropertyDefImpl def = session.getNodeTypeManager().getPropDef(defId);
+        PropertyDefinitionImpl def = session.getNodeTypeManager().getPropertyDefinition(defId);
         if (def == null) {
             log.warn("property at " + safeGetJCRPath(state.getId()) + " has invalid definitionId (" + defId + ")");
 
             // fallback: try finding applicable definition
             NodeId parentId = new NodeId(state.getParentUUID());
             NodeImpl parent = (NodeImpl) getItem(parentId);
-            def = parent.getApplicablePropertyDef(state.getName(), state.getType(), state.isMultiValued());
+            def = parent.getApplicablePropertyDefinition(state.getName(), state.getType(), state.isMultiValued());
             state.setDefinitionId(new PropDefId(def.unwrap()));
         }
         return def;
@@ -242,19 +243,6 @@
      * @return true if the specified item exists
      */
     boolean itemExists(Path path) {
-/*
-        try {
-            getItem(path);
-            return true;
-        } catch (PathNotFoundException pnfe) {
-            return false;
-        } catch (AccessDeniedException ade) {
-            // item exists but the session has not been granted read access
-            return false;
-        } catch (RepositoryException re) {
-            return false;
-        }
-*/
         try {
             // check sanity of session
             session.sanityCheck();
@@ -292,19 +280,6 @@
      * @return true if the specified item exists
      */
     boolean itemExists(ItemId id) {
-/*
-        try {
-            getItem(id);
-            return true;
-        } catch (ItemNotFoundException infe) {
-            return false;
-        } catch (AccessDeniedException ade) {
-            // item exists but the session has not been granted read access
-            return false;
-        } catch (RepositoryException re) {
-            return false;
-        }
-*/
         try {
             // check sanity of session
             session.sanityCheck();
@@ -546,7 +521,7 @@
         return item;
     }
 
-    NodeImpl createNodeInstance(NodeState state, NodeDef def)
+    NodeImpl createNodeInstance(NodeState state, NodeDefinition def)
             throws RepositoryException {
         NodeId id = new NodeId(state.getUUID());
         // we want to be informed on life cycle changes of the new node object
@@ -555,11 +530,13 @@
 
         // check special nodes
         if (state.getNodeTypeName().equals(NT_VERSION)) {
-            InternalVersion version = session.getVersionManager().getVersion(state.getUUID());
+            InternalVersion version =
+                    session.getVersionManager().getVersion(state.getUUID());
             return new VersionImpl(this, session, id, state, def, listeners, version);
 
         } else if (state.getNodeTypeName().equals(NT_VERSIONHISTORY)) {
-            InternalVersionHistory history = session.getVersionManager().getVersionHistory(state.getUUID());
+            InternalVersionHistory history =
+                    session.getVersionManager().getVersionHistory(state.getUUID());
             return new VersionHistoryImpl(this, session, id, state, def, listeners, history);
 
         } else {
@@ -571,12 +548,13 @@
 
     NodeImpl createNodeInstance(NodeState state) throws RepositoryException {
         // 1. get definition of the specified node
-        NodeDef def = getDefinition(state);
+        NodeDefinition def = getDefinition(state);
         // 2. create instance
         return createNodeInstance(state, def);
     }
 
-    PropertyImpl createPropertyInstance(PropertyState state, PropertyDef def) {
+    PropertyImpl createPropertyInstance(PropertyState state,
+                                        PropertyDefinition def) {
         PropertyId id = new PropertyId(state.getParentUUID(), state.getName());
         // we want to be informed on life cycle changes of the new property object
         // in order to maintain item cache consistency
@@ -586,9 +564,10 @@
         return prop;
     }
 
-    PropertyImpl createPropertyInstance(PropertyState state) throws RepositoryException {
+    PropertyImpl createPropertyInstance(PropertyState state)
+            throws RepositoryException {
         // 1. get definition for the specified property
-        PropertyDef def = getDefinition(state);
+        PropertyDefinition def = getDefinition(state);
         // 2. create instance
         return createPropertyInstance(state, def);
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/LazyItemIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/LazyItemIterator.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/LazyItemIterator.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/LazyItemIterator.java Thu Apr 14 04:50:38 2005
@@ -110,7 +110,7 @@
     /**
      * {@inheritDoc}
      */
-    public long getPos() {
+    public long getPosition() {
         return pos;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Thu Apr 14 04:50:38 2005
@@ -17,17 +17,17 @@
 package org.apache.jackrabbit.core;
 
 import org.apache.jackrabbit.core.lock.LockManager;
-import org.apache.jackrabbit.core.nodetype.ChildNodeDef;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
+import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.NodeDefImpl;
+import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.apache.jackrabbit.core.nodetype.PropDefId;
-import org.apache.jackrabbit.core.nodetype.PropertyDefImpl;
+import org.apache.jackrabbit.core.nodetype.PropertyDefinitionImpl;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
@@ -69,9 +69,9 @@
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.nodetype.NodeDef;
+import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.version.OnParentVersionAction;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
@@ -96,7 +96,7 @@
 
     protected final NodeTypeImpl nodeType;
 
-    protected NodeDef definition;
+    protected NodeDefinition definition;
 
     // flag set in status passed to getOrCreateProperty if property was created
     protected static final short CREATED = 0;
@@ -113,7 +113,7 @@
      * @throws RepositoryException
      */
     protected NodeImpl(ItemManager itemMgr, SessionImpl session, NodeId id,
-                       NodeState state, NodeDef definition,
+                       NodeState state, NodeDefinition definition,
                        ItemLifeCycleListener[] listeners)
             throws RepositoryException {
         super(itemMgr, session, id, state, listeners);
@@ -288,7 +288,7 @@
      * @throws RepositoryException
      */
     protected InternalValue[] computeSystemGeneratedPropertyValues(QName name,
-                                                                   PropertyDefImpl def)
+                                                                   PropertyDefinitionImpl def)
             throws RepositoryException {
         InternalValue[] genValues = null;
 
@@ -365,7 +365,6 @@
     }
 
     /**
-     *
      * @param name
      * @param type
      * @param multiValued
@@ -373,8 +372,8 @@
      * @return
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
-     * @throws RepositoryException if another error occurs
-     */ 
+     * @throws RepositoryException          if another error occurs
+     */
     protected PropertyImpl getOrCreateProperty(String name, int type,
                                                boolean multiValued,
                                                BitSet status)
@@ -391,7 +390,6 @@
     }
 
     /**
-     *
      * @param name
      * @param type
      * @param multiValued
@@ -399,7 +397,7 @@
      * @return
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
-     * @throws RepositoryException if another error occurs
+     * @throws RepositoryException          if another error occurs
      */
     protected synchronized PropertyImpl getOrCreateProperty(QName name, int type,
                                                             boolean multiValued,
@@ -418,14 +416,14 @@
 
         // does not exist yet:
         // find definition for the specified property and create property
-        PropertyDefImpl def = getApplicablePropertyDef(name, type, multiValued);
+        PropertyDefinitionImpl def = getApplicablePropertyDefinition(name, type, multiValued);
         PropertyImpl prop = createChildProperty(name, type, def);
         status.set(CREATED);
         return prop;
     }
 
     protected synchronized PropertyImpl createChildProperty(QName name, int type,
-                                                            PropertyDefImpl def)
+                                                            PropertyDefinitionImpl def)
             throws RepositoryException {
         // check for name collisions with existing child nodes
         if (((NodeState) state).hasChildNodeEntry(name)) {
@@ -469,7 +467,7 @@
         return prop;
     }
 
-    protected synchronized NodeImpl createChildNode(QName name, NodeDefImpl def,
+    protected synchronized NodeImpl createChildNode(QName name, NodeDefinitionImpl def,
                                                     NodeTypeImpl nodeType, String uuid)
             throws RepositoryException {
         String parentUUID = ((NodeState) state).getUUID();
@@ -504,16 +502,16 @@
         thisState.addChildNodeEntry(name, nodeState.getUUID());
 
         // add 'auto-create' properties defined in node type
-        PropertyDef[] pda = nodeType.getAutoCreatePropertyDefs();
+        PropertyDefinition[] pda = nodeType.getAutoCreatedPropertyDefinitions();
         for (int i = 0; i < pda.length; i++) {
-            PropertyDefImpl pd = (PropertyDefImpl) pda[i];
+            PropertyDefinitionImpl pd = (PropertyDefinitionImpl) pda[i];
             node.createChildProperty(pd.getQName(), pd.getRequiredType(), pd);
         }
 
         // recursively add 'auto-create' child nodes defined in node type
-        NodeDef[] nda = nodeType.getAutoCreateNodeDefs();
+        NodeDefinition[] nda = nodeType.getAutoCreatedNodeDefinitions();
         for (int i = 0; i < nda.length; i++) {
-            NodeDefImpl nd = (NodeDefImpl) nda[i];
+            NodeDefinitionImpl nd = (NodeDefinitionImpl) nda[i];
             node.createChildNode(nd.getQName(), nd, (NodeTypeImpl) nd.getDefaultPrimaryType(), null);
         }
 
@@ -589,7 +587,7 @@
     }
 
     protected void onRedefine(NodeDefId defId) throws RepositoryException {
-        NodeDefImpl newDef = session.getNodeTypeManager().getNodeDef(defId);
+        NodeDefinitionImpl newDef = session.getNodeTypeManager().getNodeDefinition(defId);
         // modify the state of 'this', i.e. the target node
         NodeState thisState = (NodeState) getOrCreateTransientItemState();
         // set id of new definition
@@ -714,9 +712,9 @@
             throw new RepositoryException(msg, e);
         }
 
-        NodeDefImpl def;
+        NodeDefinitionImpl def;
         try {
-            def = getApplicableChildNodeDef(nodeName, nodeType == null ? null : nodeType.getQName());
+            def = getApplicableChildNodeDefinition(nodeName, nodeType == null ? null : nodeType.getQName());
         } catch (RepositoryException re) {
             String msg = "no definition found in parent node's node type for new node";
             log.debug(msg);
@@ -728,24 +726,6 @@
         }
 
         // check for name collisions
-/*
-        try {
-            Item item = itemMgr.getItem(nodePath);
-            if (!item.isNode()) {
-                // there's already a property with that name
-                throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
-            } else {
-                // there's already a node with that name
-                // check same-name sibling setting of both new and existing node
-                if (!def.allowSameNameSibs()
-                        || !((NodeImpl) item).getDefinition().allowSameNameSibs()) {
-                    throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
-                }
-            }
-        } catch (PathNotFoundException pnfe) {
-            // no name collision
-        }
-*/
         NodeState thisState = (NodeState) state;
         if (thisState.hasPropertyEntry(nodeName)) {
             // there's already a property with that name
@@ -755,12 +735,12 @@
         if (cne != null) {
             // there's already a child node entry with that name;
             // check same-name sibling setting of new node
-            if (!def.allowSameNameSibs()) {
+            if (!def.allowsSameNameSiblings()) {
                 throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
             }
             // check same-name sibling setting of existing node
             NodeId newId = new NodeId(cne.getUUID());
-            if (!((NodeImpl) itemMgr.getItem(newId)).getDefinition().allowSameNameSibs()) {
+            if (!((NodeImpl) itemMgr.getItem(newId)).getDefinition().allowsSameNameSiblings()) {
                 throw new ItemExistsException(itemMgr.safeGetJCRPath(nodePath));
             }
         }
@@ -784,7 +764,7 @@
             prop = (PropertyImpl) itemMgr.getItem(new PropertyId(thisState.getUUID(), JCR_MIXINTYPES));
         } else {
             // find definition for the jcr:mixinTypes property and create property
-            PropertyDefImpl def = getApplicablePropertyDef(JCR_MIXINTYPES, PropertyType.NAME, true);
+            PropertyDefinitionImpl def = getApplicablePropertyDefinition(JCR_MIXINTYPES, PropertyType.NAME, true);
             prop = createChildProperty(JCR_MIXINTYPES, PropertyType.NAME, def);
         }
 
@@ -837,12 +817,13 @@
      * @return
      * @throws ConstraintViolationException if no applicable child node definition
      *                                      could be found
-     * @throws RepositoryException if another error occurs
+     * @throws RepositoryException          if another error occurs
      */
-    protected NodeDefImpl getApplicableChildNodeDef(QName nodeName, QName nodeTypeName)
+    protected NodeDefinitionImpl getApplicableChildNodeDefinition(QName nodeName,
+                                                                  QName nodeTypeName)
             throws ConstraintViolationException, RepositoryException {
-        ChildNodeDef cnd = getEffectiveNodeType().getApplicableChildNodeDef(nodeName, nodeTypeName);
-        return session.getNodeTypeManager().getNodeDef(new NodeDefId(cnd));
+        NodeDef cnd = getEffectiveNodeType().getApplicableChildNodeDef(nodeName, nodeTypeName);
+        return session.getNodeTypeManager().getNodeDefinition(new NodeDefId(cnd));
     }
 
     /**
@@ -855,14 +836,14 @@
      * @return
      * @throws ConstraintViolationException if no applicable property definition
      *                                      could be found
-     * @throws RepositoryException if another error occurs
+     * @throws RepositoryException          if another error occurs
      */
-    protected PropertyDefImpl getApplicablePropertyDef(QName propertyName,
-                                                       int type,
-                                                       boolean multiValued)
+    protected PropertyDefinitionImpl getApplicablePropertyDefinition(QName propertyName,
+                                                                     int type,
+                                                                     boolean multiValued)
             throws ConstraintViolationException, RepositoryException {
         PropDef pd = getEffectiveNodeType().getApplicablePropertyDef(propertyName, type, multiValued);
-        return session.getNodeTypeManager().getPropDef(new PropDefId(pd));
+        return session.getNodeTypeManager().getPropertyDefinition(new PropDefId(pd));
     }
 
     protected void makePersistent() {
@@ -1002,9 +983,9 @@
             setMixinTypesProperty(mixins);
 
             // add 'auto-create' properties defined in mixin type
-            PropertyDef[] pda = mixin.getAutoCreatePropertyDefs();
+            PropertyDefinition[] pda = mixin.getAutoCreatedPropertyDefinitions();
             for (int i = 0; i < pda.length; i++) {
-                PropertyDefImpl pd = (PropertyDefImpl) pda[i];
+                PropertyDefinitionImpl pd = (PropertyDefinitionImpl) pda[i];
                 // make sure that the property is not already defined by primary type
                 // or existing mixin's
                 NodeTypeImpl declaringNT = (NodeTypeImpl) pd.getDeclaringNodeType();
@@ -1014,9 +995,9 @@
             }
 
             // recursively add 'auto-create' child nodes defined in mixin type
-            NodeDef[] nda = mixin.getAutoCreateNodeDefs();
+            NodeDefinition[] nda = mixin.getAutoCreatedNodeDefinitions();
             for (int i = 0; i < nda.length; i++) {
-                NodeDefImpl nd = (NodeDefImpl) nda[i];
+                NodeDefinitionImpl nd = (NodeDefinitionImpl) nda[i];
                 // make sure that the child node is not already defined by primary type
                 // or existing mixin's
                 NodeTypeImpl declaringNT = (NodeTypeImpl) nd.getDeclaringNodeType();
@@ -1115,8 +1096,8 @@
         setMixinTypesProperty(remainingMixins);
 
         // shortcut
-        if (mixin.getChildNodeDefs().length == 0
-                && mixin.getPropertyDefs().length == 0) {
+        if (mixin.getChildNodeDefinitions().length == 0
+                && mixin.getPropertyDefinitions().length == 0) {
             // the node type has neither property nor child node definitions,
             // i.e. we're done
             return;
@@ -1829,7 +1810,7 @@
      */
     public Property setProperty(String name, Value[] values)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         int type;
         if (values == null || values.length == 0
                 || values[0] == null) {
@@ -1845,7 +1826,7 @@
      */
     public Property setProperty(String name, Value[] values, int type)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1879,7 +1860,7 @@
      */
     public Property setProperty(String name, String[] values)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         /**
          * if the target property is not of type STRING then a
          * best-effort conversion is tried
@@ -1892,7 +1873,7 @@
      */
     public Property setProperty(String name, String[] values, int type)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1926,7 +1907,20 @@
      */
     public Property setProperty(String name, String value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
+        /**
+         * if the target property is not of type STRING then a
+         * best-effort conversion is tried
+         */
+        return setProperty(name, value, PropertyType.UNDEFINED);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Property setProperty(String name, String value, int type)
+            throws ValueFormatException, VersionException, LockException,
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1945,7 +1939,7 @@
          * best-effort conversion is tried
          */
         BitSet status = new BitSet();
-        PropertyImpl prop = getOrCreateProperty(name, PropertyType.UNDEFINED, false, status);
+        PropertyImpl prop = getOrCreateProperty(name, type, false, status);
         try {
             prop.setValue(value);
         } catch (RepositoryException re) {
@@ -1962,9 +1956,9 @@
     /**
      * {@inheritDoc}
      */
-    public Property setProperty(String name, Value value)
+    public Property setProperty(String name, Value value, int type)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1978,8 +1972,6 @@
         // check lock status
         checkLock();
 
-        int type = (value == null) ? PropertyType.UNDEFINED : value.getType();
-
         BitSet status = new BitSet();
         PropertyImpl prop = getOrCreateProperty(name, type, false, status);
         try {
@@ -1998,9 +1990,19 @@
     /**
      * {@inheritDoc}
      */
+    public Property setProperty(String name, Value value)
+            throws ValueFormatException, VersionException, LockException,
+            ConstraintViolationException, RepositoryException {
+        int type = (value == null) ? PropertyType.UNDEFINED : value.getType();
+        return setProperty(name, value, type);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public Property setProperty(String name, InputStream value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2034,7 +2036,7 @@
      */
     public Property setProperty(String name, boolean value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2068,7 +2070,7 @@
      */
     public Property setProperty(String name, double value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2102,7 +2104,7 @@
      */
     public Property setProperty(String name, long value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2136,7 +2138,7 @@
      */
     public Property setProperty(String name, Calendar value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2170,7 +2172,7 @@
      */
     public Property setProperty(String name, Node value)
             throws ValueFormatException, VersionException, LockException,
-            RepositoryException {
+            ConstraintViolationException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2206,28 +2208,6 @@
             throws PathNotFoundException, RepositoryException {
         // check state of this instance
         sanityCheck();
-/*
-        Path nodePath;
-        try {
-            nodePath = Path.create(getPrimaryPath(), relPath, session.getNamespaceResolver(), true);
-        } catch (MalformedPathException e) {
-            String msg = "failed to resolve path " + relPath + " relative to " + safeGetJCRPath();
-            log.debug(msg);
-            throw new RepositoryException(msg, e);
-        }
-
-        try {
-            Item item = itemMgr.getItem(nodePath);
-            if (item.isNode()) {
-                return (Node) item;
-            } else {
-                // there's a property with that name, no child node though
-                throw new PathNotFoundException(relPath);
-            }
-        } catch (AccessDeniedException ade) {
-            throw new PathNotFoundException(relPath);
-        }
-*/
         NodeId id = resolveRelativeNodePath(relPath);
         if (id == null) {
             throw new PathNotFoundException(relPath);
@@ -2300,28 +2280,6 @@
             throws PathNotFoundException, RepositoryException {
         // check state of this instance
         sanityCheck();
-/*
-        Path propPath;
-        try {
-            propPath = Path.create(getPrimaryPath(), relPath, session.getNamespaceResolver(), true);
-        } catch (MalformedPathException e) {
-            String msg = "failed to resolve path " + relPath + " relative to " + safeGetJCRPath();
-            log.debug(msg);
-            throw new RepositoryException(msg, e);
-        }
-
-        try {
-            Item item = itemMgr.getItem(propPath);
-            if (!item.isNode()) {
-                return (Property) item;
-            } else {
-                // there's a child node with that name, no property though
-                throw new PathNotFoundException(relPath);
-            }
-        } catch (AccessDeniedException ade) {
-            throw new PathNotFoundException(relPath);
-        }
-*/
         PropertyId id = resolveRelativePropertyPath(relPath);
         if (id == null) {
             throw new PathNotFoundException(relPath);
@@ -2337,14 +2295,6 @@
      * {@inheritDoc}
      */
     public boolean hasNode(String relPath) throws RepositoryException {
-/*
-        try {
-            getNode(relPath);
-            return true;
-        } catch (PathNotFoundException pnfe) {
-            return false;
-        }
-*/
         // check state of this instance
         sanityCheck();
 
@@ -2462,7 +2412,8 @@
     /**
      * {@inheritDoc}
      */
-    public boolean canAddMixin(String mixinName) throws RepositoryException {
+    public boolean canAddMixin(String mixinName)
+            throws NoSuchNodeTypeException, RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -2530,14 +2481,6 @@
      * {@inheritDoc}
      */
     public boolean hasProperty(String relPath) throws RepositoryException {
-/*
-        try {
-            getProperty(relPath);
-            return true;
-        } catch (PathNotFoundException pnfe) {
-            return false;
-        }
-*/
         // check state of this instance
         sanityCheck();
 
@@ -2555,7 +2498,7 @@
     /**
      * {@inheritDoc}
      */
-    public NodeDef getDefinition() throws RepositoryException {
+    public NodeDefinition getDefinition() throws RepositoryException {
         return definition;
     }
 
@@ -2778,16 +2721,15 @@
     /**
      * {@inheritDoc}
      */
-    public void merge(String srcWorkspace, boolean bestEffort)
-            throws UnsupportedRepositoryOperationException,
-            NoSuchWorkspaceException, AccessDeniedException, VersionException,
-            LockException, InvalidItemStateException, RepositoryException {
+    public NodeIterator merge(String srcWorkspace, boolean bestEffort)
+            throws NoSuchWorkspaceException, AccessDeniedException,
+            VersionException, LockException, InvalidItemStateException,
+            RepositoryException {
 
         List failedIds = new ArrayList();
         internalMerge(srcWorkspace, failedIds, bestEffort);
 
-        // enable for 0.16.4
-        // return new LazyItemIterator(itemMgr, failedIds);
+        return new LazyItemIterator(itemMgr, failedIds);
     }
 
     public void cancelMerge(Version version)
@@ -2849,7 +2791,7 @@
         checkLock();
 
         // check if 'own' version
-        if (!((VersionImpl) version).getContainingVersionHistory().isSame(getVersionHistory())) {
+        if (!((VersionImpl) version).getContainingHistory().isSame(getVersionHistory())) {
             throw new VersionException("Unable to restore version. Not same version history.");
         }
 
@@ -3614,9 +3556,9 @@
         NodeTypeManagerImpl ntMgr = session.getNodeTypeManager();
         for (int j = 0; j < mixinNames.length; j++) {
             NodeTypeImpl mixin = ntMgr.getNodeType(mixinNames[j]);
-            PropertyDef[] pda = mixin.getAutoCreatePropertyDefs();
+            PropertyDefinition[] pda = mixin.getAutoCreatedPropertyDefinitions();
             for (int i = 0; i < pda.length; i++) {
-                PropertyDefImpl pd = (PropertyDefImpl) pda[i];
+                PropertyDefinitionImpl pd = (PropertyDefinitionImpl) pda[i];
                 if (!hasProperty(pd.getQName())) {
                     createChildProperty(pd.getQName(), pd.getRequiredType(), pd);
                 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/PropertyImpl.java Thu Apr 14 04:50:38 2005
@@ -37,7 +37,7 @@
 import javax.jcr.ValueFormatException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.version.VersionException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -51,7 +51,7 @@
 
     private static Logger log = Logger.getLogger(PropertyImpl.class);
 
-    private PropertyDef definition;
+    private PropertyDefinition definition;
 
     /**
      * Package private constructor.
@@ -64,7 +64,7 @@
      * @param listeners  listeners on life cylce changes of this <code>PropertyImpl</code>
      */
     PropertyImpl(ItemManager itemMgr, SessionImpl session, PropertyId id,
-                 PropertyState state, PropertyDef definition,
+                 PropertyState state, PropertyDefinition definition,
                  ItemLifeCycleListener[] listeners) {
         super(itemMgr, session, id, state, listeners);
         this.definition = definition;
@@ -125,6 +125,7 @@
 
     /**
      * Determines the length of the given value.
+     *
      * @param value value whose length should be determined
      * @return the length of the given value
      * @throws RepositoryException if an error occurs
@@ -132,7 +133,7 @@
      * @see javax.jcr.Property#getLengths()
      */
     protected long getLength(InternalValue value) throws RepositoryException {
-       switch (value.getType()) {
+        switch (value.getType()) {
             case PropertyType.STRING:
             case PropertyType.LONG:
             case PropertyType.DOUBLE:
@@ -577,7 +578,8 @@
      */
     public void setValue(Calendar date)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -627,7 +629,8 @@
      */
     public void setValue(double number)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -672,7 +675,8 @@
      */
     public void setValue(InputStream stream)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -728,7 +732,8 @@
      */
     public void setValue(String string)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -777,7 +782,8 @@
      */
     public void setValue(String[] strings)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -833,7 +839,8 @@
      */
     public void setValue(boolean b)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -878,7 +885,8 @@
      */
     public void setValue(Node target)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -980,7 +988,8 @@
      */
     public synchronized void setValue(Value value)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1031,7 +1040,8 @@
      */
     public void setValue(Value[] values)
             throws ValueFormatException, VersionException,
-            LockException, RepositoryException {
+            LockException, ConstraintViolationException,
+            RepositoryException {
         // check state of this instance
         sanityCheck();
 
@@ -1147,7 +1157,7 @@
     /**
      * {@inheritDoc}
      */
-    public PropertyDef getDefinition() {
+    public PropertyDefinition getDefinition() {
         return definition;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/SessionImpl.java Thu Apr 14 04:50:38 2005
@@ -20,7 +20,7 @@
 import org.apache.jackrabbit.core.config.AccessManagerConfig;
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.jackrabbit.core.nodetype.NodeDefImpl;
+import org.apache.jackrabbit.core.nodetype.NodeDefinitionImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.observation.EventStateCollection;
@@ -32,7 +32,6 @@
 import org.apache.jackrabbit.core.version.VersionManager;
 import org.apache.jackrabbit.core.xml.DocViewSAXEventGenerator;
 import org.apache.jackrabbit.core.xml.ImportHandler;
-import org.apache.jackrabbit.core.xml.Importer;
 import org.apache.jackrabbit.core.xml.SessionImporter;
 import org.apache.jackrabbit.core.xml.SysViewSAXEventGenerator;
 import org.apache.log4j.Logger;
@@ -63,6 +62,7 @@
 import javax.jcr.Workspace;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
@@ -495,15 +495,9 @@
      * {@inheritDoc}
      */
     public void checkPermission(String absPath, String actions)
-            throws AccessControlException {
+            throws AccessControlException, RepositoryException {
         // check sanity of this session
-        try {
-            sanityCheck();
-        } catch (RepositoryException re) {
-            String msg = "failed to check permissions on " + absPath;
-            log.warn(msg, re);
-            throw new AccessControlException(actions);
-        }
+        sanityCheck();
 
         // build the set of actions to be checked
         String[] strings = actions.split(",");
@@ -530,11 +524,7 @@
             } catch (MalformedPathException mpe) {
                 String msg = "invalid path: " + absPath;
                 log.warn(msg, mpe);
-                throw new AccessControlException(READ_ACTION);
-            } catch (RepositoryException re) {
-                String msg = "failed to check READ permission on " + absPath;
-                log.warn(msg, re);
-                throw new AccessControlException(READ_ACTION);
+                throw new RepositoryException(msg);
             }
         }
 
@@ -559,15 +549,11 @@
             } catch (MalformedPathException mpe) {
                 String msg = "invalid path: " + absPath;
                 log.warn(msg, mpe);
-                throw new AccessControlException(ADD_NODE_ACTION);
+                throw new RepositoryException(msg);
             } catch (AccessDeniedException re) {
                 // otherwise the RepositoryException catch clause will
                 // log a warn message, which is not appropriate in this case.
                 throw new AccessControlException(ADD_NODE_ACTION);
-            } catch (RepositoryException re) {
-                String msg = "failed to check WRITE permission on parent of " + absPath;
-                log.warn(msg, re);
-                throw new AccessControlException(ADD_NODE_ACTION);
             }
         }
 
@@ -590,15 +576,11 @@
             } catch (MalformedPathException mpe) {
                 String msg = "invalid path: " + absPath;
                 log.warn(msg, mpe);
-                throw new AccessControlException(REMOVE_ACTION);
+                throw new RepositoryException(msg);
             } catch (AccessDeniedException re) {
                 // otherwise the RepositoryException catch clause will
                 // log a warn message, which is not appropriate in this case.
                 throw new AccessControlException(REMOVE_ACTION);
-            } catch (RepositoryException re) {
-                String msg = "failed to check REMOVE permission on " + absPath;
-                log.warn(msg, re);
-                throw new AccessControlException(REMOVE_ACTION);
             }
         }
 
@@ -637,15 +619,11 @@
             } catch (MalformedPathException mpe) {
                 String msg = "invalid path: " + absPath;
                 log.warn(msg, mpe);
-                throw new AccessControlException(SET_PROPERTY_ACTION);
+                throw new RepositoryException(msg);
             } catch (AccessDeniedException re) {
                 // otherwise the RepositoryException catch clause will
                 // log a warn message, which is not appropriate in this case.
                 throw new AccessControlException(SET_PROPERTY_ACTION);
-            } catch (RepositoryException re) {
-                String msg = "failed to check WRITE permission on parent of " + absPath;
-                log.warn(msg, re);
-                throw new AccessControlException(SET_PROPERTY_ACTION);
             }
         }
     }
@@ -740,27 +718,26 @@
     /**
      * {@inheritDoc}
      */
-    public boolean itemExists(String absPath) {
-        try {
-            // check sanity of this session
-            sanityCheck();
+    public boolean itemExists(String absPath) throws RepositoryException {
+        // check sanity of this session
+        sanityCheck();
 
-            getItemManager().getItem(Path.create(absPath, getNamespaceResolver(), true));
-            return true;
-        } catch (RepositoryException re) {
-            // fall through...
+        try {
+            return getItemManager().itemExists(Path.create(absPath, getNamespaceResolver(), true));
         } catch (MalformedPathException mpe) {
-            // fall through...
+            String msg = "invalid path:" + absPath;
+            log.debug(msg);
+            throw new RepositoryException(msg, mpe);
         }
-        return false;
     }
 
     /**
      * {@inheritDoc}
      */
     public void save()
-            throws AccessDeniedException, ConstraintViolationException,
-            InvalidItemStateException, VersionException, LockException,
+            throws AccessDeniedException, ItemExistsException,
+            ConstraintViolationException, InvalidItemStateException,
+            VersionException, LockException, NoSuchNodeTypeException,
             RepositoryException {
         // check sanity of this session
         sanityCheck();
@@ -798,7 +775,8 @@
      */
     public void move(String srcAbsPath, String destAbsPath)
             throws ItemExistsException, PathNotFoundException,
-            VersionException, LockException, RepositoryException {
+            VersionException, ConstraintViolationException, LockException,
+            RepositoryException {
         // check sanity of this session
         sanityCheck();
 
@@ -878,8 +856,8 @@
             } else {
                 // there's already a node with that name
                 // check same-name sibling setting of both new and existing node
-                if (!destParentNode.getDefinition().allowSameNameSibs()
-                        || !((NodeImpl) item).getDefinition().allowSameNameSibs()) {
+                if (!destParentNode.getDefinition().allowsSameNameSiblings()
+                        || !((NodeImpl) item).getDefinition().allowsSameNameSiblings()) {
                     throw new ItemExistsException(item.safeGetJCRPath());
                 }
             }
@@ -894,9 +872,9 @@
 
         // get applicable definition of target node at new location
         NodeTypeImpl nt = (NodeTypeImpl) targetNode.getPrimaryNodeType();
-        NodeDefImpl newTargetDef;
+        NodeDefinitionImpl newTargetDef;
         try {
-            newTargetDef = destParentNode.getApplicableChildNodeDef(destName.getName(), nt.getQName());
+            newTargetDef = destParentNode.getApplicableChildNodeDefinition(destName.getName(), nt.getQName());
         } catch (RepositoryException re) {
             String msg = destAbsPath + ": no definition found in parent node's node type for new node";
             log.debug(msg);
@@ -928,7 +906,7 @@
         srcParentNode.removeChildNode(srcName.getName(),
                 srcName.getIndex() == 0 ? 1 : srcName.getIndex());
         // change definition of target if necessary
-        NodeDefImpl oldTargetDef = (NodeDefImpl) targetNode.getDefinition();
+        NodeDefinitionImpl oldTargetDef = (NodeDefinitionImpl) targetNode.getDefinition();
         NodeDefId oldTargetDefId = new NodeDefId(oldTargetDef.unwrap());
         NodeDefId newTargetDefId = new NodeDefId(newTargetDef.unwrap());
         if (!oldTargetDefId.equals(newTargetDefId)) {
@@ -939,7 +917,8 @@
     /**
      * {@inheritDoc}
      */
-    public ContentHandler getImportContentHandler(String parentAbsPath)
+    public ContentHandler getImportContentHandler(String parentAbsPath,
+                                                  int uuidBehavior)
             throws PathNotFoundException, ConstraintViolationException,
             VersionException, LockException, RepositoryException {
         // check sanity of this session
@@ -977,21 +956,23 @@
         // check lock status
         parent.checkLock();
 
-        SessionImporter importer = new SessionImporter(parent, this, Importer.IMPORT_UUID_CREATE_NEW);
+        SessionImporter importer = new SessionImporter(parent, this, uuidBehavior);
         return new ImportHandler(importer, getNamespaceResolver(), rep.getNamespaceRegistry());
     }
 
     /**
      * {@inheritDoc}
      */
-    public void importXML(String parentAbsPath, InputStream in)
+    public void importXML(String parentAbsPath, InputStream in,
+                          int uuidBehavior)
             throws IOException, PathNotFoundException, ItemExistsException,
             ConstraintViolationException, VersionException,
             InvalidSerializedDataException, LockException, RepositoryException {
         // check sanity of this session
         sanityCheck();
 
-        ImportHandler handler = (ImportHandler) getImportContentHandler(parentAbsPath);
+        ImportHandler handler = (ImportHandler)
+                getImportContentHandler(parentAbsPath, uuidBehavior);
         try {
             XMLReader parser =
                     XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
@@ -1019,10 +1000,9 @@
     /**
      * {@inheritDoc}
      */
-    public void exportDocView(String absPath, ContentHandler contentHandler,
-                              boolean skipBinary, boolean noRecurse)
-            throws InvalidSerializedDataException, PathNotFoundException,
-            SAXException, RepositoryException {
+    public void exportDocumentView(String absPath, ContentHandler contentHandler,
+                                   boolean skipBinary, boolean noRecurse)
+            throws PathNotFoundException, SAXException, RepositoryException {
         // check sanity of this session
         sanityCheck();
 
@@ -1038,15 +1018,15 @@
     /**
      * {@inheritDoc}
      */
-    public void exportDocView(String absPath, OutputStream out,
-                              boolean skipBinary, boolean noRecurse)
-            throws InvalidSerializedDataException, IOException,
-            PathNotFoundException, RepositoryException {
+    public void exportDocumentView(String absPath, OutputStream out,
+                                   boolean skipBinary, boolean noRecurse)
+            throws IOException, PathNotFoundException, RepositoryException {
         boolean indenting = false;
         OutputFormat format = new OutputFormat("xml", "UTF-8", indenting);
         XMLSerializer serializer = new XMLSerializer(out, format);
         try {
-            exportDocView(absPath, serializer.asContentHandler(), skipBinary, noRecurse);
+            exportDocumentView(absPath, serializer.asContentHandler(),
+                    skipBinary, noRecurse);
         } catch (SAXException se) {
             throw new RepositoryException(se);
         }
@@ -1055,8 +1035,8 @@
     /**
      * {@inheritDoc}
      */
-    public void exportSysView(String absPath, ContentHandler contentHandler,
-                              boolean skipBinary, boolean noRecurse)
+    public void exportSystemView(String absPath, ContentHandler contentHandler,
+                                 boolean skipBinary, boolean noRecurse)
             throws PathNotFoundException, SAXException, RepositoryException {
         // check sanity of this session
         sanityCheck();
@@ -1073,14 +1053,15 @@
     /**
      * {@inheritDoc}
      */
-    public void exportSysView(String absPath, OutputStream out,
-                              boolean skipBinary, boolean noRecurse)
+    public void exportSystemView(String absPath, OutputStream out,
+                                 boolean skipBinary, boolean noRecurse)
             throws IOException, PathNotFoundException, RepositoryException {
         boolean indenting = false;
         OutputFormat format = new OutputFormat("xml", "UTF-8", indenting);
         XMLSerializer serializer = new XMLSerializer(out, format);
         try {
-            exportSysView(absPath, serializer.asContentHandler(), skipBinary, noRecurse);
+            exportSystemView(absPath, serializer.asContentHandler(),
+                    skipBinary, noRecurse);
         } catch (SAXException se) {
             throw new RepositoryException(se);
         }
@@ -1089,6 +1070,13 @@
     /**
      * {@inheritDoc}
      */
+    public boolean isLive() {
+        return alive;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public synchronized void logout() {
         if (!alive) {
             // ignore
@@ -1140,7 +1128,7 @@
     /**
      * {@inheritDoc}
      */
-    public String getUserId() {
+    public String getUserID() {
         return userId;
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/WorkspaceImpl.java Thu Apr 14 04:50:38 2005
@@ -18,8 +18,8 @@
 
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
 import org.apache.jackrabbit.core.lock.LockManager;
-import org.apache.jackrabbit.core.nodetype.ChildNodeDef;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
+import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeConflictException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
@@ -283,7 +283,7 @@
         // effective node type (primary type incl. mixins)
         EffectiveNodeType ent = getEffectiveNodeType(nodeState);
         NodeTypeRegistry ntReg = rep.getNodeTypeRegistry();
-        ChildNodeDef def = ntReg.getNodeDef(nodeState.getDefinitionId());
+        NodeDef def = ntReg.getNodeDef(nodeState.getDefinitionId());
 
         // check if primary type satisfies the 'required node types' constraint
         QName[] requiredPrimaryTypes = def.getRequiredPrimaryTypes();
@@ -309,9 +309,9 @@
             }
         }
         // mandatory child nodes
-        ChildNodeDef[] cnda = ent.getMandatoryNodeDefs();
+        NodeDef[] cnda = ent.getMandatoryNodeDefs();
         for (int i = 0; i < cnda.length; i++) {
-            ChildNodeDef cnd = cnda[i];
+            NodeDef cnd = cnda[i];
             if (!nodeState.hasChildNodeEntry(cnd.getName())) {
                 String msg = hierMgr.safeGetJCRPath(nodeState.getId())
                         + ": mandatory child node " + cnd.getName()
@@ -430,7 +430,7 @@
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
             NodeTypeRegistry ntReg = rep.getNodeTypeRegistry();
-            ChildNodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
             // make sure parent node is not protected
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(hierMgr.safeGetJCRPath(parentState.getId())
@@ -439,7 +439,7 @@
             // make sure there's an applicable definition for new child node
             EffectiveNodeType entParent = getEffectiveNodeType(parentState);
             entParent.checkAddNodeConstraints(nodeName, nodeTypeName);
-            ChildNodeDef newNodeDef =
+            NodeDef newNodeDef =
                     findApplicableNodeDefinition(nodeName, nodeTypeName,
                             parentState);
 
@@ -466,11 +466,11 @@
                     log.debug(msg);
                     throw new RepositoryException(msg, ise);
                 }
-                ChildNodeDef conflictingTargetDef =
+                NodeDef conflictingTargetDef =
                         ntReg.getNodeDef(conflictingState.getDefinitionId());
                 // check same-name sibling setting of both target and existing node
-                if (!conflictingTargetDef.allowSameNameSibs()
-                        || !newNodeDef.allowSameNameSibs()) {
+                if (!conflictingTargetDef.allowsSameNameSiblings()
+                        || !newNodeDef.allowsSameNameSiblings()) {
                     throw new ItemExistsException("cannot add child node '"
                             + nodeName.getLocalName() + "' to "
                             + hierMgr.safeGetJCRPath(parentState.getId())
@@ -603,12 +603,12 @@
 
         if ((options & CHECK_CONSTRAINTS) == CHECK_CONSTRAINTS) {
             NodeTypeRegistry ntReg = rep.getNodeTypeRegistry();
-            ChildNodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
+            NodeDef parentDef = ntReg.getNodeDef(parentState.getDefinitionId());
             if (parentDef.isProtected()) {
                 throw new ConstraintViolationException(hierMgr.safeGetJCRPath(parentId)
                         + ": cannot remove child node of protected parent node");
             }
-            ChildNodeDef targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
+            NodeDef targetDef = ntReg.getNodeDef(targetState.getDefinitionId());
             if (targetDef.isMandatory()) {
                 throw new ConstraintViolationException(hierMgr.safeGetJCRPath(targetId)
                         + ": cannot remove mandatory node");
@@ -767,14 +767,14 @@
      * @param name
      * @param nodeTypeName
      * @param parentState
-     * @return a <code>ChildNodeDef</code>
+     * @return a <code>NodeDef</code>
      * @throws ConstraintViolationException if no applicable child node definition
      *                                      could be found
      * @throws RepositoryException          if another error occurs
      */
-    public ChildNodeDef findApplicableNodeDefinition(QName name,
-                                                     QName nodeTypeName,
-                                                     NodeState parentState)
+    public NodeDef findApplicableNodeDefinition(QName name,
+                                                QName nodeTypeName,
+                                                NodeState parentState)
             throws RepositoryException, ConstraintViolationException {
         EffectiveNodeType entParent = getEffectiveNodeType(parentState);
         return entParent.getApplicableChildNodeDef(name, nodeTypeName);
@@ -1222,7 +1222,7 @@
             destParentState.addChildNodeEntry(destName.getName(), newState.getUUID());
 
             // change definition (id) of new node
-            ChildNodeDef newNodeDef =
+            NodeDef newNodeDef =
                     findApplicableNodeDefinition(destName.getName(),
                             srcState.getNodeTypeName(), destParentState);
             newState.setDefinitionId(new NodeDefId(newNodeDef));
@@ -1518,7 +1518,7 @@
             destParentState.addChildNodeEntry(destName.getName(), targetState.getUUID());
 
             // change definition (id) of target node
-            ChildNodeDef newTargetDef =
+            NodeDef newTargetDef =
                     findApplicableNodeDefinition(destName.getName(),
                             targetState.getNodeTypeName(), destParentState);
             targetState.setDefinitionId(new NodeDefId(newTargetDef));
@@ -1621,7 +1621,7 @@
         final HashMap toRestore = new HashMap();
         for (int i = 0; i < versions.length; i++) {
             VersionImpl v = (VersionImpl) versions[i];
-            VersionHistory vh = v.getContainingVersionHistory();
+            VersionHistory vh = v.getContainingHistory();
             // check for collision
             if (toRestore.containsKey(vh.getUUID())) {
                 throw new VersionException("Unable to restore. Two or more versions have same version history.");

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockImpl.java Thu Apr 14 04:50:38 2005
@@ -17,12 +17,11 @@
 package org.apache.jackrabbit.core.lock;
 
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.NodeId;
 
-import javax.jcr.lock.Lock;
-import javax.jcr.lock.LockException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
+import javax.jcr.lock.LockException;
 
 /**
  * Implementation of a <code>Lock</code> that gets returned to clients asking
@@ -42,6 +41,7 @@
 
     /**
      * Create a new instance of this class.
+     *
      * @param info lock information
      * @param node node holding lock
      */
@@ -87,8 +87,15 @@
     /**
      * {@inheritDoc}
      */
-    public boolean isLive() {
+    public boolean isLive() throws RepositoryException {
         return info.isLive();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isSessionScoped() {
+        return info.isSessionScoped();
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockInfo.java Thu Apr 14 04:50:38 2005
@@ -16,14 +16,13 @@
  */
 package org.apache.jackrabbit.core.lock;
 
-import org.apache.jackrabbit.core.SessionListener;
-import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.SessionListener;
 import org.apache.log4j.Logger;
 
-import javax.jcr.Session;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 import javax.jcr.lock.LockException;
 
 /**
@@ -74,11 +73,12 @@
 
     /**
      * Create a new instance of this class.
-     * @param lockMgr lock manager
-     * @param lockToken lock token
+     *
+     * @param lockMgr       lock manager
+     * @param lockToken     lock token
      * @param sessionScoped whether lock token is session scoped
-     * @param deep whether lock is deep
-     * @param lockOwner owner of lock
+     * @param deep          whether lock is deep
+     * @param lockOwner     owner of lock
      */
     public LockInfo(LockManagerImpl lockMgr, LockToken lockToken,
                     boolean sessionScoped, boolean deep, String lockOwner) {
@@ -91,6 +91,7 @@
 
     /**
      * Set the live flag
+     *
      * @param live live flag
      */
     public void setLive(boolean live) {
@@ -99,6 +100,7 @@
 
     /**
      * Return the UUID of the lock holding node
+     *
      * @return uuid
      */
     public String getUUID() {
@@ -107,6 +109,7 @@
 
     /**
      * Return the session currently holding the lock
+     *
      * @return session currently holding the lock
      */
     public SessionImpl getLockHolder() {
@@ -115,6 +118,7 @@
 
     /**
      * Set the session currently holding the lock
+     *
      * @param lockHolder session currently holding the lock
      */
     public void setLockHolder(SessionImpl lockHolder) {
@@ -135,6 +139,7 @@
 
     /**
      * Return a flag indicating whether the lock is live
+     *
      * @return <code>true</code> if the lock is live; otherwise <code>false</code>
      */
     public boolean isLive() {
@@ -142,10 +147,21 @@
     }
 
     /**
+     * Return a flag indicating whether the lock is session-scoped
+     *
+     * @return <code>true</code> if the lock is session-scoped;
+     *         otherwise <code>false</code>
+     */
+    public boolean isSessionScoped() {
+        return sessionScoped;
+    }
+
+    /**
      * Refresh a lock. Will try to re-insert this lock info into the lock
      * manager's path map, provided the node is not already locked.
+     *
      * @param node node to lock again
-     * @throws LockException if the node is already locked
+     * @throws LockException       if the node is already locked
      * @throws RepositoryException if some other error occurs
      * @see javax.jcr.Node#refresh
      */
@@ -157,7 +173,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * <p/>
      * When the owning session is logging out, we should unlock the node on
      * behalf of the user currently holding it.
      */
@@ -170,5 +186,6 @@
     /**
      * {@inheritDoc}
      */
-    public void loggedOut(SessionImpl session) {}
+    public void loggedOut(SessionImpl session) {
+    }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/lock/LockManagerImpl.java Thu Apr 14 04:50:38 2005
@@ -238,7 +238,7 @@
 
         // add properties to content
         node.internalSetProperty(Constants.JCR_LOCKOWNER,
-                InternalValue.create(node.getSession().getUserId()));
+                InternalValue.create(node.getSession().getUserID()));
         node.internalSetProperty(Constants.JCR_LOCKISDEEP,
                 InternalValue.create(info.deep));
         node.save();
@@ -305,7 +305,7 @@
 
         // create lock info to use and pass to internal implementation
         LockInfo info = new LockInfo(this, new LockToken(node.internalGetUUID()),
-                isSessionScoped, isDeep, node.getSession().getUserId());
+                isSessionScoped, isDeep, node.getSession().getUserID());
         return lock(node, info);
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?view=diff&r1=161259&r2=161260
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java Thu Apr 14 04:50:38 2005
@@ -104,7 +104,7 @@
         ent.mergedNodeTypes.add(ntName);
         ent.allNodeTypes.add(ntName);
 
-        ChildNodeDef[] cnda = ntd.getChildNodeDefs();
+        NodeDef[] cnda = ntd.getChildNodeDefs();
         for (int i = 0; i < cnda.length; i++) {
             if (cnda[i].definesResidual()) {
                 // residual node definition
@@ -123,8 +123,8 @@
                      * name; make sure none of them is auto-create
                      */
                     for (int j = 0; j < defs.size(); j++) {
-                        ChildItemDef def = (ChildItemDef) defs.get(j);
-                        if (cnda[i].isAutoCreate() || def.isAutoCreate()) {
+                        ItemDef def = (ItemDef) defs.get(j);
+                        if (cnda[i].isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '" + name + "' in node type '" + ntName + "'";
                             log.debug(msg);
@@ -154,8 +154,8 @@
                      * name; make sure none of them is auto-create
                      */
                     for (int j = 0; j < defs.size(); j++) {
-                        ChildItemDef def = (ChildItemDef) defs.get(j);
-                        if (pda[i].isAutoCreate() || def.isAutoCreate()) {
+                        ItemDef def = (ItemDef) defs.get(j);
+                        if (pda[i].isAutoCreated() || def.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '" + name + "' in node type '" + ntName + "'";
                             log.debug(msg);
@@ -198,46 +198,46 @@
         return (QName[]) allNodeTypes.toArray(new QName[allNodeTypes.size()]);
     }
 
-    public ChildItemDef[] getAllItemDefs() {
+    public ItemDef[] getAllItemDefs() {
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
             defs.addAll((List) iter.next());
         }
         defs.addAll(unnamedItemDefs);
-        return (ChildItemDef[]) defs.toArray(new ChildItemDef[defs.size()]);
+        return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
-    public ChildItemDef[] getNamedItemDefs() {
+    public ItemDef[] getNamedItemDefs() {
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
             defs.addAll((List) iter.next());
         }
-        return (ChildItemDef[]) defs.toArray(new ChildItemDef[defs.size()]);
+        return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
-    public ChildItemDef[] getUnnamedItemDefs() {
-        return (ChildItemDef[]) unnamedItemDefs.toArray(new ChildItemDef[unnamedItemDefs.size()]);
+    public ItemDef[] getUnnamedItemDefs() {
+        return (ItemDef[]) unnamedItemDefs.toArray(new ItemDef[unnamedItemDefs.size()]);
     }
 
     public boolean hasNamedItemDef(QName name) {
         return namedItemDefs.containsKey(name);
     }
 
-    public ChildItemDef[] getNamedItemDefs(QName name) {
+    public ItemDef[] getNamedItemDefs(QName name) {
         List defs = (List) namedItemDefs.get(name);
         if (defs == null) {
             return null;
         }
-        return (ChildItemDef[]) defs.toArray(new ChildItemDef[defs.size()]);
+        return (ItemDef[]) defs.toArray(new ItemDef[defs.size()]);
     }
 
-    public ChildNodeDef[] getAllNodeDefs() {
+    public NodeDef[] getAllNodeDefs() {
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
-            ChildItemDef def = (ChildItemDef) iter.next();
+            ItemDef def = (ItemDef) iter.next();
             if (def.definesNode()) {
                 defs.add(def);
             }
@@ -247,44 +247,44 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (def.definesNode()) {
                     defs.add(def);
                 }
             }
         }
-        return (ChildNodeDef[]) defs.toArray(new ChildNodeDef[defs.size()]);
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public ChildNodeDef[] getNamedNodeDefs() {
+    public NodeDef[] getNamedNodeDefs() {
         ArrayList defs = new ArrayList(namedItemDefs.size());
         Iterator iter = namedItemDefs.values().iterator();
         while (iter.hasNext()) {
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (def.definesNode()) {
                     defs.add(def);
                 }
             }
         }
-        return (ChildNodeDef[]) defs.toArray(new ChildNodeDef[defs.size()]);
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public ChildNodeDef[] getUnnamedNodeDefs() {
+    public NodeDef[] getUnnamedNodeDefs() {
         ArrayList defs = new ArrayList(unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
-            ChildItemDef def = (ChildItemDef) iter.next();
+            ItemDef def = (ItemDef) iter.next();
             if (def.definesNode()) {
                 defs.add(def);
             }
         }
-        return (ChildNodeDef[]) defs.toArray(new ChildNodeDef[defs.size()]);
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
-    public ChildNodeDef[] getAutoCreateNodeDefs() {
+    public NodeDef[] getAutoCreateNodeDefs() {
         // since auto-create items must have a name,
         // we're only searching the named item definitions
         ArrayList defs = new ArrayList(namedItemDefs.size());
@@ -293,20 +293,20 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
-                if (def.definesNode() && def.isAutoCreate()) {
+                ItemDef def = (ItemDef) iter1.next();
+                if (def.definesNode() && def.isAutoCreated()) {
                     defs.add(def);
                 }
             }
         }
-        return (ChildNodeDef[]) defs.toArray(new ChildNodeDef[defs.size()]);
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     public PropDef[] getAllPropDefs() {
         ArrayList defs = new ArrayList(namedItemDefs.size() + unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
-            ChildItemDef def = (ChildItemDef) iter.next();
+            ItemDef def = (ItemDef) iter.next();
             if (!def.definesNode()) {
                 defs.add(def);
             }
@@ -316,7 +316,7 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (!def.definesNode()) {
                     defs.add(def);
                 }
@@ -332,7 +332,7 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (!def.definesNode()) {
                     defs.add(def);
                 }
@@ -345,7 +345,7 @@
         ArrayList defs = new ArrayList(unnamedItemDefs.size());
         Iterator iter = unnamedItemDefs.iterator();
         while (iter.hasNext()) {
-            ChildItemDef def = (ChildItemDef) iter.next();
+            ItemDef def = (ItemDef) iter.next();
             if (!def.definesNode()) {
                 defs.add(def);
             }
@@ -362,8 +362,8 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
-                if (!def.definesNode() && def.isAutoCreate()) {
+                ItemDef def = (ItemDef) iter1.next();
+                if (!def.definesNode() && def.isAutoCreated()) {
                     defs.add(def);
                 }
             }
@@ -380,7 +380,7 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (!def.definesNode() && def.isMandatory()) {
                     defs.add(def);
                 }
@@ -389,7 +389,7 @@
         return (PropDef[]) defs.toArray(new PropDef[defs.size()]);
     }
 
-    public ChildNodeDef[] getMandatoryNodeDefs() {
+    public NodeDef[] getMandatoryNodeDefs() {
         // since mandatory items must have a name,
         // we're only searching the named item definitions
         ArrayList defs = new ArrayList(namedItemDefs.size());
@@ -398,13 +398,13 @@
             List list = (List) iter.next();
             Iterator iter1 = list.iterator();
             while (iter1.hasNext()) {
-                ChildItemDef def = (ChildItemDef) iter1.next();
+                ItemDef def = (ItemDef) iter1.next();
                 if (def.definesNode() && def.isMandatory()) {
                     defs.add(def);
                 }
             }
         }
-        return (ChildNodeDef[]) defs.toArray(new ChildNodeDef[defs.size()]);
+        return (NodeDef[]) defs.toArray(new NodeDef[defs.size()]);
     }
 
     /**
@@ -491,11 +491,11 @@
      */
     public void checkAddNodeConstraints(QName name, QName nodeTypeName)
             throws ConstraintViolationException, NoSuchNodeTypeException {
-        ChildNodeDef nd = getApplicableChildNodeDef(name, nodeTypeName);
+        NodeDef nd = getApplicableChildNodeDef(name, nodeTypeName);
         if (nd.isProtected()) {
             throw new ConstraintViolationException(name + " is protected");
         }
-        if (nd.isAutoCreate()) {
+        if (nd.isAutoCreated()) {
             throw new ConstraintViolationException(name + " is auto-created and can not be manually added");
         }
     }
@@ -511,15 +511,15 @@
      * @throws ConstraintViolationException if no applicable child node definition
      *                                      could be found
      */
-    public ChildNodeDef getApplicableChildNodeDef(QName name, QName nodeTypeName)
+    public NodeDef getApplicableChildNodeDef(QName name, QName nodeTypeName)
             throws NoSuchNodeTypeException, ConstraintViolationException {
         // try named node definitions first
-        ChildItemDef[] defs = getNamedItemDefs(name);
+        ItemDef[] defs = getNamedItemDefs(name);
         if (defs != null) {
             for (int i = 0; i < defs.length; i++) {
-                ChildItemDef def = defs[i];
+                ItemDef def = defs[i];
                 if (def.definesNode()) {
-                    ChildNodeDef nd = (ChildNodeDef) def;
+                    NodeDef nd = (NodeDef) def;
                     // node definition with that name exists
                     if (nodeTypeName != null) {
                         try {
@@ -546,9 +546,9 @@
 
         // no item with that name defined;
         // try residual node definitions
-        ChildNodeDef[] nda = getUnnamedNodeDefs();
+        NodeDef[] nda = getUnnamedNodeDefs();
         for (int i = 0; i < nda.length; i++) {
-            ChildNodeDef nd = nda[i];
+            NodeDef nd = nda[i];
             if (nodeTypeName != null) {
                 try {
                     // check node type constraint
@@ -588,10 +588,10 @@
                                             boolean multiValued)
             throws ConstraintViolationException {
         // try named property definitions first
-        ChildItemDef[] defs = getNamedItemDefs(name);
+        ItemDef[] defs = getNamedItemDefs(name);
         if (defs != null) {
             for (int i = 0; i < defs.length; i++) {
-                ChildItemDef def = defs[i];
+                ItemDef def = defs[i];
                 if (!def.definesNode()) {
                     PropDef pd = (PropDef) def;
                     int reqType = pd.getRequiredType();
@@ -641,7 +641,7 @@
          * as there might be multiple definitions with the same name and we
          * don't know which one is applicable, we check all of them
          */
-        ChildItemDef[] defs = getNamedItemDefs(name);
+        ItemDef[] defs = getNamedItemDefs(name);
         if (defs != null) {
             for (int i = 0; i < defs.length; i++) {
                 if (defs[i].isMandatory()) {
@@ -730,9 +730,9 @@
         }
 
         // named item definitions
-        ChildItemDef[] defs = other.getNamedItemDefs();
+        ItemDef[] defs = other.getNamedItemDefs();
         for (int i = 0; i < defs.length; i++) {
-            ChildItemDef def = defs[i];
+            ItemDef def = defs[i];
             if (includesNodeType(def.getDeclaringNodeType())) {
                 // ignore redundant definitions
                 continue;
@@ -743,9 +743,9 @@
                 if (existingDefs.size() > 0) {
                     // there already exists at least one definition with that name
                     for (int j = 0; j < existingDefs.size(); j++) {
-                        ChildItemDef existingDef = (ChildItemDef) existingDefs.get(j);
+                        ItemDef existingDef = (ItemDef) existingDefs.get(j);
                         // make sure none of them is auto-create
-                        if (def.isAutoCreate() || existingDef.isAutoCreate()) {
+                        if (def.isAutoCreated() || existingDef.isAutoCreated()) {
                             // conflict
                             String msg = "The item definition for '" + name
                                     + "' in node type '"
@@ -800,14 +800,14 @@
         // residual item definitions
         defs = other.getUnnamedItemDefs();
         for (int i = 0; i < defs.length; i++) {
-            ChildItemDef def = defs[i];
+            ItemDef def = defs[i];
             if (includesNodeType(def.getDeclaringNodeType())) {
                 // ignore redundant definitions
                 continue;
             }
             Iterator iter = unnamedItemDefs.iterator();
             while (iter.hasNext()) {
-                ChildItemDef existing = (ChildItemDef) iter.next();
+                ItemDef existing = (ItemDef) iter.next();
                 // compare with existing definition
                 if (def.definesNode() == existing.definesNode()) {
                     if (!def.definesNode()) {



Mime
View raw message