jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r772992 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/ jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/ jackrab...
Date Fri, 08 May 2009 14:00:31 GMT
Author: angela
Date: Fri May  8 14:00:31 2009
New Revision: 772992

URL: http://svn.apache.org/viewvc?rev=772992&view=rev
Log:
JCR-2105: JSR 283 NodeType Management (work in progress)

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeTypeDefinitionImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
Fri May  8 14:00:31 2009
@@ -104,6 +104,28 @@
     /**
      * @param name
      * @throws ConstraintViolationException
+     * @deprecated Use {@link #hasRemoveNodeConstraint(Name)} and
+     * {@link #hasRemovePropertyConstraint(Name)} respectively.
      */
     public void checkRemoveItemConstraints(Name name) throws ConstraintViolationException;
+
+    /**
+     * Returns <code>true</code> if a single node definition matching the
+     * specified <code>nodeName</code> is either mandatory or protected.
+     *
+     * @param nodeName
+     * @return <code>true</code> if a single node definition matching the
+     * specified <code>nodeName</code> is either mandatory or protected.
+     */
+    public boolean hasRemoveNodeConstraint(Name nodeName);
+
+    /**
+     * Returns <code>true</code> if a single property definition matching the
+     * specified <code>propertyName</code> is either mandatory or protected.
+     *
+     * @param propertyName
+     * @return <code>true</code> if a single property definition matching the
+     * specified <code>propertyName</code> is either mandatory or protected.
+     */
+    public boolean hasRemovePropertyConstraint(Name propertyName);
 }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeTypeImpl.java
Fri May  8 14:00:31 2009
@@ -429,20 +429,56 @@
          * don't know which one is applicable, we check all of them
          */
         QItemDefinition[] defs = getNamedItemDefs(name);
+        if (hasRemoveConstaint(defs)) {
+            throw new ConstraintViolationException("can't remove mandatory or protected item");
+        }
+    }
+
+    /**
+     * @inheritDoc
+     * @see EffectiveNodeType#hasRemoveNodeConstraint(Name)
+     */
+    public boolean hasRemoveNodeConstraint(Name nodeName) {
+        QNodeDefinition[] defs = getNamedQNodeDefinitions(nodeName);
+        return hasRemoveConstaint(defs);
+    }
+
+    /**
+     * @inheritDoc
+     * @see EffectiveNodeType#hasRemovePropertyConstraint(Name)
+     */
+    public boolean hasRemovePropertyConstraint(Name propertyName) {
+        QPropertyDefinition[] defs = getNamedQPropertyDefinitions(propertyName);
+        return hasRemoveConstaint(defs);
+    }
+
+    //---------------------------------------------< impl. specific methods >---
+    /**
+     * Loop over the specified definitions and return <code>true</code> as soon
+     * as the first mandatory or protected definition is encountered.
+     *
+     * @param defs
+     * @return <code>true</code> if a mandatory or protected definition is present.
+     */
+    private static boolean hasRemoveConstaint(QItemDefinition[] defs) {
+        /**
+         * as there might be multiple definitions with the same name that may be
+         * applicable, return true as soon as the first mandatory or protected
+         * definition is encountered.
+         */
         if (defs != null) {
             for (int i = 0; i < defs.length; i++) {
                 if (defs[i].isMandatory()) {
-                    throw new ConstraintViolationException("can't remove mandatory item");
+                    return true;
                 }
                 if (defs[i].isProtected()) {
-                    throw new ConstraintViolationException("can't remove protected item");
+                    return true;
                 }
             }
         }
+        return false;
     }
 
-    //---------------------------------------------< impl. specific methods >---
-
     private QItemDefinition[] getNamedItemDefs() {
         if (namedItemDefs.size() == 0) {
             return QItemDefinition.EMPTY_ARRAY;

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
Fri May  8 14:00:31 2009
@@ -43,12 +43,13 @@
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
 import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.nodetype.NodeTypeDefinition;
 import java.util.ArrayList;
 
 /**
  * <code>NodeTypeImpl</code> ...
  */
-public class NodeTypeImpl implements NodeType {
+public class NodeTypeImpl implements NodeType, NodeTypeDefinition {
 
     private static Logger log = LoggerFactory.getLogger(NodeTypeImpl.class);
 
@@ -173,9 +174,9 @@
         ValueConstraint.checkValueConstraints(def, values);
     }
     
-    //-----------------------------------------------------------< NodeType >---
+    //-------------------------------------------------< NodeTypeDefinition >---
     /**
-     * @see javax.jcr.nodetype.NodeType#getName()
+     * @see javax.jcr.nodetype.NodeTypeDefinition#getName()
      */
     public String getName() {
         try {
@@ -188,7 +189,7 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#getPrimaryItemName()
+     * @see javax.jcr.nodetype.NodeTypeDefinition#getPrimaryItemName()
      */
     public String getPrimaryItemName() {
         try {
@@ -206,13 +207,78 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#isMixin()
+     * @see javax.jcr.nodetype.NodeTypeDefinition#isMixin()
      */
     public boolean isMixin() {
         return ntd.isMixin();
     }
 
     /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#hasOrderableChildNodes()
+     */
+    public boolean hasOrderableChildNodes() {
+        return ntd.hasOrderableChildNodes();
+    }
+
+    /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#isAbstract()
+     */
+    public boolean isAbstract() {
+        return ntd.isAbstract();
+    }
+
+    /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#isQueryable()
+     */
+    public boolean isQueryable() {
+        return ntd.isQueryable();
+    }
+
+    /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredPropertyDefinitions()
+     */
+    public PropertyDefinition[] getDeclaredPropertyDefinitions() {
+        QPropertyDefinition[] pda = ntd.getPropertyDefs();
+        PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
+        for (int i = 0; i < pda.length; i++) {
+            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
+        }
+        return propDefs;
+    }
+
+
+    /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredChildNodeDefinitions()
+     */
+    public NodeDefinition[] getDeclaredChildNodeDefinitions() {
+        QNodeDefinition[] cnda = ntd.getChildNodeDefs();
+        NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
+        for (int i = 0; i < cnda.length; i++) {
+            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
+        }
+        return nodeDefs;
+    }
+
+    /**
+     * @see javax.jcr.nodetype.NodeTypeDefinition#getDeclaredSupertypeNames()
+     */
+    public String[] getDeclaredSupertypeNames() {
+        Name[] stNames = ntd.getSupertypes();
+        String[] dstn = new String[stNames.length];
+        for (int i = 0; i < stNames.length; i++) {
+            try {
+                dstn[i] = resolver().getJCRName(stNames[i]);
+            } catch (NamespaceException e) {
+                // should never get here
+                log.error("invalid node type name: " + stNames[i], e);
+                dstn[i] = stNames.toString();
+            }
+        }
+        return dstn;
+    }
+
+    //-----------------------------------------------------------< NodeType >---
+    /**
      * @see javax.jcr.nodetype.NodeType#isNodeType(String)
      */
     public boolean isNodeType(String nodeTypeName) {
@@ -230,13 +296,6 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#hasOrderableChildNodes()
-     */
-    public boolean hasOrderableChildNodes() {
-        return ntd.hasOrderableChildNodes();
-    }
-
-    /**
      * @see javax.jcr.nodetype.NodeType#getSupertypes()
      */
     public NodeType[] getSupertypes() {
@@ -279,18 +338,6 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#getDeclaredPropertyDefinitions()
-     */
-    public PropertyDefinition[] getDeclaredPropertyDefinitions() {
-        QPropertyDefinition[] pda = ntd.getPropertyDefs();
-        PropertyDefinition[] propDefs = new PropertyDefinition[pda.length];
-        for (int i = 0; i < pda.length; i++) {
-            propDefs[i] = ntMgr.getPropertyDefinition(pda[i]);
-        }
-        return propDefs;
-    }
-
-    /**
      * @see javax.jcr.nodetype.NodeType#getDeclaredSupertypes()
      */
     public NodeType[] getDeclaredSupertypes() {
@@ -309,15 +356,19 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#getDeclaredChildNodeDefinitions()
+     * @see javax.jcr.nodetype.NodeType#getDeclaredSubtypes()
      */
-    public NodeDefinition[] getDeclaredChildNodeDefinitions() {
-        QNodeDefinition[] cnda = ntd.getChildNodeDefs();
-        NodeDefinition[] nodeDefs = new NodeDefinition[cnda.length];
-        for (int i = 0; i < cnda.length; i++) {
-            nodeDefs[i] = ntMgr.getNodeDefinition(cnda[i]);
-        }
-        return nodeDefs;
+    public NodeTypeIterator getDeclaredSubtypes() {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2003: Add support for JCR 2.0. Implementation
missing");
+    }
+
+    /**
+     * @see javax.jcr.nodetype.NodeType#getSubtypes()
+     */
+    public NodeTypeIterator getSubtypes() {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2003: Add support for JCR 2.0. Implementation
missing");
     }
 
     /**
@@ -487,48 +538,30 @@
      * @see javax.jcr.nodetype.NodeType#canRemoveNode(String)
      */
     public boolean canRemoveNode(String nodeName) {
-        throw new UnsupportedOperationException("JCR-1591");
+        Name name;
+        try {
+            name = resolver().getQName(nodeName);
+        } catch (RepositoryException e) {
+            // should never get here
+            log.warn("Unable to determine if there are any remove constraints for a node
with name " + nodeName);
+            return false;
+        }
+        return !ent.hasRemoveNodeConstraint(name);
+
     }
 
     /**
      * @see javax.jcr.nodetype.NodeType#canRemoveProperty(String)
      */
     public boolean canRemoveProperty(String propertyName) {
-        throw new UnsupportedOperationException("JCR-1591");
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeType#getDeclaredSubtypes()
-     */
-    public NodeTypeIterator getDeclaredSubtypes() {
-        throw new UnsupportedOperationException("JCR-1591");
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeType#getSubtypes()
-     */
-    public NodeTypeIterator getSubtypes() {
-        throw new UnsupportedOperationException("JCR-1591");
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeType#getDeclaredSupertypeNames()
-     */
-    public String[] getDeclaredSupertypeNames() {
-        throw new UnsupportedOperationException("JCR-1591");
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeType#isAbstract()
-     */
-    public boolean isAbstract() {
-        throw new UnsupportedOperationException("JCR-1591");
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeType#isQueryable()
-     */
-    public boolean isQueryable() {
-        throw new UnsupportedOperationException("JCR-1591");
+        Name name;
+        try {
+            name = resolver().getQName(propertyName);
+        } catch (RepositoryException e) {
+            // should never get here
+            log.warn("Unable to determine if there are any remove constraints for a property
with name " + propertyName);
+            return false;
+        }
+        return !ent.hasRemovePropertyConstraint(name);
     }
 }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
Fri May  8 14:00:31 2009
@@ -56,6 +56,16 @@
     private final boolean isMixin;
 
     /**
+     * Indicates whether this is an abstract node type definition.
+     */
+    private final boolean isAbstract;
+
+    /**
+     * Indicates whether this is a queryable node type definition.
+     */
+    private final boolean isQueryable;
+
+    /**
      * Indicates whether this node type definition has orderable child nodes.
      */
     private final boolean hasOrderableChildNodes;
@@ -87,7 +97,8 @@
      * @param nt the qualified node type definition.
      */
     public QNodeTypeDefinitionImpl(QNodeTypeDefinition nt) {
-        this(nt.getName(), nt.getSupertypes(), nt.isMixin(),
+        this(nt.getName(), nt.getSupertypes(), nt.getSupportedMixinTypes(),
+                nt.isMixin(), nt.isAbstract(), nt.isQueryable(),
                 nt.hasOrderableChildNodes(), nt.getPrimaryItemName(),
                 nt.getPropertyDefs(), nt.getChildNodeDefs());
     }
@@ -113,14 +124,41 @@
                                    Name primaryItemName,
                                    QPropertyDefinition[] declaredPropDefs,
                                    QNodeDefinition[] declaredNodeDefs) {
-        this.name = name;
-        this.supertypes = supertypes;
-        this.supportedMixins = null;
-        this.isMixin = isMixin;
-        this.hasOrderableChildNodes = hasOrderableChildNodes;
-        this.primaryItemName = primaryItemName;
-        this.propertyDefs = getSerializablePropertyDefs(declaredPropDefs);
-        this.childNodeDefs = getSerializableNodeDefs(declaredNodeDefs);
+        this(name, supertypes, null, isMixin, false, false,
+                hasOrderableChildNodes, primaryItemName,
+                getSerializablePropertyDefs(declaredPropDefs),
+                getSerializableNodeDefs(declaredNodeDefs));
+    }
+
+    /**
+     * Creates a new serializable qualified node type definition. Same as
+     * {@link #QNodeTypeDefinitionImpl(Name, Name[], Name[], boolean, boolean, boolean, boolean,
Name, QPropertyDefinition[], QNodeDefinition[])}
+     * but using <code>false</code> for both {@link #isAbstract()} and {@link
#isQueryable)}.
+     *
+     * @param name                   the name of the node type
+     * @param supertypes             the names of the supertypes
+     * @param supportedMixins        the names of supported mixins (or <code>null</code>)
+     * @param isMixin                if this is a mixin node type
+     * @param hasOrderableChildNodes if this node type has orderable child
+     *                               nodes.
+     * @param primaryItemName        the name of the primary item, or
+     *                               <code>null</code>.
+     * @param declaredPropDefs       the declared property definitions.
+     * @param declaredNodeDefs       the declared child node definitions.
+     *
+     */
+    public QNodeTypeDefinitionImpl(Name name,
+                                   Name[] supertypes,
+                                   Name[] supportedMixins,
+                                   boolean isMixin,
+                                   boolean hasOrderableChildNodes,
+                                   Name primaryItemName,
+                                   QPropertyDefinition[] declaredPropDefs,
+                                   QNodeDefinition[] declaredNodeDefs) {
+        this(name, supertypes, supportedMixins, isMixin, false, false,
+                hasOrderableChildNodes, primaryItemName,
+                getSerializablePropertyDefs(declaredPropDefs),
+                getSerializableNodeDefs(declaredNodeDefs));
     }
 
     /**
@@ -130,6 +168,8 @@
      * @param supertypes             the names of the supertypes
      * @param supportedMixins        the names of supported mixins (or <code>null</code>)
      * @param isMixin                if this is a mixin node type
+     * @param isAbstract             if this is an abstract node type definition.
+     * @param isQueryable            if this is a queryable node type definition.
      * @param hasOrderableChildNodes if this node type has orderable child
      *                               nodes.
      * @param primaryItemName        the name of the primary item, or
@@ -141,6 +181,8 @@
                                    Name[] supertypes,
                                    Name[] supportedMixins,
                                    boolean isMixin,
+                                   boolean isAbstract,
+                                   boolean isQueryable,
                                    boolean hasOrderableChildNodes,
                                    Name primaryItemName,
                                    QPropertyDefinition[] declaredPropDefs,
@@ -149,6 +191,8 @@
         this.supertypes = supertypes;
         this.supportedMixins = supportedMixins;
         this.isMixin = isMixin;
+        this.isAbstract = isAbstract;
+        this.isQueryable = isQueryable;
         this.hasOrderableChildNodes = hasOrderableChildNodes;
         this.primaryItemName = primaryItemName;
         this.propertyDefs = getSerializablePropertyDefs(declaredPropDefs);
@@ -181,6 +225,20 @@
     /**
      * {@inheritDoc}
      */
+    public boolean isAbstract() {
+        return isAbstract;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isQueryable() {
+        return isQueryable;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public boolean hasOrderableChildNodes() {
         return hasOrderableChildNodes;
     }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
Fri May  8 14:00:31 2009
@@ -21,6 +21,8 @@
 import org.apache.jackrabbit.spi.Name;
 
 import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * <code>QPropertyDefinitionImpl</code> implements a qualified property
@@ -234,9 +236,12 @@
             QPropertyDefinition other = (QPropertyDefinition) obj;
             return super.equals(obj)
                     && requiredType == other.getRequiredType()
+                    && multiple == other.isMultiple()
+                    && fullTextSearcheable == other.isFullTextSearcheable()
+                    && queryOrderable == other.isQueryOrderable()
                     && Arrays.equals(valueConstraints, other.getValueConstraints())
                     && Arrays.equals(defaultValues, other.getDefaultValues())
-                    && multiple == other.isMultiple();
+                    && Arrays.equals(availableQueryOperators, other.getAvailableQueryOperators());
         }
         return false;
     }
@@ -259,9 +264,20 @@
                 sb.append(getName().toString());
             }
             sb.append('/');
-            sb.append(getRequiredType());
+            sb.append(requiredType);
             sb.append('/');
-            sb.append(isMultiple() ? 1 : 0);
+            sb.append(multiple ? 1 : 0);
+            sb.append('/');
+            sb.append(fullTextSearcheable ? 1 : 0);
+            sb.append('/');
+            sb.append(queryOrderable ? 1 : 0);
+            sb.append('/');
+            Set<Name> s = new HashSet<Name>();
+            Name[] names = getAvailableQueryOperators();
+            for (int i = 0; i < names.length; i++) {
+                s.add(names[i]);
+            }
+            sb.append(s.toString());
 
             hashCode = sb.toString().hashCode();
         }

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/QNodeTypeDefinition.java
Fri May  8 14:00:31 2009
@@ -66,6 +66,22 @@
     public boolean isMixin();
 
     /**
+     * Returns <code>true</code> if the definition is abstract; <code>false</code>
otherwise.
+     *
+     * @return <code>true</code> if the definition is abstract; <code>false</code>
otherwise.
+     * @since JCR 2.0
+     */
+    public boolean isAbstract();
+
+    /**
+     * Returns <code>true</code> if the definition is queryable; <code>false</code>
otherwise.
+     *
+     * @return <code>true</code> if the definition is queryable; <code>false</code>
otherwise.
+     * @since JCR 2.0
+     */
+    public boolean isQueryable();
+
+    /**
      * Returns the value of the orderableChildNodes flag.
      *
      * @return true if nodes of this node type can have orderable child nodes; false otherwise.

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QNodeTypeDefinitionImpl.java
Fri May  8 14:00:31 2009
@@ -58,6 +58,12 @@
     private Set dependencies;
 
     /**
+     * TODO
+     */
+    private final boolean isAbstract = false;
+    private final boolean isQueryable = false;
+
+    /**
      * Default constructor.
      */
     public QNodeTypeDefinitionImpl(Element ntdElement, NamePathResolver resolver,
@@ -159,6 +165,22 @@
     }
 
     /**
+     * @see QNodeTypeDefinition#isAbstract()
+     */
+    public boolean isAbstract() {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2003 Add support for JCR 2.0. Implementation
missing");
+    }
+
+    /**
+     * @see QNodeTypeDefinition#isQueryable()
+     */
+    public boolean isQueryable() {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2003 Add support for JCR 2.0. Implementation
missing");
+    }
+
+    /**
      * @see QNodeTypeDefinition#hasOrderableChildNodes()
      */
     public boolean hasOrderableChildNodes() {
@@ -245,6 +267,8 @@
                 && (primaryItemName == null ? other.getPrimaryItemName() == null
: primaryItemName.equals(other.getPrimaryItemName()))
                 && Arrays.equals(supertypes, other.getSupertypes())
                 && mixin == other.isMixin()
+                && isAbstract == other.isAbstract()
+                && isQueryable == other.isQueryable()
                 && orderableChildNodes == other.hasOrderableChildNodes()
                 && Arrays.equals(propDefs, other.getPropertyDefs())
                 && Arrays.equals(nodeDefs, other.getChildNodeDefs());

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/QPropertyDefinitionImpl.java
Fri May  8 14:00:31 2009
@@ -33,6 +33,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
 
 /**
  * This class implements the <code>QPropertyDefinition</code> interface and additionally
@@ -61,6 +63,20 @@
     private final boolean multiple;
 
     /**
+     * TODO
+     */
+    private final Name[] availableQueryOperators = new Name[0];
+
+    /**
+     * TODO
+     */
+    private final boolean fullTextSearcheable = false;
+    /**
+     * TODO
+     */
+    private final boolean queryOrderable = false;
+
+    /**
      * Default constructor.
      */
     QPropertyDefinitionImpl(Name declaringNodeType, Element pdefElement,
@@ -208,16 +224,19 @@
             QPropertyDefinition other = (QPropertyDefinition) obj;
             return super.equals(obj)
                     && requiredType == other.getRequiredType()
+                    && multiple == other.isMultiple()
+                    && fullTextSearcheable == other.isFullTextSearcheable()
+                    && queryOrderable == other.isQueryOrderable()
                     && Arrays.equals(valueConstraints, other.getValueConstraints())
                     && Arrays.equals(defaultValues, other.getDefaultValues())
-                    && multiple == other.isMultiple();
+                    && Arrays.equals(availableQueryOperators, other.getAvailableQueryOperators());
         }
         return false;
     }
 
     /**
      * Overwrites {@link QItemDefinitionImpl#hashCode()}.
-     * 
+     *
      * @return
      */
     public int hashCode() {
@@ -233,9 +252,19 @@
                 sb.append(getName().toString());
             }
             sb.append('/');
-            sb.append(getRequiredType());
+            sb.append(requiredType);
+            sb.append('/');
+            sb.append(multiple ? 1 : 0);
             sb.append('/');
-            sb.append(isMultiple() ? 1 : 0);
+            sb.append(fullTextSearcheable ? 1 : 0);
+            sb.append('/');
+            sb.append(queryOrderable ? 1 : 0);
+            sb.append('/');
+            Set s = new HashSet(availableQueryOperators.length);
+            for (int i = 0; i < availableQueryOperators.length; i++) {
+                s.add(availableQueryOperators[i]);
+            }
+            sb.append(s.toString());
 
             hashCode = sb.toString().hashCode();
         }

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeTypeDefinitionImpl.java?rev=772992&r1=772991&r2=772992&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeTypeDefinitionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/QNodeTypeDefinitionImpl.java
Fri May  8 14:00:31 2009
@@ -42,7 +42,7 @@
      * <code>NodeType</code>.
      *
      * @param nt            the JCR node type.
-     * @param resolver
+     * @param resolver      the name and path resolver.
      * @param qValueFactory the QValue factory.
      *
      * @throws NameException   if <code>nt</code> contains an illegal
@@ -57,20 +57,29 @@
                                    NamePathResolver resolver,
                                    QValueFactory qValueFactory)
             throws NamespaceException, RepositoryException, NameException {
+        // TODO: replace by code below as soon as implementation in jackrabbit-core is complete
         super(resolver.getQName(nt.getName()),
-                getNodeTypeNames(nt.getDeclaredSupertypes(), resolver),
-                nt.isMixin(), nt.hasOrderableChildNodes(),
+                getNodeTypeNames(nt.getDeclaredSupertypes(), resolver), null,
+                nt.isMixin(), nt.isAbstract(), false, nt.hasOrderableChildNodes(),
                 nt.getPrimaryItemName() != null ? resolver.getQName(nt.getPrimaryItemName())
: null,
                 getQPropertyDefinitions(nt.getDeclaredPropertyDefinitions(), resolver, qValueFactory),
                 getQNodeDefinitions(nt.getDeclaredChildNodeDefinitions(), resolver));
+        /*
+        super(resolver.getQName(nt.getName()),
+                getNodeTypeNames(nt.getDeclaredSupertypes(), resolver), null,
+                nt.isMixin(), nt.isAbstract(), nt.isQueryable(), nt.hasOrderableChildNodes(),
+                nt.getPrimaryItemName() != null ? resolver.getQName(nt.getPrimaryItemName())
: null,
+                getQPropertyDefinitions(nt.getDeclaredPropertyDefinitions(), resolver, qValueFactory),
+                getQNodeDefinitions(nt.getDeclaredChildNodeDefinitions(), resolver));
+                */
     }
 
     /**
      * Returns the qualified names of the passed node types using the namespace
      * resolver to parse the names.
      *
-     * @param nt         the node types
-     * @param resolver
+     * @param nt the node types.
+     * @param resolver the name and path resolver.
      * @return the qualified names of the node types.
      * @throws IllegalNameException   if a node type returns an illegal name.
      * @throws NamespaceException if the name of a node type contains a



Mime
View raw message