jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1164026 [7/11] - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ config/ hierarchy/ lock/ nodetype/ observation/ operation/ query/ security/ state/ util/ version/ xml/
Date Thu, 01 Sep 2011 11:52:13 GMT
Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProviderImpl.java Thu Sep  1 11:52:08 2011
@@ -38,8 +38,7 @@ import org.slf4j.LoggerFactory;
  * <code>ItemDefinitionManagerImpl</code>...
  */
 public class ItemDefinitionProviderImpl implements ItemDefinitionProvider {
-
-    private static Logger log = LoggerFactory.getLogger(ItemDefinitionProviderImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(ItemDefinitionProviderImpl.class);
 
     private final EffectiveNodeTypeProvider entProvider;
     private final RepositoryService service;
@@ -54,6 +53,7 @@ public class ItemDefinitionProviderImpl 
         this.sessionInfo = sessionInfo;
     }
 
+    @Override
     public QNodeDefinition getRootNodeDefinition() throws RepositoryException {
         if (rootNodeDefinition == null) {
             IdFactory idFactory = service.getIdFactory();
@@ -65,9 +65,10 @@ public class ItemDefinitionProviderImpl 
         return rootNodeDefinition;
     }
 
-    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames,
-                                              Name nodeName, Name ntName,
-                                              NodeId nodeId) throws RepositoryException {
+    @Override
+    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames, Name nodeName, Name ntName, NodeId nodeId)
+            throws RepositoryException {
+
         if (parentNodeTypeNames == null) {
             return getRootNodeDefinition();
         }
@@ -83,57 +84,64 @@ public class ItemDefinitionProviderImpl 
         return definition;
     }
 
+   @Override
    public QNodeDefinition getQNodeDefinition(Name[] parentNodeTypeNames, Name name, Name nodeTypeName)
             throws NoSuchNodeTypeException, ConstraintViolationException {
+
        EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
        EffectiveNodeType entTarget = getEffectiveNodeType(nodeTypeName);
        return getQNodeDefinition(ent, entTarget, name);
     }
 
-    public QNodeDefinition getQNodeDefinition(EffectiveNodeType ent, Name name, Name nodeTypeName) throws NoSuchNodeTypeException, ConstraintViolationException {
+    @Override
+    public QNodeDefinition getQNodeDefinition(EffectiveNodeType ent, Name name, Name nodeTypeName)
+            throws NoSuchNodeTypeException, ConstraintViolationException {
+
         EffectiveNodeType entTarget = getEffectiveNodeType(nodeTypeName);
         return getQNodeDefinition(ent, entTarget, name);
     }
 
-    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
-                                                      Name propertyName,
-                                                      int propertType,
-                                                      boolean isMultiValued,
-                                                      PropertyId propertyId) throws RepositoryException {
+    @Override
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames, Name propertyName, int propertyType,
+        boolean isMultiValued, PropertyId propertyId) throws RepositoryException {
+
         QPropertyDefinition definition;
         try {
             EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
-            definition = getQPropertyDefinition(ent, propertyName, propertType, isMultiValued, true);
+            definition = getQPropertyDefinition(ent, propertyName, propertyType, isMultiValued, true);
         } catch (RepositoryException e) {
-            log.debug("Cannot determine property defintion of {}: {}", propertyId, e);
+            log.debug("Cannot determine property definition of {}: {}", propertyId, e);
             definition = getPropertyDefinition(service, sessionInfo, propertyId);
         }
         return definition;
     }
 
-    public QPropertyDefinition getQPropertyDefinition(Name ntName, Name propName,
-                                                      int type, boolean multiValued)
+    @Override
+    public QPropertyDefinition getQPropertyDefinition(Name ntName, Name propName, int type, boolean multiValued)
             throws ConstraintViolationException, NoSuchNodeTypeException {
+
         EffectiveNodeType ent = entProvider.getEffectiveNodeType(ntName);
         return getQPropertyDefinition(ent, propName, type, multiValued, false);
     }
 
-    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
-                                                      Name name, int type,
-                                                      boolean multiValued)
+    @Override
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames, Name name, int type, boolean multiValued)
             throws ConstraintViolationException, NoSuchNodeTypeException {
+
         EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
         return getQPropertyDefinition(ent, name, type, multiValued, false);
     }
 
-    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames,
-                                                      Name name, int type)
+    @Override
+    public QPropertyDefinition getQPropertyDefinition(Name[] parentNodeTypeNames, Name name, int type)
             throws ConstraintViolationException, NoSuchNodeTypeException {
+
         EffectiveNodeType ent = entProvider.getEffectiveNodeType(parentNodeTypeNames);
         return getQPropertyDefinition(ent, name, type);
     }
 
     //--------------------------------------------------------------------------
+
     private EffectiveNodeType getEffectiveNodeType(Name ntName) throws NoSuchNodeTypeException {
         if (ntName != null) {
             return entProvider.getEffectiveNodeType(ntName);
@@ -150,16 +158,13 @@ public class ItemDefinitionProviderImpl 
      * @return
      * @throws ConstraintViolationException
      */
-    static QNodeDefinition getQNodeDefinition(EffectiveNodeType ent,
-                                              EffectiveNodeType entTarget,
-                                              Name name)
+    static QNodeDefinition getQNodeDefinition(EffectiveNodeType ent, EffectiveNodeType entTarget, Name name)
             throws ConstraintViolationException {
 
         // try named node definitions first
         QNodeDefinition[] defs = ent.getNamedQNodeDefinitions(name);
         if (defs != null) {
-            for (int i = 0; i < defs.length; i++) {
-                QNodeDefinition nd = defs[i];
+            for (QNodeDefinition nd : defs) {
                 // node definition with that name exists
                 if (entTarget != null && nd.getRequiredPrimaryTypes() != null) {
                     // check 'required primary types' constraint
@@ -179,8 +184,7 @@ public class ItemDefinitionProviderImpl 
         // no item with that name defined;
         // try residual node definitions
         QNodeDefinition[] nda = ent.getUnnamedQNodeDefinitions();
-        for (int i = 0; i < nda.length; i++) {
-            QNodeDefinition nd = nda[i];
+        for (QNodeDefinition nd : nda) {
             if (entTarget != null && nd.getRequiredPrimaryTypes() != null) {
                 // check 'required primary types' constraint
                 if (entTarget.includesNodeTypes(nd.getRequiredPrimaryTypes())) {
@@ -210,10 +214,9 @@ public class ItemDefinitionProviderImpl 
      * @return
      * @throws ConstraintViolationException
      */
-    private static QPropertyDefinition getQPropertyDefinition(EffectiveNodeType ent,
-                                                              Name name, int type,
-                                                              boolean multiValued, boolean throwWhenAmbiguous)
-           throws ConstraintViolationException {
+    private static QPropertyDefinition getQPropertyDefinition(EffectiveNodeType ent, Name name, int type,
+            boolean multiValued, boolean throwWhenAmbiguous) throws ConstraintViolationException {
+
         // try named property definitions first
         QPropertyDefinition[] defs = ent.getNamedQPropertyDefinitions(name);
         QPropertyDefinition match = getMatchingPropDef(defs, type, multiValued, throwWhenAmbiguous);
@@ -241,9 +244,9 @@ public class ItemDefinitionProviderImpl 
      * @return
      * @throws ConstraintViolationException
      */
-    private static QPropertyDefinition getQPropertyDefinition(EffectiveNodeType ent,
-                                                              Name name, int type)
+    private static QPropertyDefinition getQPropertyDefinition(EffectiveNodeType ent, Name name, int type)
             throws ConstraintViolationException {
+
         // try named property definitions first
         QPropertyDefinition[] defs = ent.getNamedQPropertyDefinitions(name);
         QPropertyDefinition match = getMatchingPropDef(defs, type);
@@ -265,29 +268,27 @@ public class ItemDefinitionProviderImpl 
 
     private static QPropertyDefinition getMatchingPropDef(QPropertyDefinition[] defs, int type) {
         QPropertyDefinition match = null;
-        for (int i = 0; i < defs.length; i++) {
-            QItemDefinition qDef = defs[i];
+        for (QPropertyDefinition qDef : defs) {
             if (!qDef.definesNode()) {
-                QPropertyDefinition pd = (QPropertyDefinition) qDef;
-                int reqType = pd.getRequiredType();
+                int reqType = qDef.getRequiredType();
                 // match type
                 if (reqType == PropertyType.UNDEFINED
                         || type == PropertyType.UNDEFINED
                         || reqType == type) {
                     if (match == null) {
-                        match = pd;
+                        match = qDef;
                     } else {
                         // check if this definition is a better match than
                         // the one we've already got
-                        if (match.getRequiredType() != pd.getRequiredType()) {
-                            if (match.getRequiredType() == PropertyType.UNDEFINED) {
+                        if (match.getRequiredType() == qDef.getRequiredType()) {
+                            if (match.isMultiple() && !qDef.isMultiple()) {
                                 // found better match
-                                match = pd;
+                                match = qDef;
                             }
                         } else {
-                            if (match.isMultiple() && !pd.isMultiple()) {
+                            if (match.getRequiredType() == PropertyType.UNDEFINED) {
                                 // found better match
-                                match = pd;
+                                match = qDef;
                             }
                         }
                     }
@@ -302,25 +303,27 @@ public class ItemDefinitionProviderImpl 
         return match;
     }
 
-    private static QPropertyDefinition getMatchingPropDef(QPropertyDefinition[] defs, int type,
-                                                   boolean multiValued, boolean throwWhenAmbiguous)
-        throws ConstraintViolationException {
+    private static QPropertyDefinition getMatchingPropDef(QPropertyDefinition[] defs, int type, boolean multiValued,
+            boolean throwWhenAmbiguous) throws ConstraintViolationException {
+        
         QPropertyDefinition match = null;
-        for (int i = 0; i < defs.length; i++) {
-            QItemDefinition qDef = defs[i];
+        for (QPropertyDefinition qDef : defs) {
             if (!qDef.definesNode()) {
-                QPropertyDefinition pd = (QPropertyDefinition) qDef;
-                int reqType = pd.getRequiredType();
+                int reqType = qDef.getRequiredType();
                 // match type
                 if (reqType == PropertyType.UNDEFINED
                         || type == PropertyType.UNDEFINED
                         || reqType == type) {
                     // match multiValued flag
-                    if (multiValued == pd.isMultiple()) {
+                    if (multiValued == qDef.isMultiple()) {
                         // found match
-                        if (pd.getRequiredType() != PropertyType.UNDEFINED) {
+                        if (qDef.getRequiredType() == PropertyType.UNDEFINED) {
+                            if (match == null) {
+                                match = qDef;
+                            }
+                        } else {
                             if (match != null && throwWhenAmbiguous) {
-                                throw new ConstraintViolationException("ambiguous property definitions found: " + match + " vs " + pd);
+                                throw new ConstraintViolationException("ambiguous property definitions found: " + match + " vs " + qDef);
                             }
 
                             if (match != null && match.getRequiredType() == PropertyType.STRING) {
@@ -328,14 +331,9 @@ public class ItemDefinitionProviderImpl 
                                 // then do not overwrite it. The whole reason there are multiple
                                 // potential matches is that the client did not specify the type,
                                 // thus obviously specified a String.
-                            }
-                            else {
+                            } else {
                                 // found best possible match
-                                match = pd;
-                            }
-                        } else {
-                            if (match == null) {
-                                match = pd;
+                                match = qDef;
                             }
                         }
                     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java Thu Sep  1 11:52:08 2011
@@ -35,7 +35,7 @@ import java.util.ArrayList;
  * <code>NodeTypeCache</code> implements a cache for <code>QNodeTypeDefinition</code>s
  * on a userId basis.
  */
-public class NodeTypeCache {
+public final class NodeTypeCache {
 
     /**
      * The caches per repository service instance
@@ -89,6 +89,7 @@ public class NodeTypeCache {
      */
     public Iterator<QNodeTypeDefinition> getAllDefinitions(NodeTypeStorage storage)
             throws RepositoryException {
+
         Map<Name, QNodeTypeDefinition> allNts = new HashMap<Name, QNodeTypeDefinition>();
         for (Iterator<QNodeTypeDefinition> it = storage.getAllDefinitions(); it.hasNext(); ) {
             QNodeTypeDefinition def = it.next();
@@ -113,17 +114,18 @@ public class NodeTypeCache {
      * @throws RepositoryException
      */
     public Iterator<QNodeTypeDefinition> getDefinitions(NodeTypeStorage storage, Name[] nodeTypeNames)
-            throws NoSuchNodeTypeException, RepositoryException {
+            throws RepositoryException {
+
         List<QNodeTypeDefinition> nts = new ArrayList<QNodeTypeDefinition>();
         List<Name> missing = null;
         synchronized (nodeTypes) {
-            for (int i = 0; i < nodeTypeNames.length; i++) {
-                QNodeTypeDefinition def = nodeTypes.get(nodeTypeNames[i]);
+            for (Name nodeTypeName : nodeTypeNames) {
+                QNodeTypeDefinition def = nodeTypes.get(nodeTypeName);
                 if (def == null) {
                     if (missing == null) {
                         missing = new ArrayList<Name>();
                     }
-                    missing.add(nodeTypeNames[i]);
+                    missing.add(nodeTypeName);
                 } else {
                     nts.add(def);
                 }
@@ -143,16 +145,15 @@ public class NodeTypeCache {
         return nts.iterator();
     }
 
-    public void registerNodeTypes(NodeTypeStorage storage,
-                                  QNodeTypeDefinition[] nodeTypeDefs,
-                                  boolean allowUpdate)
+    public static void registerNodeTypes(NodeTypeStorage storage, QNodeTypeDefinition[] nodeTypeDefs, boolean allowUpdate)
             throws RepositoryException {
+
         storage.registerNodeTypes(nodeTypeDefs, allowUpdate);
     }
 
-    public void unregisterNodeTypes(NodeTypeStorage storage,
-                                    Name[] nodeTypeNames)
-            throws NoSuchNodeTypeException, RepositoryException {
+    public static void unregisterNodeTypes(NodeTypeStorage storage, Name[] nodeTypeNames)
+            throws RepositoryException {
+
         storage.unregisterNodeTypes(nodeTypeNames);
     }
 
@@ -166,20 +167,31 @@ public class NodeTypeCache {
      */
     public NodeTypeStorage wrap(final NodeTypeStorage storage) {
         return new NodeTypeStorage() {
+
+            @Override
             public Iterator<QNodeTypeDefinition> getAllDefinitions() throws RepositoryException {
                 return NodeTypeCache.this.getAllDefinitions(storage);
             }
+
+            @Override
             public Iterator<QNodeTypeDefinition> getDefinitions(Name[] nodeTypeNames)
-                    throws NoSuchNodeTypeException, RepositoryException {
+                    throws RepositoryException {
+
                 return NodeTypeCache.this.getDefinitions(storage, nodeTypeNames);
             }
+
+            @Override
             public void registerNodeTypes(QNodeTypeDefinition[] nodeTypeDefs, boolean allowUpdate)
                     throws RepositoryException {
-                NodeTypeCache.this.registerNodeTypes(storage, nodeTypeDefs, allowUpdate);
+
+                NodeTypeCache.registerNodeTypes(storage, nodeTypeDefs, allowUpdate);
             }
+
+            @Override
             public void unregisterNodeTypes(Name[] nodeTypeNames)
-                    throws NoSuchNodeTypeException, RepositoryException {
-                NodeTypeCache.this.unregisterNodeTypes(storage, nodeTypeNames);
+                    throws RepositoryException {
+                
+                NodeTypeCache.unregisterNodeTypes(storage, nodeTypeNames);
             }
         };
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeDefinitionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeDefinitionProvider.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeDefinitionProvider.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeDefinitionProvider.java Thu Sep  1 11:52:08 2011
@@ -26,6 +26,5 @@ import javax.jcr.RepositoryException;
  * <code>NodeTypeDefinitionProvider</code>...
  */
 public interface NodeTypeDefinitionProvider {
-
-    public QNodeTypeDefinition getNodeTypeDefinition(Name ntName) throws NoSuchNodeTypeException, RepositoryException;
+    QNodeTypeDefinition getNodeTypeDefinition(Name ntName) throws NoSuchNodeTypeException, RepositoryException;
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java Thu Sep  1 11:52:08 2011
@@ -46,9 +46,8 @@ import org.slf4j.LoggerFactory;
 /**
  * <code>NodeTypeImpl</code> ...
  */
-public class NodeTypeImpl extends AbstractNodeType implements NodeTypeDefinition {
-
-    private static Logger log = LoggerFactory.getLogger(NodeTypeImpl.class);
+public class NodeTypeImpl extends AbstractNodeType {
+    private static final Logger log = LoggerFactory.getLogger(NodeTypeImpl.class);
 
     private final EffectiveNodeType ent;
     private final NodeTypeManagerImpl ntMgr;
@@ -66,8 +65,7 @@ public class NodeTypeImpl extends Abstra
      * @param ntMgr      the node type manager associated with this node type
      * @param mgrProvider the manager provider
      */
-    NodeTypeImpl(EffectiveNodeType ent, QNodeTypeDefinition ntd,
-                 NodeTypeManagerImpl ntMgr, ManagerProvider mgrProvider) {
+    NodeTypeImpl(EffectiveNodeType ent, QNodeTypeDefinition ntd, NodeTypeManagerImpl ntMgr, ManagerProvider mgrProvider) {
         super(ntd, ntMgr, mgrProvider.getNamePathResolver());
         this.ent = ent;
         this.ntMgr = ntMgr;
@@ -95,12 +93,10 @@ public class NodeTypeImpl extends Abstra
      */
     private QPropertyDefinition getApplicablePropDef(Name propertyName, int type, boolean multiValued)
             throws RepositoryException {
+        
         return definitionProvider().getQPropertyDefinition(ntd.getName(), propertyName, type, multiValued);
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
     public boolean isNodeType(Name nodeTypeName) {
         return ent.includesNodeType(nodeTypeName);
@@ -119,9 +115,9 @@ public class NodeTypeImpl extends Abstra
      * @throws ConstraintViolationException If a constraint is violated.
      * @throws RepositoryException If another error occurs.
      */
-    private static void checkSetPropertyValueConstraints(QPropertyDefinition def,
-                                                        QValue[] values)
-            throws ConstraintViolationException, RepositoryException {
+    private static void checkSetPropertyValueConstraints(QPropertyDefinition def, QValue[] values)
+            throws RepositoryException {
+        
         ValueConstraint.checkValueConstraints(def, values);
     }
 
@@ -130,6 +126,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeTypeDefinition#hasOrderableChildNodes()
      */
+    @Override
     public boolean hasOrderableChildNodes() {
         return ntd.hasOrderableChildNodes();
     }
@@ -139,6 +136,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#getSupertypes()
      */
+    @Override
     public NodeType[] getSupertypes() {
         Name[] ntNames = ent.getInheritedNodeTypes();
         NodeType[] supertypes = new NodeType[ntNames.length];
@@ -157,6 +155,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#getChildNodeDefinitions()
      */
+    @Override
     public NodeDefinition[] getChildNodeDefinitions() {
         QNodeDefinition[] cnda = ent.getAllQNodeDefinitions();
         NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
@@ -169,6 +168,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#getPropertyDefinitions()
      */
+    @Override
     public PropertyDefinition[] getPropertyDefinitions() {
         QPropertyDefinition[] pda = ent.getAllQPropertyDefinitions();
         PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
@@ -181,6 +181,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canSetProperty(String, Value)
      */
+    @Override
     public boolean canSetProperty(String propertyName, Value value) {
         if (value == null) {
             // setting a property to null is equivalent of removing it
@@ -226,6 +227,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canSetProperty(String, Value[])
      */
+    @Override
     public boolean canSetProperty(String propertyName, Value[] values) {
         if (values == null) {
             // setting a property to null is equivalent of removing it
@@ -235,14 +237,14 @@ public class NodeTypeImpl extends Abstra
             Name name = resolver().getQName(propertyName);
             // determine type of values
             int type = PropertyType.UNDEFINED;
-            for (int i = 0; i < values.length; i++) {
-                if (values[i] == null) {
+            for (Value value : values) {
+                if (value == null) {
                     // skip null values as those would be purged
                     continue;
                 }
                 if (type == PropertyType.UNDEFINED) {
-                    type = values[i].getType();
-                } else if (type != values[i].getType()) {
+                    type = value.getType();
+                } else if (type != value.getType()) {
                     // inhomogeneous types
                     return false;
                 }
@@ -275,11 +277,11 @@ public class NodeTypeImpl extends Abstra
 
             ArrayList<QValue> list = new ArrayList<QValue>();
             // convert values and compact array (purge null entries)
-            for (int i = 0; i < values.length; i++) {
-                if (values[i] != null) {
+            for (Value value : values) {
+                if (value != null) {
                     // create QValue from Value and perform
                     // type conversion as necessary
-                    Value v = ValueHelper.convert(values[i], targetType, mgrProvider.getJcrValueFactory());
+                    Value v = ValueHelper.convert(value, targetType, mgrProvider.getJcrValueFactory());
                     QValue qValue = ValueFormat.getQValue(v, resolver(), mgrProvider.getQValueFactory());
                     list.add(qValue);
                 }
@@ -298,6 +300,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canAddChildNode(String)
      */
+    @Override
     public boolean canAddChildNode(String childNodeName) {
         try {
             ent.checkAddNodeConstraints(resolver().getQName(childNodeName), definitionProvider());
@@ -313,6 +316,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canAddChildNode(String, String)
      */
+    @Override
     public boolean canAddChildNode(String childNodeName, String nodeTypeName) {
         try {
             Name ntName = resolver().getQName(nodeTypeName);
@@ -330,6 +334,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canRemoveItem(String)
      */
+    @Override
     public boolean canRemoveItem(String itemName) {
         try {
             ent.checkRemoveItemConstraints(resolver().getQName(itemName));
@@ -345,6 +350,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canRemoveNode(String)
      */
+    @Override
     public boolean canRemoveNode(String nodeName) {
         Name name;
         try {
@@ -361,6 +367,7 @@ public class NodeTypeImpl extends Abstra
     /**
      * @see javax.jcr.nodetype.NodeType#canRemoveProperty(String)
      */
+    @Override
     public boolean canRemoveProperty(String propertyName) {
         Name name;
         try {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java Thu Sep  1 11:52:08 2011
@@ -57,12 +57,13 @@ import org.slf4j.LoggerFactory;
  * A <code>NodeTypeManagerImpl</code> implements a session dependant
  * NodeTypeManager.
  */
-public class NodeTypeManagerImpl extends AbstractNodeTypeManager implements NodeTypeDefinitionProvider, NodeTypeRegistryListener {
+public class NodeTypeManagerImpl extends AbstractNodeTypeManager implements NodeTypeDefinitionProvider,
+        NodeTypeRegistryListener {
 
     /**
      * Logger instance for this class
      */
-    private static Logger log = LoggerFactory.getLogger(NodeTypeManagerImpl.class);
+    private static final Logger log = LoggerFactory.getLogger(NodeTypeManagerImpl.class);
 
     /**
      * The ManagerProvider
@@ -109,7 +110,7 @@ public class NodeTypeManagerImpl extends
         this.mgrProvider = mgrProvider;
         this.ntReg = ntReg;
         this.ntReg.addListener(this);
-        this.valueFactory = mgrProvider.getJcrValueFactory();
+        valueFactory = mgrProvider.getJcrValueFactory();
 
         // setup caches with soft references to node type
         ntCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
@@ -122,9 +123,7 @@ public class NodeTypeManagerImpl extends
     }
 
     //--------------------------------------------------------------------------
-    /**
-     * @see AbstractNodeTypeManager#getNodeType(org.apache.jackrabbit.spi.Name)
-     */
+
     @Override
     public NodeTypeImpl getNodeType(Name name) throws NoSuchNodeTypeException {
         synchronized (ntCache) {
@@ -139,9 +138,6 @@ public class NodeTypeManagerImpl extends
         }
     }
 
-    /**
-     * @see org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeTypeManager#getNamePathResolver()
-     */
     @Override
     public NamePathResolver getNamePathResolver() {
         return mgrProvider.getNamePathResolver();
@@ -206,25 +202,21 @@ public class NodeTypeManagerImpl extends
     }
 
     //-----------------------------------------< NodeTypeDefinitionProvider >---
-    /**
-     * @see NodeTypeDefinitionProvider#getNodeTypeDefinition(org.apache.jackrabbit.spi.Name)
-     */
-    public QNodeTypeDefinition getNodeTypeDefinition(Name ntName) throws NoSuchNodeTypeException, RepositoryException {
+
+    @Override
+    public QNodeTypeDefinition getNodeTypeDefinition(Name ntName) throws RepositoryException {
         NodeTypeImpl nt = getNodeType(ntName);
         return nt.getDefinition();
     }
 
     //-------------------------------------------< NodeTypeRegistryListener >---
-    /**
-     * {@inheritDoc}
-     */
+
+    @Override
     public void nodeTypeRegistered(Name ntName) {
         // not interested, ignore
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void nodeTypeReRegistered(Name ntName) {
         // flush all affected cache entries
         ntCache.remove(ntName);
@@ -259,9 +251,7 @@ public class NodeTypeManagerImpl extends
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void nodeTypeUnregistered(Name ntName) {
         // flush all affected cache entries
         ntCache.remove(ntName);
@@ -297,9 +287,8 @@ public class NodeTypeManagerImpl extends
     }
 
     //----------------------------------------------------< NodeTypeManager >---
-    /**
-     * {@inheritDoc}
-     */
+
+    @Override
     public NodeTypeIterator getAllNodeTypes() throws RepositoryException {
         Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList<NodeType> list = new ArrayList<NodeType>(ntNames.length);
@@ -309,9 +298,7 @@ public class NodeTypeManagerImpl extends
         return new NodeTypeIteratorAdapter(list);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public NodeTypeIterator getPrimaryNodeTypes() throws RepositoryException {
         Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList<NodeType> list = new ArrayList<NodeType>(ntNames.length);
@@ -324,9 +311,7 @@ public class NodeTypeManagerImpl extends
         return new NodeTypeIteratorAdapter(list);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public NodeTypeIterator getMixinNodeTypes() throws RepositoryException {
         Name[] ntNames = ntReg.getRegisteredNodeTypes();
         ArrayList<NodeType> list = new ArrayList<NodeType>(ntNames.length);
@@ -339,9 +324,7 @@ public class NodeTypeManagerImpl extends
         return new NodeTypeIteratorAdapter(list);
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public NodeType getNodeType(String nodeTypeName)
             throws NoSuchNodeTypeException {
         try {
@@ -357,6 +340,7 @@ public class NodeTypeManagerImpl extends
     /**
      * @see NodeTypeManager#hasNodeType(String)
      */
+    @Override
     public boolean hasNodeType(String name) throws RepositoryException {
         try {
             Name qName = getNamePathResolver().getQName(name);
@@ -371,11 +355,14 @@ public class NodeTypeManagerImpl extends
     /**
      * @see NodeTypeManager#registerNodeTypes(javax.jcr.nodetype.NodeTypeDefinition[], boolean)
      */
+    @Override
     public NodeTypeIterator registerNodeTypes(NodeTypeDefinition[] ntds, boolean allowUpdate)
             throws RepositoryException {
         List<QNodeTypeDefinition> defs = new ArrayList<QNodeTypeDefinition>(ntds.length);
         for (NodeTypeDefinition definition : ntds) {
-            QNodeTypeDefinition qdef = new QNodeTypeDefinitionImpl(definition, getNamePathResolver(), mgrProvider.getQValueFactory());
+            QNodeTypeDefinition qdef = new QNodeTypeDefinitionImpl(definition, getNamePathResolver(),
+                    mgrProvider.getQValueFactory());
+            
             if (!allowUpdate && hasNodeType(qdef.getName())) {
                 throw new NodeTypeExistsException("NodeType " + definition.getName() + " already exists.");
             }
@@ -395,6 +382,7 @@ public class NodeTypeManagerImpl extends
     /**
      * @see NodeTypeManager#unregisterNodeTypes(String[])
      */
+    @Override
     public void unregisterNodeTypes(String[] names) throws RepositoryException {
         HashSet<Name> ntNames = new HashSet<Name>();
         for (String name : names) {
@@ -410,28 +398,31 @@ public class NodeTypeManagerImpl extends
      */
     public String toString() {
         StringBuilder builder = new StringBuilder();
-        builder.append("NodeTypeManager (" + super.toString() + ")\n");
+        builder.append("NodeTypeManager (").append(super.toString()).append(")\n");
         builder.append("All NodeTypes:\n");
         try {
-            NodeTypeIterator iter = this.getAllNodeTypes();
+            NodeTypeIterator iter = getAllNodeTypes();
             while (iter.hasNext()) {
                 NodeType nt = iter.nextNodeType();
                 builder.append(nt.getName());
                 builder.append("\n\tSupertypes");
                 for (NodeType supertype : nt.getSupertypes()) {
-                    builder.append("\n\t\t" + supertype.getName());
+                    builder.append("\n\t\t").append(supertype.getName());
                 }
-                builder.append("\n\tMixin\t" + nt.isMixin());
-                builder.append("\n\tOrderableChildNodes\t" + nt.hasOrderableChildNodes());
-                builder.append("\n\tPrimaryItemName\t" + (nt.getPrimaryItemName() == null ? "<null>" : nt.getPrimaryItemName()));
+                builder.append("\n\tMixin\t").append(nt.isMixin());
+                builder.append("\n\tOrderableChildNodes\t").append(nt.hasOrderableChildNodes());
+                builder.append("\n\tPrimaryItemName\t").append(nt.getPrimaryItemName() == null
+                    ? "<null>"
+                    : nt.getPrimaryItemName());
+                
                 for (PropertyDefinition aPd : nt.getPropertyDefinitions()) {
                     builder.append("\n\tPropertyDefinition");
-                    builder.append(" (declared in " + aPd.getDeclaringNodeType().getName() + ") ");
-                    builder.append("\n\t\tName\t\t" + (aPd.getName()));
+                    builder.append(" (declared in ").append(aPd.getDeclaringNodeType().getName()).append(") ");
+                    builder.append("\n\t\tName\t\t").append(aPd.getName());
                     String type = aPd.getRequiredType() == 0 ? "null" : PropertyType.nameFromValue(aPd.getRequiredType());
-                    builder.append("\n\t\tRequiredType\t" + type);
+                    builder.append("\n\t\tRequiredType\t").append(type);
                     String[] vca = aPd.getValueConstraints();
-                    StringBuffer constraints = new StringBuffer();
+                    StringBuilder constraints = new StringBuilder();
                     if (vca == null) {
                         constraints.append("<null>");
                     } else {
@@ -442,9 +433,9 @@ public class NodeTypeManagerImpl extends
                             constraints.append(aVca);
                         }
                     }
-                    builder.append("\n\t\tValueConstraints\t" + constraints.toString());
+                    builder.append("\n\t\tValueConstraints\t").append(constraints.toString());
                     Value[] defVals = aPd.getDefaultValues();
-                    StringBuffer defaultValues = new StringBuffer();
+                    StringBuilder defaultValues = new StringBuilder();
                     if (defVals == null) {
                         defaultValues.append("<null>");
                     } else {
@@ -455,32 +446,32 @@ public class NodeTypeManagerImpl extends
                             defaultValues.append(defVal.getString());
                         }
                     }
-                    builder.append("\n\t\tDefaultValue\t" + defaultValues.toString());
-                    builder.append("\n\t\tAutoCreated\t" + aPd.isAutoCreated());
-                    builder.append("\n\t\tMandatory\t" + aPd.isMandatory());
-                    builder.append("\n\t\tOnVersion\t" + OnParentVersionAction.nameFromValue(aPd.getOnParentVersion()));
-                    builder.append("\n\t\tProtected\t" + aPd.isProtected());
-                    builder.append("\n\t\tMultiple\t" + aPd.isMultiple());
+                    builder.append("\n\t\tDefaultValue\t").append(defaultValues.toString());
+                    builder.append("\n\t\tAutoCreated\t").append(aPd.isAutoCreated());
+                    builder.append("\n\t\tMandatory\t").append(aPd.isMandatory());
+                    builder.append("\n\t\tOnVersion\t").append(OnParentVersionAction.nameFromValue(aPd.getOnParentVersion()));
+                    builder.append("\n\t\tProtected\t").append(aPd.isProtected());
+                    builder.append("\n\t\tMultiple\t").append(aPd.isMultiple());
                 }
                 for (NodeDefinition aNd : nt.getChildNodeDefinitions()) {
                     builder.append("\n\tNodeDefinition");
-                    builder.append(" (declared in " + aNd.getDeclaringNodeType() + ") ");
-                    builder.append("\n\t\tName\t\t" + aNd.getName());
+                    builder.append(" (declared in ").append(aNd.getDeclaringNodeType()).append(") ");
+                    builder.append("\n\t\tName\t\t").append(aNd.getName());
                     NodeType[] reqPrimaryTypes = aNd.getRequiredPrimaryTypes();
                     if (reqPrimaryTypes != null && reqPrimaryTypes.length > 0) {
                         for (NodeType reqPrimaryType : reqPrimaryTypes) {
-                            builder.append("\n\t\tRequiredPrimaryType\t" + reqPrimaryType.getName());
+                            builder.append("\n\t\tRequiredPrimaryType\t").append(reqPrimaryType.getName());
                         }
                     }
                     NodeType defPrimaryType = aNd.getDefaultPrimaryType();
                     if (defPrimaryType != null) {
-                        builder.append("\n\t\tDefaultPrimaryType\t" + defPrimaryType.getName());
+                        builder.append("\n\t\tDefaultPrimaryType\t").append(defPrimaryType.getName());
                     }
-                    builder.append("\n\t\tAutoCreated\t" + aNd.isAutoCreated());
-                    builder.append("\n\t\tMandatory\t" + aNd.isMandatory());
-                    builder.append("\n\t\tOnVersion\t" + OnParentVersionAction.nameFromValue(aNd.getOnParentVersion()));
-                    builder.append("\n\t\tProtected\t" + aNd.isProtected());
-                    builder.append("\n\t\tAllowsSameNameSiblings\t" + aNd.allowsSameNameSiblings());
+                    builder.append("\n\t\tAutoCreated\t").append(aNd.isAutoCreated());
+                    builder.append("\n\t\tMandatory\t").append(aNd.isMandatory());
+                    builder.append("\n\t\tOnVersion\t").append(OnParentVersionAction.nameFromValue(aNd.getOnParentVersion()));
+                    builder.append("\n\t\tProtected\t").append(aNd.isProtected());
+                    builder.append("\n\t\tAllowsSameNameSiblings\t").append(aNd.allowsSameNameSiblings());
                 }
             }
         } catch (RepositoryException e) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistry.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistry.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistry.java Thu Sep  1 11:52:08 2011
@@ -69,7 +69,7 @@ public interface NodeTypeRegistry {
      *
      * @return the names of all registered node types.
      */
-    public Name[] getRegisteredNodeTypes() throws RepositoryException;
+    Name[] getRegisteredNodeTypes() throws RepositoryException;
 
     /**
      * Registers the specified node type definitions. If <code>allowUpdate</code>
@@ -82,7 +82,8 @@ public interface NodeTypeRegistry {
      * @throws InvalidNodeTypeDefinitionException
      * @throws RepositoryException
      */
-    public void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs, boolean allowUpdate) throws NodeTypeExistsException, InvalidNodeTypeDefinitionException, RepositoryException;
+    void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs, boolean allowUpdate)
+            throws NodeTypeExistsException, InvalidNodeTypeDefinitionException, RepositoryException;
 
     /**
      * Unregisters a collection of node types.
@@ -93,6 +94,6 @@ public interface NodeTypeRegistry {
      *                                 denote a registered node type.
      * @throws RepositoryException if another error occurs
      */
-    public void unregisterNodeTypes(Collection<Name> nodeTypeNames)
-        throws NoSuchNodeTypeException, RepositoryException;
+    void unregisterNodeTypes(Collection<Name> nodeTypeNames)
+            throws NoSuchNodeTypeException, RepositoryException;
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryImpl.java Thu Sep  1 11:52:08 2011
@@ -54,13 +54,12 @@ import org.slf4j.LoggerFactory;
  * A <code>NodeTypeRegistry</code> ...
  */
 public class NodeTypeRegistryImpl implements NodeTypeRegistry, EffectiveNodeTypeProvider {
+    private static final Logger log = LoggerFactory.getLogger(NodeTypeRegistryImpl.class);
 
-    private static Logger log = LoggerFactory.getLogger(NodeTypeRegistryImpl.class);
-
-    // cache of pre-built aggregations of node types
+    /** cache of pre-built aggregations of node types */
     private final EffectiveNodeTypeCache entCache;
 
-    // map of node type names and node type definitions
+    /** map of node type names and node type definitions */
     private final NodeTypeDefinitionMap registeredNTDefs;
 
     /**
@@ -77,7 +76,8 @@ public class NodeTypeRegistryImpl implem
      * Listeners (soft references)
      */
     @SuppressWarnings("unchecked")
-    private final Map<NodeTypeRegistryListener, NodeTypeRegistryListener> listeners = Collections.synchronizedMap(new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK));
+    private final Map<NodeTypeRegistryListener, NodeTypeRegistryListener> listeners =
+            Collections.synchronizedMap(new ReferenceMap(ReferenceMap.WEAK, ReferenceMap.WEAK));
 
     /**
      * Create a new <code>NodeTypeRegistry</codes>
@@ -87,8 +87,7 @@ public class NodeTypeRegistryImpl implem
      * @return <code>NodeTypeRegistry</codes> object
      */
     public static NodeTypeRegistryImpl create(NodeTypeStorage storage, NamespaceRegistry nsRegistry) {
-        NodeTypeRegistryImpl ntRegistry = new NodeTypeRegistryImpl(storage, nsRegistry);
-        return ntRegistry;
+        return new NodeTypeRegistryImpl(storage, nsRegistry);
     }
 
     /**
@@ -108,49 +107,42 @@ public class NodeTypeRegistryImpl implem
      */
     private NodeTypeRegistryImpl(NodeTypeStorage storage, NamespaceRegistry nsRegistry) {
         this.storage = storage;
-        this.validator = new DefinitionValidator(this, nsRegistry);
+        validator = new DefinitionValidator(this, nsRegistry);
 
         entCache = new BitsetENTCacheImpl();
         registeredNTDefs = new NodeTypeDefinitionMap();
     }
 
     //---------------------------------------------------< NodeTypeRegistry >---
-    /**
-     * @see NodeTypeRegistry#addListener(NodeTypeRegistryListener)
-     */
+
+    @Override
     public void addListener(NodeTypeRegistryListener listener) {
         if (!listeners.containsKey(listener)) {
             listeners.put(listener, listener);
         }
     }
 
-    /**
-     * @see NodeTypeRegistry#removeListener(NodeTypeRegistryListener)
-     */
+    @Override
     public void removeListener(NodeTypeRegistryListener listener) {
         listeners.remove(listener);
     }
 
-    /**
-     * @see NodeTypeRegistry#getRegisteredNodeTypes()
-     */
+    @Override
     public Name[] getRegisteredNodeTypes() throws RepositoryException {
         Set<Name> qNames = registeredNTDefs.keySet();
         return qNames.toArray(new Name[registeredNTDefs.size()]);
     }
 
 
-    /**
-     * @see NodeTypeRegistry#isRegistered(Name)
-     */
+    @Override
     public boolean isRegistered(Name nodeTypeName) {
         return registeredNTDefs.containsKey(nodeTypeName);
     }
 
-    /**
-     * @see NodeTypeRegistry#registerNodeTypes(Collection, boolean)
-     */
-    public synchronized void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs, boolean allowUpdate) throws NodeTypeExistsException, InvalidNodeTypeDefinitionException, RepositoryException {
+    @Override
+    public synchronized void registerNodeTypes(Collection<QNodeTypeDefinition> ntDefs, boolean allowUpdate)
+            throws RepositoryException {
+
         List<Name> added = new ArrayList<Name>();
         List<Name> modified = new ArrayList<Name>();
         for (QNodeTypeDefinition def : ntDefs) {
@@ -181,23 +173,22 @@ public class NodeTypeRegistryImpl implem
         }
     }
 
-    /**
-     * @see NodeTypeRegistry#unregisterNodeTypes(Collection)
-     */
+    @Override
     public synchronized void unregisterNodeTypes(Collection<Name> nodeTypeNames)
-            throws NoSuchNodeTypeException, RepositoryException {
+            throws RepositoryException {
+
         // do some preliminary checks
         for (Name ntName : nodeTypeNames) {
             // Best effort check for node types other than those to be
             // unregistered that depend on the given node types
             Set<Name> dependents = registeredNTDefs.getDependentNodeTypes(ntName);
             dependents.removeAll(nodeTypeNames);
-            if (dependents.size() > 0) {
-                StringBuffer msg = new StringBuffer();
+            if (!dependents.isEmpty()) {
+                StringBuilder msg = new StringBuilder();
                 msg.append(ntName).append(" can not be removed because the following node types depend on it: ");
                 for (Name name : dependents) {
                     msg.append(name);
-                    msg.append(" ");
+                    msg.append(' ');
                 }
                 throw new RepositoryException(msg.toString());
             }
@@ -217,47 +208,44 @@ public class NodeTypeRegistryImpl implem
         }
     }
 
-    /**
-     * @see NodeTypeRegistry#getNodeTypeDefinition(Name)
-     */
+    @Override
     public QNodeTypeDefinition getNodeTypeDefinition(Name nodeTypeName)
-        throws NoSuchNodeTypeException {
+            throws NoSuchNodeTypeException {
+        
         QNodeTypeDefinition def = registeredNTDefs.get(nodeTypeName);
         if (def == null) {
             throw new NoSuchNodeTypeException("Nodetype " + nodeTypeName + " doesn't exist");
         }
         return def;
     }
+
     //------------------------------------------< EffectiveNodeTypeProvider >---
-    /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name)
-     */
+    
+    @Override
     public synchronized EffectiveNodeType getEffectiveNodeType(Name ntName)
             throws NoSuchNodeTypeException {
+
         return getEffectiveNodeType(ntName, entCache, registeredNTDefs);
     }
 
-    /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[])
-     */
+    @Override
     public synchronized EffectiveNodeType getEffectiveNodeType(Name[] ntNames)
             throws ConstraintViolationException, NoSuchNodeTypeException {
+
         return getEffectiveNodeType(ntNames, entCache, registeredNTDefs);
     }
 
-    /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(Name[], Map<Name, QNodeTypeDefinition>)
-     */
+    @Override
     public EffectiveNodeType getEffectiveNodeType(Name[] ntNames, Map<Name, QNodeTypeDefinition> ntdMap)
-        throws ConstraintViolationException, NoSuchNodeTypeException {
+            throws ConstraintViolationException, NoSuchNodeTypeException {
+
         return getEffectiveNodeType(ntNames, entCache, ntdMap);
     }
 
-    /**
-     * @see EffectiveNodeTypeProvider#getEffectiveNodeType(QNodeTypeDefinition, Map<Name, QNodeTypeDefinition>)
-     */
+    @Override
     public EffectiveNodeType getEffectiveNodeType(QNodeTypeDefinition ntd, Map<Name, QNodeTypeDefinition> ntdMap)
             throws ConstraintViolationException, NoSuchNodeTypeException {
+
         TreeSet<Name> mergedNodeTypes = new TreeSet<Name>();
         TreeSet<Name> inheritedNodeTypes = new TreeSet<Name>();
         TreeSet<Name> allNodeTypes = new TreeSet<Name>();
@@ -310,16 +298,14 @@ public class NodeTypeRegistryImpl implem
                     defs = new ArrayList<QItemDefinition>();
                     namedItemDefs.put(name, defs);
                 }
-                if (defs.size() > 0) {
-                    /**
-                     * there already exists at least one definition with that
-                     * name; make sure none of them is auto-create
-                     */
+                if (!defs.isEmpty()) {
+                    // there already exists at least one definition with that
+                    // name; make sure none of them is auto-create
                     for (QItemDefinition qDef : defs) {
                         if (nd.isAutoCreated() || qDef.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
-                                    + name + "' in node type '" + ntName + "'";
+                                    + name + "' in node type '" + ntName + '\'';
                             log.debug(msg);
                             throw new ConstraintViolationException(msg);
                         }
@@ -356,16 +342,14 @@ public class NodeTypeRegistryImpl implem
                     defs = new ArrayList<QItemDefinition>();
                     namedItemDefs.put(name, defs);
                 }
-                if (defs.size() > 0) {
-                    /**
-                     * there already exists at least one definition with that
-                     * name; make sure none of them is auto-create
-                     */
+                if (!defs.isEmpty()) {
+                    // there already exists at least one definition with that
+                    // name; make sure none of them is auto-create
                     for (QItemDefinition qDef : defs) {
                         if (pd.isAutoCreated() || qDef.isAutoCreated()) {
                             // conflict
                             String msg = "There are more than one 'auto-create' item definitions for '"
-                                    + name + "' in node type '" + ntName + "'";
+                                    + name + "' in node type '" + ntName + '\'';
                             log.debug(msg);
                             throw new ConstraintViolationException(msg);
                         }
@@ -397,10 +381,9 @@ public class NodeTypeRegistryImpl implem
      * @return
      * @throws NoSuchNodeTypeException
      */
-    private EffectiveNodeType getEffectiveNodeType(Name ntName,
-                                                   EffectiveNodeTypeCache entCache,
-                                                   Map<Name, QNodeTypeDefinition> ntdCache)
-        throws NoSuchNodeTypeException {
+    private EffectiveNodeType getEffectiveNodeType(Name ntName, EffectiveNodeTypeCache entCache,
+            Map<Name, QNodeTypeDefinition> ntdCache) throws NoSuchNodeTypeException {
+
         // 1. check if effective node type has already been built
         EffectiveNodeTypeCache.Key key = entCache.getKey(new Name[]{ntName});
         EffectiveNodeType ent = entCache.get(key);
@@ -438,10 +421,9 @@ public class NodeTypeRegistryImpl implem
      * @throws ConstraintViolationException
      * @throws NoSuchNodeTypeException
      */
-    private EffectiveNodeType getEffectiveNodeType(Name[] ntNames,
-                                                   EffectiveNodeTypeCache entCache,
-                                                   Map<Name, QNodeTypeDefinition> ntdCache)
-        throws ConstraintViolationException, NoSuchNodeTypeException {
+    private EffectiveNodeType getEffectiveNodeType(Name[] ntNames, EffectiveNodeTypeCache entCache,
+            Map<Name, QNodeTypeDefinition> ntdCache) throws ConstraintViolationException, NoSuchNodeTypeException {
+
 
         EffectiveNodeTypeCache.Key key = entCache.getKey(ntNames);
         // 1. check if aggregate has already been built
@@ -476,10 +458,8 @@ public class NodeTypeRegistryImpl implem
                     // subtract the result from the temporary key
                     key = key.subtract(subKey);
                 } else {
-                    /**
-                     * no matching sub-aggregates found:
-                     * build aggregate of remaining node types through iteration
-                     */
+                    // no matching sub-aggregates found:
+                    // build aggregate of remaining node types through iteration
                     for (Name remainder : key.getNames()) {
                         QNodeTypeDefinition ntd = ntdCache.get(remainder);
                         EffectiveNodeType ent = getEffectiveNodeType(ntd, ntdCache);
@@ -507,6 +487,7 @@ public class NodeTypeRegistryImpl implem
     }
 
     //------------------------------------------------------------< private >---
+
     /**
      * Notify the listeners that a node type <code>ntName</code> has been registered.
      */
@@ -570,7 +551,7 @@ public class NodeTypeRegistryImpl implem
     }
 
     private void internalUnregister(Name name) {
-        QNodeTypeDefinition ntd = registeredNTDefs.remove(name);
+        registeredNTDefs.remove(name);
         entCache.invalidate(name);
     }
 
@@ -590,18 +571,18 @@ public class NodeTypeRegistryImpl implem
         builder.append("NodeTypeRegistry (").append(this).append(")\n");
         builder.append("Known NodeTypes:\n");
         builder.append(registeredNTDefs);
-        builder.append("\n");
+        builder.append('\n');
         builder.append(entCache);
         return builder.toString();
     }
 
     //--------------------------------------------------------< inner class >---
+    
     /**
      * Inner class representing the map of <code>QNodeTypeDefinition</code>s
      * that have been loaded yet.
      */
     private class NodeTypeDefinitionMap implements Map<Name, QNodeTypeDefinition> {
-
         // map of node type names and node type definitions
         private final ConcurrentHashMap<Name, QNodeTypeDefinition> nodetypeDefinitions =
             new ConcurrentHashMap<Name, QNodeTypeDefinition>();
@@ -650,32 +631,32 @@ public class NodeTypeRegistryImpl implem
         }
 
         //------------------------------------------------------------< Map >---
+        @Override
         public int size() {
             return nodetypeDefinitions.size();
         }
 
+        @Override
         public void clear() {
             nodetypeDefinitions.clear();
         }
 
+        @Override
         public boolean isEmpty() {
             return nodetypeDefinitions.isEmpty();
         }
 
+        @Override
         public boolean containsKey(Object key) {
-            if (!(key instanceof Name)) {
-                return false;
-            }
-            return get(key) != null;
+            return key instanceof Name && get(key) != null;
         }
 
+        @Override
         public boolean containsValue(Object value) {
-            if (!(value instanceof QNodeTypeDefinition)) {
-                return false;
-            }
-            return get(((QNodeTypeDefinition)value).getName()) != null;
+            return value instanceof QNodeTypeDefinition && get(((QNodeTypeDefinition) value).getName()) != null;
         }
 
+        @Override
         public Set<Name> keySet() {
             // to be aware of all (recently) registered nodetypes retrieve
             // complete set from the storage again and add missing / replace
@@ -689,6 +670,7 @@ public class NodeTypeRegistryImpl implem
             return getKeySet();
         }
 
+        @Override
         public Collection<QNodeTypeDefinition> values() {
             // make sure all node type definitions have been loaded.
             keySet();
@@ -696,20 +678,24 @@ public class NodeTypeRegistryImpl implem
             return getValues();
         }
 
+        @Override
         public QNodeTypeDefinition put(Name key, QNodeTypeDefinition value) {
             return nodetypeDefinitions.put(key, value);
         }
 
+        @Override
         public void putAll(Map<? extends Name, ? extends QNodeTypeDefinition> t) {
             throw new UnsupportedOperationException("Implementation missing");
         }
 
+        @Override
         public Set<Map.Entry<Name, QNodeTypeDefinition>> entrySet() {
             // make sure all node type definitions have been loaded.
             keySet();
             return nodetypeDefinitions.entrySet();
         }
 
+        @Override
         public QNodeTypeDefinition get(Object key) {
             if (!(key instanceof Name)) {
                 throw new IllegalArgumentException();
@@ -728,6 +714,7 @@ public class NodeTypeRegistryImpl implem
             return def;
         }
 
+        @Override
         public QNodeTypeDefinition remove(Object key) {
             return nodetypeDefinitions.remove(key);
         }
@@ -741,7 +728,6 @@ public class NodeTypeRegistryImpl implem
             StringBuilder builder = new StringBuilder();
             for (QNodeTypeDefinition ntd : getValues()) {
                 builder.append(ntd.getName());
-                Name[] supertypes = ntd.getSupertypes();
                 builder.append("\n\tSupertypes");
                 for (Name supertype : ntd.getSupertypes()) {
                     builder.append("\n\t\t").append(supertype);
@@ -771,7 +757,7 @@ public class NodeTypeRegistryImpl implem
                         }
                     }
                     QValue[] defVals = pd.getDefaultValues();
-                    StringBuffer defaultValues = new StringBuffer();
+                    StringBuilder defaultValues = new StringBuilder();
                     if (defVals == null) {
                         defaultValues.append("<null>");
                     } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeRegistryListener.java Thu Sep  1 11:52:08 2011
@@ -42,7 +42,7 @@ public interface NodeTypeRegistryListene
     void nodeTypeReRegistered(Name ntName);
 
     /**
-     * Called when a node type has been deregistered.
+     * Called when a node type has been de-registered.
      *
      * @param ntName name of the node type that has been unregistered
      */

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventImpl.java Thu Sep  1 11:52:08 2011
@@ -80,43 +80,34 @@ final class EventImpl implements Event {
     }
 
     //--------------------------------------------------------------< Event >---
-    /**
-     * {@inheritDoc}
-     */
+
+    @Override
     public int getType() {
         return event.getType();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public String getPath() throws RepositoryException {
         return resolver.getJCRPath(event.getPath());
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public String getUserID() {
         return event.getUserID();
     }
 
-    /**
-     * @see javax.jcr.observation.Event#getIdentifier()
-     */
-    public String getIdentifier() throws RepositoryException {
+    @Override
+    public String getIdentifier() {
         ItemId itemId = event.getItemId();
         if (itemId == null) {
             return null;
         } else {
-            NodeId nodeId = (itemId.denotesNode()) ? (NodeId) itemId : ((PropertyId) itemId).getParentId();
+            NodeId nodeId = itemId.denotesNode() ? (NodeId) itemId : ((PropertyId) itemId).getParentId();
             return idFactory.toJcrIdentifier(nodeId);
         }
     }
 
-    /**
-     * @see javax.jcr.observation.Event#getInfo()
-     */
+    @Override
     public Map<String, String> getInfo() throws RepositoryException {
         Map<String, String> jcrInfo = new HashMap<String, String>();
         for (Map.Entry<Name, QValue> entry : event.getInfo().entrySet()) {
@@ -131,21 +122,18 @@ final class EventImpl implements Event {
         return jcrInfo;
     }
 
-    /**
-     * @see javax.jcr.observation.Event#getUserData()
-     */
-    public String getUserData() throws RepositoryException {
+    @Override
+    public String getUserData() {
         return event.getUserData();
     }
 
-    /**
-     * @see javax.jcr.observation.Event#getDate()
-     */
+    @Override
     public long getDate() throws RepositoryException {
         return event.getDate();
     }
 
     //-------------------------------------------------------------< Object >---
+    
     /**
      * Returns a String representation of this <code>Event</code>.
      *
@@ -154,7 +142,7 @@ final class EventImpl implements Event {
     @Override
     public String toString() {
         if (stringValue == null) {
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             sb.append("Event: Path: ");
             try {
                 sb.append(getPath());

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventJournalImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventJournalImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventJournalImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/EventJournalImpl.java Thu Sep  1 11:52:08 2011
@@ -47,14 +47,14 @@ public class EventJournalImpl implements
 
     private final NamePathResolver resolver;
 
-    private List<Event> buffer = new LinkedList<Event>();
+    private final List<Event> buffer = new LinkedList<Event>();
 
-    private long lastTimestamp = 0;
+    private long lastTimestamp;
 
     /**
      * Current position.
      */
-    private long position = 0;
+    private long position;
 
     public EventJournalImpl(WorkspaceManager wspMgr,
                             EventFilter filter,
@@ -64,9 +64,7 @@ public class EventJournalImpl implements
         this.resolver = resolver;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void skipTo(long date) {
         // first try to skip in buffer
         while (!buffer.isEmpty()) {
@@ -88,39 +86,29 @@ public class EventJournalImpl implements
         refill();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public javax.jcr.observation.Event nextEvent() {
         return (javax.jcr.observation.Event) next();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void skip(long skipNum) {
         while (skipNum-- > 0) {
             next();
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public long getSize() {
         return -1;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public long getPosition() {
         return position;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public boolean hasNext() {
         if (buffer.isEmpty()) {
             refill();
@@ -128,9 +116,7 @@ public class EventJournalImpl implements
         return !buffer.isEmpty();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public Object next() {
         if (hasNext()) {
             position++;
@@ -141,9 +127,7 @@ public class EventJournalImpl implements
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void remove() {
         throw new UnsupportedOperationException();
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/FilteredEventIterator.java Thu Sep  1 11:52:08 2011
@@ -66,7 +66,7 @@ class FilteredEventIterator implements E
     /**
      * Current position
      */
-    private long pos = 0;
+    private long pos;
 
     /**
      * Creates a new <code>FilteredEventIterator</code>.
@@ -84,7 +84,7 @@ class FilteredEventIterator implements E
                                  EventFilter filter,
                                  NamePathResolver resolver,
                                  IdFactory idFactory) {
-        this.actualEvents = events;
+        actualEvents = events;
         this.filter = filter;
         this.isLocal = isLocal;
         this.resolver = resolver;
@@ -92,9 +92,7 @@ class FilteredEventIterator implements E
         fetchNext();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public Object next() {
         if (next == null) {
             throw new NoSuchElementException();
@@ -105,16 +103,12 @@ class FilteredEventIterator implements E
         return e;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public Event nextEvent() {
         return (Event) next();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public void skip(long skipNum) {
         while (skipNum-- > 0) {
             next();
@@ -126,13 +120,12 @@ class FilteredEventIterator implements E
      *
      * @return <code>-1</code>.
      */
+    @Override
     public long getSize() {
         return -1;
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    @Override
     public long getPosition() {
         return pos;
     }
@@ -141,6 +134,7 @@ class FilteredEventIterator implements E
      * This method is not supported.
      * Always throws a <code>UnsupportedOperationException</code>.
      */
+    @Override
     public void remove() {
         throw new UnsupportedOperationException("EventIterator.remove()");
     }
@@ -152,8 +146,9 @@ class FilteredEventIterator implements E
      *
      * @return <tt>true</tt> if the iterator has more elements.
      */
+    @Override
     public boolean hasNext() {
-        return (next != null);
+        return next != null;
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/InternalEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/InternalEventListener.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/InternalEventListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/InternalEventListener.java Thu Sep  1 11:52:08 2011
@@ -32,7 +32,7 @@ public interface InternalEventListener {
      *
      * @param eventBundle the event set received.
      */
-    public void onEvent(EventBundle eventBundle);
+    void onEvent(EventBundle eventBundle);
 
     /**
      * Returns a collection of event filters which is in use by this event
@@ -44,5 +44,5 @@ public interface InternalEventListener {
      * @return an unmodifiable collection of {@link EventFilter}s currently
      * in use by this event listener.
      */
-    public Collection<EventFilter> getEventFilters();
+    Collection<EventFilter> getEventFilters();
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/observation/ObservationManagerImpl.java Thu Sep  1 11:52:08 2011
@@ -84,21 +84,16 @@ public class ObservationManagerImpl impl
      * @param resolver   the name path resolver for this session.
      * @param ntRegistry The <code>NodeTypeRegistry</code> of the session.
      */
-    public ObservationManagerImpl(WorkspaceManager wspManager,
-                                  NamePathResolver resolver,
-                                  NodeTypeRegistry ntRegistry) {
+    public ObservationManagerImpl(WorkspaceManager wspManager, NamePathResolver resolver, NodeTypeRegistry ntRegistry) {
         this.wspManager = wspManager;
         this.resolver = resolver;
         this.ntRegistry = ntRegistry;
     }
 
-    public void addEventListener(EventListener listener,
-                                 int eventTypes,
-                                 String absPath,
-                                 boolean isDeep,
-                                 String[] uuids,
-                                 String[] nodeTypeNames,
-                                 boolean noLocal) throws RepositoryException {
+    @Override
+    public void addEventListener(EventListener listener, int eventTypes, String absPath, boolean isDeep, String[] uuids,
+            String[] nodeTypeNames, boolean noLocal) throws RepositoryException {
+        
         EventFilter filter = createEventFilter(eventTypes, absPath,
                 isDeep, uuids, nodeTypeNames, noLocal);
         synchronized (subscriptions) {
@@ -113,19 +108,21 @@ public class ObservationManagerImpl impl
         }
     }
 
+    @Override
     public void removeEventListener(EventListener listener) throws RepositoryException {
         synchronized (subscriptions) {
             if (subscriptions.remove(listener) != null) {
                 readOnlySubscriptions = null;
             }
         }
-        if (subscriptions.size() == 0) {
+        if (subscriptions.isEmpty()) {
             wspManager.removeEventListener(this);
         } else {
             wspManager.updateEventFilters();
         }
     }
 
+    @Override
     public EventListenerIterator getRegisteredEventListeners() throws RepositoryException {
         Map<EventListener, EventFilter> activeListeners;
         synchronized (subscriptions) {
@@ -135,33 +132,27 @@ public class ObservationManagerImpl impl
         return new EventListenerIteratorAdapter(activeListeners.keySet());
     }
 
-    /**
-     * @see javax.jcr.observation.ObservationManager#getEventJournal()
-     */
+    @Override
     public EventJournal getEventJournal() throws RepositoryException {
         return getEventJournal(Event.ALL_TYPES, "/", true, null, null);
     }
 
-    /**
-     * @see javax.jcr.observation.ObservationManager#getEventJournal(int, String, boolean, String[], String[])
-     */
-    public EventJournal getEventJournal(
-            int eventTypes, String absPath, boolean isDeep,
-            String[] uuid, String[] nodeTypeName)
-            throws RepositoryException {
+    @Override
+    public EventJournal getEventJournal(int eventTypes, String absPath, boolean isDeep, String[] uuid,
+            String[] nodeTypeName) throws RepositoryException {
+        
         EventFilter filter = createEventFilter(eventTypes, absPath, isDeep, uuid, nodeTypeName, false);
         return new EventJournalImpl(wspManager, filter, resolver);
     }
 
-    /**
-     * @see javax.jcr.observation.ObservationManager#setUserData(String)
-     */
+    @Override
     public void setUserData(String userData) throws RepositoryException {
         wspManager.setUserData(userData);
     }
 
     //-----------------------< InternalEventListener >--------------------------
 
+    @Override
     public Collection<EventFilter> getEventFilters() {
         List<EventFilter> filters = new ArrayList<EventFilter>();
         synchronized (subscriptions) {
@@ -171,6 +162,7 @@ public class ObservationManagerImpl impl
         return filters;
     }
 
+    @Override
     public void onEvent(EventBundle eventBundle) {
         // get active listeners
         Map<EventListener, EventFilter> activeListeners;
@@ -189,7 +181,7 @@ public class ObservationManagerImpl impl
                     listener.onEvent(eventIter);
                 } catch (Throwable t) {
                     log.warn("EventConsumer threw exception: " + t.toString());
-                    log.debug("Stacktrace: ", t);
+                    log.debug("Stack trace: ", t);
                     // move on to the next listener
                 }
             }
@@ -223,13 +215,9 @@ public class ObservationManagerImpl impl
      * @throws RepositoryException if an error occurs while creating the event
      *                             filter.
      */
-    private EventFilter createEventFilter(int eventTypes,
-                                          String absPath,
-                                          boolean isDeep,
-                                          String[] uuids,
-                                          String[] nodeTypeNames,
-                                          boolean noLocal)
-            throws RepositoryException {
+    private EventFilter createEventFilter(int eventTypes, String absPath, boolean isDeep, String[] uuids,
+            String[] nodeTypeNames, boolean noLocal) throws RepositoryException {
+
         Path path;
         try {
             path = resolver.getQPath(absPath).getCanonicalPath();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java Thu Sep  1 11:52:08 2011
@@ -30,8 +30,7 @@ import javax.jcr.RepositoryException;
  * <code>AbstractCopy</code>...
  */
 public abstract class AbstractCopy extends AbstractOperation {
-
-    private static Logger log = LoggerFactory.getLogger(AbstractCopy.class);
+    private static final Logger log = LoggerFactory.getLogger(AbstractCopy.class);
 
     final NodeState destParentState;
     private final NodeState srcState;
@@ -44,13 +43,11 @@ public abstract class AbstractCopy exten
      * @param destPath
      * @param srcMgrProvider
      */
-    AbstractCopy(Path srcPath, Path destPath, String srcWorkspaceName,
-                 ManagerProvider srcMgrProvider, ManagerProvider destMgrProvider)
-        throws RepositoryException {
-
-        NodeState srcItemState = getNodeState(srcPath, srcMgrProvider.getHierarchyManager());
-        this.srcState = srcItemState;
-        this.destParentState = getNodeState(destPath.getAncestor(1), destMgrProvider.getHierarchyManager());
+    AbstractCopy(Path srcPath, Path destPath, String srcWorkspaceName, ManagerProvider srcMgrProvider,
+            ManagerProvider destMgrProvider) throws RepositoryException {
+
+        srcState = getNodeState(srcPath, srcMgrProvider.getHierarchyManager());
+        destParentState = getNodeState(destPath.getAncestor(1), destMgrProvider.getHierarchyManager());
 
         // check for illegal index present in destination path
         int index = destPath.getIndex();
@@ -60,18 +57,20 @@ public abstract class AbstractCopy exten
             log.debug(msg);
             throw new RepositoryException(msg);
         }
-        this.destName = destPath.getName();
+        destName = destPath.getName();
         this.srcWorkspaceName = srcWorkspaceName;
 
         // NOTE: affected-states only needed for transient modifications
     }
 
     //----------------------------------------------------------< Operation >---
+
     /**
      * Invalidate the destination parent <code>NodeState</code>.
      *
      * @see Operation#persisted()
      */
+    @Override
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
@@ -79,6 +78,7 @@ public abstract class AbstractCopy exten
     }
 
     //----------------------------------------< Access Operation Parameters >---
+    
     public String getWorkspaceName() {
         return srcWorkspaceName;
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractOperation.java Thu Sep  1 11:52:08 2011
@@ -45,10 +45,12 @@ public abstract class AbstractOperation 
      * @return the class name
      * @see #getClass()
      */
+    @Override
     public String getName() {
         return getClass().getName();
     }
 
+    @Override
     public Collection<ItemState> getAffectedItemStates() {
     	if (affectedStates.isEmpty()) {
     		return Collections.emptySet();
@@ -58,11 +60,13 @@ public abstract class AbstractOperation 
     	}
     }
 
+    @Override
     public void undo() throws RepositoryException {
         assert status == STATUS_PENDING;
         throw new UnsupportedOperationException("Undo not supported.");
     }
 
+    @Override
     public int getStatus() {
         return status;
     }
@@ -77,16 +81,14 @@ public abstract class AbstractOperation 
     }
 
     /**
-     *
      * @param nodePath
-     * @param hierMgr
+     * @param hierarchyManager
      * @return
      * @throws PathNotFoundException
      * @throws RepositoryException
      */
-    protected static NodeState getNodeState(Path nodePath, HierarchyManager hierMgr) throws PathNotFoundException, RepositoryException {
-        NodeState nodeState = hierMgr.getNodeState(nodePath);
-        return nodeState;
+    protected static NodeState getNodeState(Path nodePath, HierarchyManager hierarchyManager) throws RepositoryException {
+        return hierarchyManager.getNodeState(nodePath);
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractRemove.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractRemove.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractRemove.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractRemove.java Thu Sep  1 11:52:08 2011
@@ -30,16 +30,13 @@ import javax.jcr.version.VersionExceptio
 
 /**
  * <code>AbstractRemove</code> is the base class for non-transient remove
- * operations executed on the workspace such as removing versions or activites.
+ * operations executed on the workspace such as removing versions or activities.
  */
 public abstract class AbstractRemove extends AbstractOperation {
-
-    private static Logger log = LoggerFactory.getLogger(Remove.class);
-
     protected ItemState removeState;
     protected NodeState parent;
 
-    protected AbstractRemove(ItemState removeState, NodeState parent) throws RepositoryException {
+    protected AbstractRemove(ItemState removeState, NodeState parent) {
         this.removeState = removeState;
         this.parent = parent;
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java?rev=1164026&r1=1164025&r2=1164026&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java Thu Sep  1 11:52:08 2011
@@ -37,8 +37,7 @@ import javax.jcr.version.VersionExceptio
  * <code>AddLabel</code>...
  */
 public class AddLabel extends AbstractOperation {
-
-    private static Logger log = LoggerFactory.getLogger(AddLabel.class);
+    private static final Logger log = LoggerFactory.getLogger(AddLabel.class);
 
     private final NodeState versionHistoryState;
     private final NodeState versionState;
@@ -54,6 +53,7 @@ public class AddLabel extends AbstractOp
         // NOTE: affected-states only needed for transient modifications
     }
     //----------------------------------------------------------< Operation >---
+
     /**
      *
      * @param visitor
@@ -65,18 +65,20 @@ public class AddLabel extends AbstractOp
      * @throws UnsupportedRepositoryOperationException
      * @throws VersionException
      */
-    public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+    @Override
+    public void accept(OperationVisitor visitor) throws RepositoryException {
         assert status == STATUS_PENDING;
         visitor.visit(this);
     }
 
     /**
-     * Invalidates the jcr:versionlabel nodestate present with the given
-     * version history. If '<code>moveLabel</code>' is true, all decendant states
+     * Invalidates the jcr:versionLabel node state present with the given
+     * version history. If '<code>moveLabel</code>' is true, all descendant states
      * (property states) are invalidated as well.
      *
      * @see Operation#persisted()
      */
+    @Override
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
@@ -91,6 +93,7 @@ public class AddLabel extends AbstractOp
         }
     }
     //----------------------------------------< Access Operation Parameters >---
+
     public NodeId getVersionHistoryId() throws RepositoryException {
         return versionHistoryState.getNodeEntry().getWorkspaceId();
     }
@@ -108,6 +111,7 @@ public class AddLabel extends AbstractOp
     }
 
     //------------------------------------------------------------< Factory >---
+    
     /**
      *
      * @param versionHistoryState



Mime
View raw message