jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1166318 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/j...
Date Wed, 07 Sep 2011 19:04:45 GMT
Author: mduerig
Date: Wed Sep  7 19:04:44 2011
New Revision: 1166318

URL: http://svn.apache.org/viewvc?rev=1166318&view=rev
Log:
New changelist

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeDump.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/RepositoryImpl.java
Wed Sep  7 19:04:44 2011
@@ -43,7 +43,6 @@ import javax.naming.Reference;
 import javax.naming.Referenceable;
 import javax.naming.StringRefAddr;
 import javax.naming.spi.ObjectFactory;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
@@ -188,7 +187,8 @@ public class RepositoryImpl extends Abst
             return reference;
         }
         else {
-            throw new javax.naming.OperationNotSupportedException("Contained RepositoryConfig
needs to implement javax.naming.Referenceable");
+            throw new javax.naming.OperationNotSupportedException("Contained RepositoryConfig
needs to implement " +
+                    "javax.naming.Referenceable");
         }
     }
 
@@ -228,7 +228,7 @@ public class RepositoryImpl extends Abst
 
         @Override
         public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?>
environment)
-                throws Exception, NoSuchMethodException, InvocationTargetException {
+                throws Exception {
 
             Object res = null;
             if (obj instanceof Reference) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Wed Sep  7 19:04:44 2011
@@ -33,12 +33,10 @@ import org.apache.jackrabbit.jcr2spi.nod
 import org.apache.jackrabbit.jcr2spi.operation.Move;
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
-import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateValidator;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.SessionItemStateManager;
-import org.apache.jackrabbit.jcr2spi.state.UpdateableItemStateManager;
 import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.jcr2spi.xml.ImportHandler;
@@ -133,7 +131,7 @@ public class SessionImpl extends Abstrac
         this.config = config;
         this.sessionInfo = sessionInfo;
 
-        workspace = createWorkspaceInstance(config, sessionInfo);
+        workspace = new WorkspaceImpl(sessionInfo.getWorkspaceName(), this, config, sessionInfo);
 
         // build local name-mapping
         IdentifierResolver idResolver = new IdResolver();
@@ -146,9 +144,12 @@ public class SessionImpl extends Abstrac
         ntManager = new NodeTypeManagerImpl(workspace.getNodeTypeRegistry(), this);
         validator = new ItemStateValidator(this, getPathFactory());
 
-        itemStateManager = createSessionItemStateManager(workspace.getUpdateableItemStateManager(),
workspace.getItemStateFactory());
+        itemStateManager = new SessionItemStateManager(workspace.getUpdateableItemStateManager(),
getValidator(),
+                getQValueFactory(), workspace.getItemStateFactory(), this);
+        
         HierarchyManager hMgr = getHierarchyManager();
-        itemManager = createItemManager(hMgr);
+        ItemCache cache = new ItemCacheImpl(this.config.getItemCacheSize());
+        itemManager = new ItemManagerImpl(hMgr, this, cache);
 
         if (hMgr instanceof HierarchyManagerImpl) {
             ((HierarchyManagerImpl) hMgr).setResolver(npResolver);
@@ -707,24 +708,6 @@ public class SessionImpl extends Abstrac
         }
     }
 
-    //-------------------------------------------------------< init methods >---
-    protected WorkspaceImpl createWorkspaceInstance(RepositoryConfig config, SessionInfo
sessionInfo)
-            throws RepositoryException {
-
-        return new WorkspaceImpl(sessionInfo.getWorkspaceName(), this, config, sessionInfo);
-    }
-
-    protected SessionItemStateManager createSessionItemStateManager(UpdateableItemStateManager
workspaceStateManager,
-            ItemStateFactory isf) throws RepositoryException {
-
-        return new SessionItemStateManager(workspaceStateManager, getValidator(), getQValueFactory(),
isf, this);
-    }
-
-    protected ItemManager createItemManager(HierarchyManager hierarchyManager) {
-        ItemCache cache = new ItemCacheImpl(config.getItemCacheSize());
-        return new ItemManagerImpl(hierarchyManager, this, cache);
-    }
-
     //----------------------------------------------------< ManagerProvider >---
 
     @Override
@@ -748,7 +731,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
-    public HierarchyManager getHierarchyManager() {
+    public final HierarchyManager getHierarchyManager() {
         return workspace.getHierarchyManager();
     }
 
@@ -783,7 +766,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
-    public QValueFactory getQValueFactory() throws RepositoryException {
+    public final QValueFactory getQValueFactory() throws RepositoryException {
         return config.getRepositoryService().getQValueFactory();
     }
 
@@ -799,7 +782,7 @@ public class SessionImpl extends Abstrac
     }
 
     // TODO public for SessionImport only. review
-    public ItemStateValidator getValidator() {
+    public final ItemStateValidator getValidator() {
         return validator;
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Wed Sep  7 19:04:44 2011
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.jcr2spi;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl;
@@ -46,7 +45,6 @@ import org.apache.jackrabbit.spi.NameFac
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.QValueFactory;
-import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
@@ -104,8 +102,9 @@ public class WorkspaceImpl implements Wo
         
         this.name = name;
         this.session = session;
-        wspManager = createManager(config.getRepositoryService(), sessionInfo, session.getCacheBehaviour(),
-                session.getPollTimeout());
+
+        wspManager = new WorkspaceManager(config.getRepositoryService(), sessionInfo, session.getCacheBehaviour(),
+                session.getPollTimeout(), this.session.isSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED));
     }
 
     //----------------------------------------------------------< Workspace >---
@@ -467,24 +466,7 @@ public class WorkspaceImpl implements Wo
         return session.getValidator();
     }
 
-    //-----------------------------------------------------< initialization >---
-
-    /**
-     * Create the workspace state manager. May be overridden by subclasses.
-     *
-     * @param service the RepositoryService
-     * @param sessionInfo the SessionInfo used to create this instance.
-     * @param cacheBehaviour the desired cache behavior
-     * @param pollTimeout the desired pollTimeout.
-     * @return state manager
-     * @throws javax.jcr.RepositoryException If an error occurs
-     */
-    protected WorkspaceManager createManager(RepositoryService service, SessionInfo sessionInfo,
-            CacheBehaviour cacheBehaviour, int pollTimeout) throws RepositoryException {
-
-        return new WorkspaceManager(service, sessionInfo, cacheBehaviour,
-                pollTimeout, session.isSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED));
-    }
+    //-----------------------------------------------------< protected >---
 
     /**
      * Create the {@code LockManager}. May be overridden by subclasses.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java
Wed Sep  7 19:04:44 2011
@@ -21,16 +21,16 @@ package org.apache.jackrabbit.jcr2spi.co
  * whether the repository implementation supports observation and the behaviour
  * provided in the {@link RepositoryConfig}.
  */
-public final class CacheBehaviour {
-
-    /**
+public enum CacheBehaviour {
+    
+   /**
      * Cache maintenance is done by invalidating affected items of an operation
      * and forcing the jcr2spi implementation to reload the item states when
      * they are accessed next time. No event listener is used for cache
      * maintenance even though the repository implementation might support
      * observation.
      */
-    public static final CacheBehaviour INVALIDATE = new CacheBehaviour();
+    INVALIDATE,
 
     /**
      * Cache maintenance is done using events from the repository. After an
@@ -39,8 +39,5 @@ public final class CacheBehaviour {
      * events. This strategy requires that the repository implementation
      * supports observation.
      */
-    public static final CacheBehaviour OBSERVATION = new CacheBehaviour();
-
-    private CacheBehaviour() {
-    }
-}
+    OBSERVATION
+}
\ No newline at end of file

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeEntriesImpl.java
Wed Sep  7 19:04:44 2011
@@ -610,8 +610,8 @@ final class ChildNodeEntriesImpl impleme
                 NodeEntry ne;
                 if (val == null) {
                     ne = null;
-                } else if (val instanceof Reference) {
-                    ne = (NodeEntry) ((Reference) val).get();
+                } else if (val instanceof Reference<?>) {
+                    ne = (NodeEntry) ((Reference<?>) val).get();
                 } else {
                     ne = (NodeEntry) val;
                 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
Wed Sep  7 19:04:44 2011
@@ -41,13 +41,12 @@ import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Date;
 
 /**
  * {@code LockManagerImpl}...
@@ -715,7 +714,7 @@ public class LockManagerImpl implements 
         }
 
         @Override
-        public boolean isSessionScoped() {
+        public final boolean isSessionScoped() {
             LockInfo info = getLockInfo();
             return info != null && info.isSessionScoped();
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/BitsetENTCacheImpl.java
Wed Sep  7 19:04:44 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.jcr2spi.no
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
 import java.util.HashMap;
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
Wed Sep  7 19:04:44 2011
@@ -43,7 +43,7 @@ import java.util.TreeSet;
  * <p/>
  * Instances of {@code EffectiveNodeType} are immutable.
  */
-public class EffectiveNodeTypeImpl implements Cloneable, EffectiveNodeType {
+public class EffectiveNodeTypeImpl implements EffectiveNodeType {
     private static final Logger log = LoggerFactory.getLogger(EffectiveNodeTypeImpl.class);
 
     /** list of explicitly aggregated {i.e. merged) node types */
@@ -417,11 +417,11 @@ public class EffectiveNodeTypeImpl imple
      * @throws ConstraintViolationException
      */
     EffectiveNodeTypeImpl merge(EffectiveNodeTypeImpl other) throws ConstraintViolationException
{
-        // create a clone of this instance and perform the merge on
-        // the 'clone' to avoid a potentially inconsistent state
-        // of this instance if an exception is thrown during
-        // the merge.
-        EffectiveNodeTypeImpl copy = (EffectiveNodeTypeImpl) clone();
+        // create a copy of this instance and perform the merge on the copy to avoid a potentially
+        // inconsistent state of this instance if an exception is thrown during the merge.
+        EffectiveNodeTypeImpl copy = new EffectiveNodeTypeImpl(mergedNodeTypes, inheritedNodeTypes,
allNodeTypes,
+                namedItemDefs, unnamedItemDefs, supportedMixins);
+
         copy.internalMerge(other, false);
         return copy;
     }
@@ -598,9 +598,4 @@ public class EffectiveNodeTypeImpl imple
         }
     }
 
-    @Override
-    protected final Object clone() {
-        return new EffectiveNodeTypeImpl(mergedNodeTypes, inheritedNodeTypes, allNodeTypes,
namedItemDefs,
-                unnamedItemDefs, supportedMixins);
-    }
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
Wed Sep  7 19:04:44 2011
@@ -18,16 +18,8 @@ package org.apache.jackrabbit.jcr2spi.op
 
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.spi.NodeId;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemExistsException;
 import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
 
 /**
  * {@code Checkout}...

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
Wed Sep  7 19:04:44 2011
@@ -21,7 +21,6 @@ import org.apache.jackrabbit.jcr2spi.hie
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
-import org.apache.jackrabbit.jcr2spi.operation.Update;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
@@ -163,7 +162,7 @@ public class TransientItemStateManager i
                 }
             }
             // - collect all affected states within the scope of save/undo
-            Iterator[] its = new Iterator[] {
+            Iterator<?>[] its = new Iterator[] {
                     addedStates.iterator(),
                     removedStates.iterator(),
                     modifiedStates.iterator()

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefDiff.java
Wed Sep  7 19:04:44 2011
@@ -251,7 +251,7 @@ public class NodeTypeDefDiff {
             QPropertyDefinitionId id = entry.getKey();
             QPropertyDefinition def1 = entry.getValue();
             QPropertyDefinition def2 = newDefs.get(id);
-            PropDefDiff diff = new PropDefDiff(def1, def2);
+            PropDefDiff diff = PropDefDiff.create(def1, def2);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
             }
@@ -265,7 +265,7 @@ public class NodeTypeDefDiff {
          */
         for (Map.Entry<QPropertyDefinitionId, QPropertyDefinition> entry : newDefs.entrySet())
{
             QPropertyDefinition def = entry.getValue();
-            PropDefDiff diff = new PropDefDiff(null, def);
+            PropDefDiff diff = PropDefDiff.create(null, def);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
             }
@@ -300,7 +300,7 @@ public class NodeTypeDefDiff {
             QNodeDefinitionId id = entry1.getKey();
             QNodeDefinition def1 = entry1.getValue();
             QNodeDefinition def2 = defs2.get(id);
-            ChildNodeDefDiff diff = new ChildNodeDefDiff(def1, def2);
+            ChildNodeDefDiff diff = ChildNodeDefDiff.create(def1, def2);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
             }
@@ -314,7 +314,7 @@ public class NodeTypeDefDiff {
          */
         for (Map.Entry<QNodeDefinitionId, QNodeDefinition> entry2 : defs2.entrySet())
{
             QNodeDefinition def2 = entry2.getValue();
-            ChildNodeDefDiff diff = new ChildNodeDefDiff(null, def2);
+            ChildNodeDefDiff diff = ChildNodeDefDiff.create(null, def2);
             if (diff.getType() > maxType) {
                 maxType = diff.getType();
             }
@@ -388,7 +388,6 @@ public class NodeTypeDefDiff {
         ChildItemDefDiff(QItemDefinition oldDef, QItemDefinition newDef) {
             this.oldDef = oldDef;
             this.newDef = newDef;
-            init();
         }
 
         protected void init() {
@@ -405,10 +404,7 @@ public class NodeTypeDefDiff {
                 // removing a child item is a MAJOR change
                 type = MAJOR;
             } else {
-                /**
-                 * neither added nor removed => has to be either identical
-                 * or modified
-                 */
+                 // neither added nor removed => has to be either identical or modified
                 if (oldDef.equals(newDef)) {
                     // identical
                     type = NONE;
@@ -479,8 +475,14 @@ public class NodeTypeDefDiff {
     }
 
     public static class PropDefDiff extends ChildItemDefDiff {
+        
+        static PropDefDiff create(QPropertyDefinition oldDef, QPropertyDefinition newDef)
{
+            PropDefDiff diff = new PropDefDiff(oldDef, newDef);
+            diff.init();
+            return diff;
+        }
 
-        PropDefDiff(QPropertyDefinition oldDef, QPropertyDefinition newDef) {
+        private PropDefDiff(QPropertyDefinition oldDef, QPropertyDefinition newDef) {
             super(oldDef, newDef);
         }
 
@@ -495,12 +497,10 @@ public class NodeTypeDefDiff {
         @Override
         protected void init() {
             super.init();
-            /**
-             * only need to do comparison if base class implementation
-             * detected a non-MAJOR (i.e. TRIVIAL) modification;
-             * no need to check for additions or removals as this is already
-             * handled in base class implementation.
-             */
+             // only need to do comparison if base class implementation
+             // detected a non-MAJOR (i.e. TRIVIAL) modification;
+             // no need to check for additions or removals as this is already
+             // handled in base class implementation.
             if (isModified() && type == TRIVIAL) {
                 // check if valueConstraints were made more restrictive
                 QValueConstraint[] vca1 = getOldDef().getValueConstraints();
@@ -564,7 +564,13 @@ public class NodeTypeDefDiff {
 
     public static class ChildNodeDefDiff extends ChildItemDefDiff {
 
-        ChildNodeDefDiff(QNodeDefinition oldDef, QNodeDefinition newDef) {
+        static ChildNodeDefDiff create(QNodeDefinition oldDef, QNodeDefinition newDef) {
+            ChildNodeDefDiff diff = new ChildNodeDefDiff(oldDef, newDef);
+            diff.init();
+            return diff;
+        }
+
+        private ChildNodeDefDiff(QNodeDefinition oldDef, QNodeDefinition newDef) {
             super(oldDef, newDef);
         }
 
@@ -579,12 +585,10 @@ public class NodeTypeDefDiff {
         @Override
         protected void init() {
             super.init();
-            /**
-             * only need to do comparison if base class implementation
-             * detected a non-MAJOR (i.e. TRIVIAL) modification;
-             * no need to check for additions or removals as this is already
-             * handled in base class implementation.
-             */
+            // only need to do comparison if base class implementation
+            // detected a non-MAJOR (i.e. TRIVIAL) modification;
+            // no need to check for additions or removals as this is already
+            // handled in base class implementation.
             if (isModified() && type == TRIVIAL) {
 
                 boolean b1 = getOldDef().allowsSameNameSiblings();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeDump.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeDump.java?rev=1166318&r1=1166317&r2=1166318&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeDump.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/query/QueryTreeDump.java
Wed Sep  7 19:04:44 2011
@@ -35,28 +35,14 @@ public class QueryTreeDump implements Qu
     private int indent;
 
     /**
-     * Padding array filled with spaces
-     */
-    private static char[] PADDING = new char[255];
-
-    /**
      * The padding character: whitespace.
      */
     private static final char PADDING_CHAR = ' ';
 
-    static {
-        Arrays.fill(PADDING, PADDING_CHAR);
-    }
-
     /**
-     * Dumps the node tree to buffer.
-     * @param node the root node.
-     * @param buffer where to dump the tree.
-     * @throws RepositoryException
+     * Padding array filled with spaces
      */
-    private QueryTreeDump(QueryNode node, StringBuffer buffer) throws RepositoryException
{
-        node.accept(this, buffer);
-    }
+    private static char[] PADDING = repeat(PADDING_CHAR, 255);
 
     /**
      * Dumps a query node tree to the string {@code buffer}.
@@ -65,7 +51,7 @@ public class QueryTreeDump implements Qu
      * @throws RepositoryException
      */
     public static void dump(QueryNode node, StringBuffer buffer) throws RepositoryException
{
-        new QueryTreeDump(node, buffer);
+        node.accept(new QueryTreeDump(), buffer);
     }
 
     @Override
@@ -324,4 +310,10 @@ public class QueryTreeDump implements Qu
             buffer.append(element);
         }
     }
+
+    private static char[] repeat(char c, int count) {
+        char[] arr = new char[count];
+        Arrays.fill(arr, c);
+        return arr;
+    }
 }



Mime
View raw message