jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 56379 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . state state/tx virtual
Date Tue, 02 Nov 2004 15:06:44 GMT
Author: stefan
Date: Tue Nov  2 07:06:44 2004
New Revision: 56379

Added:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
  (contents, props changed)
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionalItemStateManager.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
Log:
misc. small changes for better performance

Added: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
==============================================================================
--- (empty file)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
Tue Nov  2 07:06:44 2004
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import org.apache.commons.collections.ReferenceMap;
+import org.apache.log4j.Logger;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import java.util.Map;
+
+/**
+ * <code>CachingHierarchyManager</code> is a simple wrapper for a
+ * <code>HierarchyManager</code> that caches the <code>ItemId</code>
to <code>Path</code>
+ * mappings returned by the underlying <code>HierarchyManager</code> for better
+ * performance.
+ * <p/>
+ * Please keep in mind that this cache of <code>Path</code>s is not automatically
+ * updated when the underlying hierarchy is changing. Therefore it should only be
+ * used with caution and in special situations (usually only locally within a
+ * narrow scope) where the underlying hierarchy is not expected to change.
+ */
+public class CachingHierarchyManager implements HierarchyManager {
+
+    private static Logger log = Logger.getLogger(CachingHierarchyManager.class);
+
+    private final HierarchyManager delegatee;
+
+    // map of item id to list of paths
+    private Map pathCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.HARD);
+    private Map zombiePathCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.HARD);
+
+    // map of path to item id
+    private Map idCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.HARD);
+
+    /**
+     * @param hierMgr
+     */
+    public CachingHierarchyManager(HierarchyManager hierMgr) {
+        delegatee = hierMgr;
+    }
+
+    /**
+     * Returns the wrapped <code>HierarchyManager</code> instance
+     *
+     * @return the wrapped <code>HierarchyManager</code> instance
+     */
+    public HierarchyManager unwrap() {
+        return delegatee;
+    }
+
+    /**
+     * Clears the cache.
+     */
+    public synchronized void clearCache() {
+        pathCache.clear();
+        zombiePathCache.clear();
+        idCache.clear();
+    }
+
+    //-----------------------------------------------------< HierarchyManager >
+    /**
+     * @see HierarchyManager#listParents(ItemId)
+     */
+    public NodeId[] listParents(ItemId id) throws ItemNotFoundException, RepositoryException
{
+        return delegatee.listParents(id);
+    }
+
+    /**
+     * @see HierarchyManager#listChildren(NodeId)
+     */
+    public ItemId[] listChildren(NodeId id) throws ItemNotFoundException, RepositoryException
{
+        return delegatee.listChildren(id);
+    }
+
+    /**
+     * @see HierarchyManager#listZombieChildren(NodeId)
+     */
+    public ItemId[] listZombieChildren(NodeId id)
+            throws ItemNotFoundException, RepositoryException {
+        return delegatee.listZombieChildren(id);
+    }
+
+    /**
+     * @see HierarchyManager#resolvePath(Path)
+     */
+    public synchronized ItemId resolvePath(Path path)
+            throws PathNotFoundException, RepositoryException {
+        // check cache first
+        ItemId id = (ItemId) idCache.get(path);
+        if (id != null) {
+            return id;
+        }
+        id = delegatee.resolvePath(path);
+        idCache.put(path, id);
+        return id;
+    }
+
+    /**
+     * @see HierarchyManager#getPath(ItemId)
+     */
+    public synchronized Path getPath(ItemId id) throws ItemNotFoundException, RepositoryException
{
+        return getAllPaths(id, false)[0];
+    }
+
+    /**
+     * @see HierarchyManager#getName(ItemId)
+     */
+    public QName getName(ItemId itemId) throws ItemNotFoundException, RepositoryException
{
+        if (itemId.denotesNode()) {
+            return getPath(itemId).getNameElement().getName();
+        } else {
+            PropertyId propId = (PropertyId) itemId;
+            return propId.getName();
+        }
+    }
+
+    /**
+     * @see HierarchyManager#getAllPaths(ItemId)
+     */
+    public synchronized Path[] getAllPaths(ItemId id) throws ItemNotFoundException, RepositoryException
{
+        return getAllPaths(id, false);
+    }
+
+    /**
+     * @see HierarchyManager#getAllPaths(ItemId, boolean)
+     */
+    public synchronized Path[] getAllPaths(ItemId id, boolean includeZombies)
+            throws ItemNotFoundException, RepositoryException {
+        // check cache first
+        Path[] paths;
+        if (includeZombies) {
+            paths = (Path[]) zombiePathCache.get(id);
+            if (paths != null) {
+                return paths;
+            }
+            paths = delegatee.getAllPaths(id, includeZombies);
+            zombiePathCache.put(id, paths);
+        } else {
+            paths = (Path[]) pathCache.get(id);
+            if (paths != null) {
+                return paths;
+            }
+            paths = delegatee.getAllPaths(id, includeZombies);
+            pathCache.put(id, paths);
+        }
+        return paths;
+    }
+}
+

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/ItemImpl.java	Tue Nov 
2 07:06:44 2004
@@ -1023,133 +1023,144 @@
         // check state of this instance
         checkItemState();
 
-        // build list of transient states that should be persisted
-        Collection dirty = getTransientStates();
-        if (dirty.size() == 0) {
-            // no transient items, nothing to do here
-            return;
-        }
+        try {
+            /**
+             * turn on temporary path caching for better performance
+             * (assuming that the paths won't change during the save() call)
+             */
+            itemStateMgr.enablePathCaching(true);
 
-        ItemState transientState;
+            // build list of transient states that should be persisted
+            Collection dirty = getTransientStates();
+            if (dirty.size() == 0) {
+                // no transient items, nothing to do here
+                return;
+            }
 
-        /**
-         * check that parent node is also included in the dirty items list
-         * if dirty node was removed or added (adding/removing a parent/child
-         * link requires that both parent and child are saved)
-         */
-        Iterator iter = dirty.iterator();
-        while (iter.hasNext()) {
-            transientState = (ItemState) iter.next();
-            if (transientState.isNode()) {
-                NodeState nodeState = (NodeState) transientState;
-                ArrayList dirtyParents = new ArrayList();
-                // removed parents
-                dirtyParents.addAll(nodeState.getRemovedParentUUIDs());
-                // added parents
-                dirtyParents.addAll(nodeState.getAddedParentUUIDs());
-                Iterator parentsIter = dirtyParents.iterator();
-                while (parentsIter.hasNext()) {
-                    NodeId id = new NodeId((String) parentsIter.next());
-                    NodeState parentState = null;
-                    try {
-                        parentState = (NodeState) itemStateMgr.getTransientItemState(id);
-                    } catch (ItemStateException ise) {
-                        // should never get here...
-                        String msg = "inconsistency: failed to retrieve transient state for
" + itemMgr.safeGetJCRPath(id);
-                        log.error(msg);
-                        throw new RepositoryException(msg);
-                    }
-                    // check if parent is also going to be saved
-                    if (!dirty.contains(parentState)) {
-                        // need to save the parent too
-                        String msg = itemMgr.safeGetJCRPath(id) + " needs to be saved also.";
-                        log.error(msg);
-                        throw new RepositoryException(msg);
+            ItemState transientState;
+
+            /**
+             * check that parent node is also included in the dirty items list
+             * if dirty node was removed or added (adding/removing a parent/child
+             * link requires that both parent and child are saved)
+             */
+            Iterator iter = dirty.iterator();
+            while (iter.hasNext()) {
+                transientState = (ItemState) iter.next();
+                if (transientState.isNode()) {
+                    NodeState nodeState = (NodeState) transientState;
+                    ArrayList dirtyParents = new ArrayList();
+                    // removed parents
+                    dirtyParents.addAll(nodeState.getRemovedParentUUIDs());
+                    // added parents
+                    dirtyParents.addAll(nodeState.getAddedParentUUIDs());
+                    Iterator parentsIter = dirtyParents.iterator();
+                    while (parentsIter.hasNext()) {
+                        NodeId id = new NodeId((String) parentsIter.next());
+                        NodeState parentState = null;
+                        try {
+                            parentState = (NodeState) itemStateMgr.getTransientItemState(id);
+                        } catch (ItemStateException ise) {
+                            // should never get here...
+                            String msg = "inconsistency: failed to retrieve transient state
for " + itemMgr.safeGetJCRPath(id);
+                            log.error(msg);
+                            throw new RepositoryException(msg);
+                        }
+                        // check if parent is also going to be saved
+                        if (!dirty.contains(parentState)) {
+                            // need to save the parent too
+                            String msg = itemMgr.safeGetJCRPath(id) + " needs to be saved
also.";
+                            log.error(msg);
+                            throw new RepositoryException(msg);
+                        }
                     }
                 }
             }
-        }
 
-        /**
-         * validate access and node type constraints
-         * (this will also validate child removals)
-         */
-        validateTransientItems(dirty.iterator());
-
-        WorkspaceImpl wsp = (WorkspaceImpl) session.getWorkspace();
-
-        // list of events that are generated by saved changes
-        ObservationManagerFactory obsFactory = rep.getObservationManagerFactory(wsp.getName());
-        EventStateCollection events = obsFactory.createEventStateCollection(session,
-                session.getItemStateManager(), session.getHierarchyManager());
-
-        /**
-         * we need to make sure that we are not interrupted while
-         * verifying/persisting node references
-         */
-        ReferenceManager refMgr = wsp.getReferenceManager();
-        synchronized (refMgr) {
             /**
-             * build list of transient descendents in the attic
-             * (i.e. those marked as 'removed')
+             * validate access and node type constraints
+             * (this will also validate child removals)
              */
-            Collection removed = getRemovedStates();
+            validateTransientItems(dirty.iterator());
 
-            /**
-             * referential integrity checks:
-             * make sure that a referenced node cannot be removed and
-             * that all references are updated and persisted
-             */
-            checkReferences(dirty.iterator(), removed.iterator(), refMgr);
+            WorkspaceImpl wsp = (WorkspaceImpl) session.getWorkspace();
+
+            // list of events that are generated by saved changes
+            ObservationManagerFactory obsFactory = rep.getObservationManagerFactory(wsp.getName());
+            EventStateCollection events = obsFactory.createEventStateCollection(session,
+                    session.getItemStateManager(), session.getHierarchyManager());
 
             /**
-             * create event states for the affected item states and
-             * prepare them for event dispatch (this step is necessary in order
-             * to check access rights on items that will be removed)
-             *
-             * todo consolidate event generating and dispatching code (ideally one method
call after save has succeeded)
+             * we need to make sure that we are not interrupted while
+             * verifying/persisting node references
              */
-            events.createEventStates(dirty);
-            events.createEventStates(removed);
-            events.prepare();
+            ReferenceManager refMgr = wsp.getReferenceManager();
+            synchronized (refMgr) {
+                /**
+                 * build list of transient descendents in the attic
+                 * (i.e. those marked as 'removed')
+                 */
+                Collection removed = getRemovedStates();
 
-            // definitively remove transient items marked as 'removed'
-            removeTransientItems(removed.iterator());
+                /**
+                 * referential integrity checks:
+                 * make sure that a referenced node cannot be removed and
+                 * that all references are updated and persisted
+                 */
+                checkReferences(dirty.iterator(), removed.iterator(), refMgr);
 
-            // dispose the transient states marked 'removed'
-            iter = removed.iterator();
-            while (iter.hasNext()) {
-                transientState = (ItemState) iter.next();
                 /**
-                 * dispose the transient state, it is no longer used
-                 * this will indirectly (through stateDiscarded listener method)
-                 * permanently invalidate the wrapping Item instance
+                 * create event states for the affected item states and
+                 * prepare them for event dispatch (this step is necessary in order
+                 * to check access rights on items that will be removed)
+                 *
+                 * todo consolidate event generating and dispatching code (ideally one method
call after save has succeeded)
                  */
-                itemStateMgr.disposeTransientItemStateInAttic(transientState);
-            }
+                events.createEventStates(dirty);
+                events.createEventStates(removed);
+                events.prepare();
+
+                // definitively remove transient items marked as 'removed'
+                removeTransientItems(removed.iterator());
+
+                // dispose the transient states marked 'removed'
+                iter = removed.iterator();
+                while (iter.hasNext()) {
+                    transientState = (ItemState) iter.next();
+                    /**
+                     * dispose the transient state, it is no longer used
+                     * this will indirectly (through stateDiscarded listener method)
+                     * permanently invalidate the wrapping Item instance
+                     */
+                    itemStateMgr.disposeTransientItemStateInAttic(transientState);
+                }
 
-            // initialize version histories for new nodes (might create new transient state)
-            initVersionHistories(dirty.iterator());
+                // initialize version histories for new nodes (might create new transient
state)
+                initVersionHistories(dirty.iterator());
 
-            // re-build the list of transient states (might have changed by now)
-            dirty = getTransientStates();
+                // re-build the list of transient states (might have changed by now)
+                dirty = getTransientStates();
 
-            // persist 'new' or 'modified' transient states
-            persistTransientItems(dirty.iterator());
-        } // synchronized(refMgr)
-
-        // now it is safe to dispose the transient states
-        iter = dirty.iterator();
-        while (iter.hasNext()) {
-            transientState = (ItemState) iter.next();
-            // dispose the transient state, it is no longer used
-            itemStateMgr.disposeTransientItemState(transientState);
-        }
+                // persist 'new' or 'modified' transient states
+                persistTransientItems(dirty.iterator());
+            } // synchronized(refMgr)
 
-        // all changes are persisted, now dispatch events
-        // forward this to the session to let it decide on the right time for those
-        // events to be dispatched in case of transactional support
-        session.dispatch(events);
+            // now it is safe to dispose the transient states
+            iter = dirty.iterator();
+            while (iter.hasNext()) {
+                transientState = (ItemState) iter.next();
+                // dispose the transient state, it is no longer used
+                itemStateMgr.disposeTransientItemState(transientState);
+            }
+
+            // all changes are persisted, now dispatch events
+            // forward this to the session to let it decide on the right time for those
+            // events to be dispatched in case of transactional support
+            session.dispatch(events);
+        } finally {
+            // turn off temporary path caching
+            itemStateMgr.enablePathCaching(false);
+        }
     }
 
     /**

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Tue Nov  2 07:06:44 2004
@@ -33,7 +33,7 @@
     private final PersistentItemStateProvider persistentStateMgr;
     private VirtualItemStateProvider[] virtualProviders = new VirtualItemStateProvider[0];
     private final TransientItemStateManager transientStateMgr;
-    private final HierarchyManager hierMgr;
+    private HierarchyManager hierMgr;
 
     /**
      * Creates a new <code>SessionItemStateManager</code> instance.
@@ -51,11 +51,37 @@
     }
 
     /**
+     * En-/Disable chaching of path values.
+     * <p/>
+     * Please keep in mind that the cache of <code>Path</code>s is not automatically
+     * updated when the underlying hierarchy is changing. Therefore it should only be
+     * turned on with caution and in special situations (usually only locally
+     * within a narrow scope) where the underlying hierarchy is not expected to
+     * change.
+     *
+     * @param enable
+     */
+    public void enablePathCaching(boolean enable) {
+        if (enable) {
+            if (!(hierMgr instanceof CachingHierarchyManager)) {
+                hierMgr = new CachingHierarchyManager(hierMgr);
+            }
+        } else {
+            if (hierMgr instanceof CachingHierarchyManager) {
+                CachingHierarchyManager chm = (CachingHierarchyManager) hierMgr;
+                chm.clearCache();
+                hierMgr = chm.unwrap();
+            }
+        }
+    }
+
+    /**
      * Adds a new virtual item state provider
+     *
      * @param prov
      */
     public synchronized void addVirtualItemStateProvider(VirtualItemStateProvider prov) {
-        VirtualItemStateProvider[] provs = new VirtualItemStateProvider[virtualProviders.length+1];
+        VirtualItemStateProvider[] provs = new VirtualItemStateProvider[virtualProviders.length
+ 1];
         System.arraycopy(virtualProviders, 0, provs, 0, virtualProviders.length);
         provs[virtualProviders.length] = prov;
         virtualProviders = provs;
@@ -186,7 +212,7 @@
     public ItemState getItemState(ItemId id)
             throws NoSuchItemStateException, ItemStateException {
         // check if there is a virtual state for the specified item
-        for (int i=0; i<virtualProviders.length; i++) {
+        for (int i = 0; i < virtualProviders.length; i++) {
             if (virtualProviders[i].hasItemState(id)) {
                 return virtualProviders[i].getItemState(id);
             }
@@ -229,11 +255,12 @@
 
     /**
      * Checks if there is a virtual item state
+     *
      * @param id
      * @return
      */
     private boolean hasVirtualItemState(ItemId id) {
-        for (int i=0; i<virtualProviders.length; i++) {
+        for (int i = 0; i < virtualProviders.length; i++) {
             if (virtualProviders[i].hasItemState(id)) {
                 return true;
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/TransientItemStateManager.java
Tue Nov  2 07:06:44 2004
@@ -118,12 +118,7 @@
      * @see ItemStateProvider#hasItemState(ItemId)
      */
     public boolean hasItemState(ItemId id) {
-        try {
-            getItemState(id);
-            return true;
-        } catch (ItemStateException ise) {
-            return false;
-        }
+        return isCached(id);
     }
 
     /**
@@ -143,12 +138,7 @@
      * @see ItemStateProvider#hasItemStateInAttic(ItemId)
      */
     public boolean hasItemStateInAttic(ItemId id) {
-        try {
-            getItemStateInAttic(id);
-            return true;
-        } catch (ItemStateException ise) {
-            return false;
-        }
+        return attic.isCached(id);
     }
 
     //------------------< methods for listing & querying state of cache/attic >

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionalItemStateManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionalItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/tx/TransactionalItemStateManager.java
Tue Nov  2 07:06:44 2004
@@ -110,7 +110,6 @@
      */
     public synchronized ItemState getItemState(ItemId id)
             throws NoSuchItemStateException, ItemStateException {
-
         if (isCached(id)) {
             return retrieve(id);
         }
@@ -131,6 +130,10 @@
      * @see PersistentItemStateProvider#hasItemState
      */
     public boolean hasItemState(ItemId id) {
+        // try shortcut first
+        if (isCached(id)) {
+            return true;
+        }
         try {
             getItemState(id);
             return true;

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/virtual/DefaultItemStateProvider.java
Tue Nov  2 07:06:44 2004
@@ -15,17 +15,17 @@
  */
 package org.apache.jackrabbit.core.virtual;
 
-import org.apache.jackrabbit.core.state.*;
 import org.apache.jackrabbit.core.*;
 import org.apache.jackrabbit.core.nodetype.*;
+import org.apache.jackrabbit.core.state.*;
 import org.apache.jackrabbit.core.util.uuid.UUID;
 import org.apache.log4j.Logger;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Arrays;
 
 /**
  * This Class implements a virtual item state provider.
@@ -57,7 +57,8 @@
 
     /**
      * Creates a new item state provider.
-     * @param ntMgr the nodetype manager
+     *
+     * @param ntMgr         the nodetype manager
      * @param overlayedRoot the node state that is overlayed
      */
     public DefaultItemStateProvider(NodeTypeManagerImpl ntMgr, NodeState overlayedRoot) {
@@ -68,6 +69,7 @@
 
     /**
      * Returns the nodestate of the relative root of this provider
+     *
      * @return
      */
     public VirtualNodeState getRootState() {
@@ -79,7 +81,7 @@
      */
     public ItemState getItemState(ItemId id) throws NoSuchItemStateException {
         ItemState state = (ItemState) items.get(id);
-        if (state==null) {
+        if (state == null) {
             throw new NoSuchItemStateException(id.toString());
         }
         return state;
@@ -94,6 +96,7 @@
 
     /**
      * virtual item state provider do not have attics.
+     *
      * @throws NoSuchItemStateException always
      */
     public ItemState getItemStateInAttic(ItemId id) throws NoSuchItemStateException {
@@ -103,6 +106,7 @@
 
     /**
      * virtual item state provider do not have attics.
+     *
      * @return <code>false</code>
      */
     public boolean hasItemStateInAttic(ItemId id) {
@@ -112,6 +116,7 @@
 
     /**
      * Adds a node state
+     *
      * @param parentId
      * @param name
      * @param id
@@ -131,6 +136,7 @@
 
     /**
      * Adds a node state
+     *
      * @param parent
      * @param name
      * @param id
@@ -142,7 +148,7 @@
      */
     public VirtualNodeState addNode(VirtualNodeState parent, QName name, String id, QName
nodeTypeName, QName[] mixins)
             throws ItemStateException, RepositoryException {
-        NodeTypeImpl nodeType = nodeTypeName==null ? null : ntMgr.getNodeType(nodeTypeName);
+        NodeTypeImpl nodeType = nodeTypeName == null ? null : ntMgr.getNodeType(nodeTypeName);
         NodeDefImpl def;
         try {
             def = getApplicableChildNodeDef(parent, name, nodeType == null ? null : nodeType.getQName());
@@ -158,7 +164,7 @@
         // default properties
         VirtualNodeState ns = createChildNode(parent, name, def, nodeType, id);
         setPropertyValue(ns, ItemImpl.PROPNAME_PRIMARYTYPE, InternalValue.create(nodeType.getQName()));
-        if (mixins!=null) {
+        if (mixins != null) {
             ns.setMixinTypeNames(new HashSet(Arrays.asList(mixins)));
         }
         if (getEffectiveNodeType(ns).includesNodeType(NodeTypeRegistry.MIX_REFERENCEABLE))
{
@@ -170,6 +176,7 @@
 
     /**
      * returns the child node of the given parent
+     *
      * @param parent
      * @param name
      * @param index
@@ -178,7 +185,7 @@
      */
     public VirtualNodeState getNode(VirtualNodeState parent, QName name, int index) throws
NoSuchItemStateException {
         NodeState.ChildNodeEntry entry = parent.getChildNodeEntry(name, index);
-        if (entry==null) {
+        if (entry == null) {
             throw new NoSuchItemStateException(name.toString());
         }
         return (VirtualNodeState) getItemState(new NodeId(entry.getUUID()));
@@ -286,6 +293,7 @@
 
     /**
      * Creates a property state
+     *
      * @param parentUUID
      * @param propName
      * @return
@@ -305,6 +313,7 @@
         return propState;
 
     }
+
     /**
      * retrieves the property definition for the given contraints
      *

Mime
View raw message