jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r816568 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commo...
Date Fri, 18 Sep 2009 09:59:26 GMT
Author: mreutegg
Date: Fri Sep 18 09:59:25 2009
New Revision: 816568

URL: http://svn.apache.org/viewvc?rev=816568&view=rev
Log:
JCR-1483: Move common node type functionality to jackrabbit-spi-commons
- moved common functionality from NodeTypeImpl (core and jcr2spi) to AbstractNodeType (spi-commons)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.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/nodetype/AbstractNodeType.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=816568&r1=816567&r2=816568&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Fri Sep 18 09:59:25 2009
@@ -21,7 +21,6 @@
 import java.util.Set;
 import java.util.List;
 
-import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
@@ -53,11 +52,8 @@
 
     private static Logger log = LoggerFactory.getLogger(NodeTypeImpl.class);
 
-    private final QNodeTypeDefinition ntd;
     private final EffectiveNodeType ent;
     private final NodeTypeManagerImpl ntMgr;
-    // resolver used to translate translate <code>Name</code>s to JCR name strings.
-    private final NamePathResolver resolver;
     // value factory used for type conversion
     private final ValueFactory valueFactory;
     private final DataStore store;
@@ -84,20 +80,15 @@
                  NamePathResolver resolver,
                  ValueFactory valueFactory,
                  DataStore store) {
-        super(ntMgr);
+        super(ntd, ntMgr, resolver);
         this.ent = ent;
         this.ntMgr = ntMgr;
-        this.resolver = resolver;
         this.valueFactory = valueFactory;
-        this.ntd = ntd;
         this.store = store;
     }
 
     /**
-     * Checks if the effective node type includes the given <code>nodeTypeName</code>.
-     *
-     * @param nodeTypeName the name of a node type.
-     * @return true if the effective node type includes the given <code>nodeTypeName</code>.
+     * {@inheritDoc}
      */
     public boolean isNodeType(Name nodeTypeName) {
         return ent.includesNodeType(nodeTypeName);
@@ -116,15 +107,6 @@
     }
 
     /**
-     * Returns the definition of this node type.
-     *
-     * @return the definition of this node type
-     */
-    public QNodeTypeDefinition getDefinition() {
-        return ntd;
-    }
-
-    /**
      * Returns an array containing only those child node definitions of this
      * node type (including the child node definitions inherited from supertypes
      * of this node type) where <code>{@link NodeDefinition#isAutoCreated()}</code>
@@ -241,76 +223,6 @@
 
 
     //---------------------------------------------------< NodeTypeDefinition >
-    /**
-     * {@inheritDoc}
-     */
-    public String getName() {
-        try {
-            return resolver.getJCRName(ntd.getName());
-        } catch (NamespaceException e) {
-            // should never get here
-            log.error("encountered unregistered namespace in node type name", e);
-            return ntd.getName().toString();
-        }
-    }
-
-    /**
-     * Returns the names of the supertypes actually declared in this node type.
-     * <p/>
-     * In implementations that support node type registration, if this
-     * <code>NodeTypeDefinition</code> object is actually a newly-created empty
-     * <code>NodeTypeTemplate</code>, then this method will return an array
-     * containing a single string indicating the node type
-     * <code>nt:base</code>.
-     *
-     * @return an array of <code>String</code>s
-     * @since JCR 2.0
-     */
-    public String[] getDeclaredSupertypeNames() {
-        Name[] ntNames = ntd.getSupertypes();
-        String[] supertypes = new String[ntNames.length];
-        for (int i = 0; i < ntNames.length; i++) {
-            try {
-                supertypes[i] = resolver.getJCRName(ntNames[i]);
-            } catch (NamespaceException e) {
-                // should never get here
-                log.error("encountered unregistered namespace in node type name", e);
-                supertypes[i] = ntNames[i].toString();
-            }
-        }
-        return supertypes;
-    }
-
-    /**
-     * Returns <code>true</code> if this is an abstract node type; returns
-     * <code>false</code> otherwise.
-     * <p/>
-     * An abstract node type is one that cannot be assigned as the primary or
-     * mixin type of a node but can be used in the definitions of other node
-     * types as a superclass.
-     * <p/>
-     * In implementations that support node type registration, if this
-     * <code>NodeTypeDefinition</code> object is actually a newly-created empty
-     * <code>NodeTypeTemplate</code>, then this method will return
-     * <code>false</code>.
-     *
-     * @return a <code>boolean</code>
-     * @since JCR 2.0
-     */
-    public boolean isAbstract() {
-        return ntd.isAbstract();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isMixin() {
-        return ntd.isMixin();
-    }
-
-    public boolean isQueryable() {
-        return ntd.isQueryable();
-    }
 
     /**
      * {@inheritDoc}
@@ -319,72 +231,7 @@
         return ent.hasOrderableChildNodes();
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public String getPrimaryItemName() {
-        // TODO JCR-1947: JSR 283: Node Type Attribute Subtyping Rules
-        try {
-            Name piName = ntd.getPrimaryItemName();
-            if (piName != null) {
-                return resolver.getJCRName(piName);
-            } else {
-                return null;
-            }
-        } catch (NamespaceException e) {
-            // should never get here
-            log.error("encountered unregistered namespace in name of primary item", e);
-            return ntd.getName().toString();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public NodeType[] getDeclaredSupertypes() {
-        Name[] ntNames = ntd.getSupertypes();
-        NodeType[] supertypes = new NodeType[ntNames.length];
-        for (int i = 0; i < ntNames.length; i++) {
-            try {
-                supertypes[i] = ntMgr.getNodeType(ntNames[i]);
-            } catch (NoSuchNodeTypeException e) {
-                // should never get here
-                log.error("undefined supertype", e);
-                return new NodeType[0];
-            }
-        }
-        return supertypes;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    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;
-    }
-
     //-------------------------------------------------------------< NodeType >
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isNodeType(String nodeTypeName) {
-        Name ntName;
-        try {
-            ntName = resolver.getQName(nodeTypeName);
-        } catch (NamespaceException e) {
-            log.warn("invalid node type name: " + nodeTypeName, e);
-            return false;
-        } catch (NameException e) {
-            log.warn("invalid node type name: " + nodeTypeName, e);
-            return false;
-        }
-        return isNodeType(ntName);
-    }
 
     /**
      * {@inheritDoc}
@@ -612,18 +459,6 @@
         return false;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    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;
-    }
-
     //--------------------------------------------------< new JSR 283 methods >
     /**
      * Returns <code>true</code> if removing the child node called

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=816568&r1=816567&r2=816568&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 Sep 18 09:59:25 2009
@@ -24,7 +24,6 @@
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
 import org.apache.jackrabbit.spi.commons.nodetype.AbstractNodeType;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
@@ -51,7 +50,6 @@
 
     private static Logger log = LoggerFactory.getLogger(NodeTypeImpl.class);
 
-    private final QNodeTypeDefinition ntd;
     private final EffectiveNodeType ent;
     private final NodeTypeManagerImpl ntMgr;
     private final ManagerProvider mgrProvider;
@@ -70,15 +68,10 @@
      */
     NodeTypeImpl(EffectiveNodeType ent, QNodeTypeDefinition ntd,
                  NodeTypeManagerImpl ntMgr, ManagerProvider mgrProvider) {
-        super(ntMgr);
+        super(ntd, ntMgr, mgrProvider.getNamePathResolver());
         this.ent = ent;
         this.ntMgr = ntMgr;
         this.mgrProvider = mgrProvider;
-        this.ntd = ntd;
-    }
-
-    private NamespaceResolver nsResolver() {
-        return mgrProvider.getNamespaceResolver();
     }
 
     private NamePathResolver resolver() {
@@ -106,30 +99,13 @@
     }
 
     /**
-     * Test if this nodetype equals or is directly or indirectly derived from
-     * the node type with the specified <code>nodeTypeName</code>, without
-     * checking of a node type of that name really exists.
-     *
-     * @param nodeTypeName A node type name.
-     * @return true if this node type represents the type with the given
-     * <code>nodeTypeName</code> or if it is directly or indirectly derived
-     * from it; otherwise <code>false</code>. If no node type exists with the
-     * specified name this method will also return <code>false</code>.
+     * {@inheritDoc}
      */
     public boolean isNodeType(Name nodeTypeName) {
         return ent.includesNodeType(nodeTypeName);
     }
 
     /**
-     * Returns the node type definition.
-     *
-     * @return the internal node type definition.
-     */
-    QNodeTypeDefinition getDefinition() {
-        return ntd;
-    }
-
-    /**
      * Tests if the value constraints defined in the property definition
      * <code>def</code> are satisfied by the the specified <code>values</code>.
      * <p/>
@@ -149,43 +125,6 @@
     }
     
     //-------------------------------------------------< NodeTypeDefinition >---
-    /**
-     * @see javax.jcr.nodetype.NodeTypeDefinition#getName()
-     */
-    public String getName() {
-        try {
-            return resolver().getJCRName(ntd.getName());
-        } catch (NamespaceException e) {
-            // should never get here
-            log.error("encountered unregistered namespace in node type name", e);
-            return ntd.getName().toString();
-        }
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeTypeDefinition#getPrimaryItemName()
-     */
-    public String getPrimaryItemName() {
-        try {
-            Name piName = ntd.getPrimaryItemName();
-            if (piName != null) {
-                return resolver().getJCRName(piName);
-            } else {
-                return null;
-            }
-        } catch (NamespaceException e) {
-            // should never get here
-            log.error("encountered unregistered namespace in name of primary item", e);
-            return ntd.getName().toString();
-        }
-    }
-
-    /**
-     * @see javax.jcr.nodetype.NodeTypeDefinition#isMixin()
-     */
-    public boolean isMixin() {
-        return ntd.isMixin();
-    }
 
     /**
      * @see javax.jcr.nodetype.NodeTypeDefinition#hasOrderableChildNodes()
@@ -194,80 +133,7 @@
         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) {
-        Name ntName;
-        try {
-            ntName = resolver().getQName(nodeTypeName);
-        } catch (NamespaceException e) {
-            log.warn("invalid node type name: " + nodeTypeName, e);
-            return false;
-        } catch (NameException e) {
-            log.warn("invalid node type name: " + nodeTypeName, e);
-            return false;
-        }
-        return isNodeType(ntName);
-    }
 
     /**
      * @see javax.jcr.nodetype.NodeType#getSupertypes()
@@ -312,24 +178,6 @@
     }
 
     /**
-     * @see javax.jcr.nodetype.NodeType#getDeclaredSupertypes()
-     */
-    public NodeType[] getDeclaredSupertypes() {
-        Name[] ntNames = ntd.getSupertypes();
-        NodeType[] supertypes = new NodeType[ntNames.length];
-        for (int i = 0; i < ntNames.length; i++) {
-            try {
-                supertypes[i] = ntMgr.getNodeType(ntNames[i]);
-            } catch (NoSuchNodeTypeException e) {
-                // should never get here
-                log.error("undefined supertype", e);
-                return new NodeType[0];
-            }
-        }
-        return supertypes;
-    }
-
-    /**
      * @see javax.jcr.nodetype.NodeType#canSetProperty(String, Value)
      */
     public boolean canSetProperty(String propertyName, Value value) {

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java?rev=816568&r1=816567&r2=816568&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
Fri Sep 18 09:59:25 2009
@@ -19,10 +19,21 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.commons.iterator.NodeTypeIteratorAdapter;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NameException;
 
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.RepositoryException;
+import javax.jcr.NamespaceException;
+
 import java.util.ArrayList;
 
 /**
@@ -38,18 +49,109 @@
      */
     private static final Logger log = LoggerFactory.getLogger(AbstractNodeType.class);
 
-    private final AbstractNodeTypeManager ntMgr;
+    protected final AbstractNodeTypeManager ntMgr;
+
+    protected final QNodeTypeDefinition ntd;
+
+    protected final NamePathResolver resolver;
 
     /**
      * Create a new <code>AbstractNodeType</code>.
      *
-     * @param ntMgr
+     * @param ntd      the underlying node type definition.
+     * @param ntMgr    the node type manager.
+     * @param resolver the name/path resolver of the session that created this
+     *                 node type instance.
      */
-    public AbstractNodeType(AbstractNodeTypeManager ntMgr) {
+    public AbstractNodeType(QNodeTypeDefinition ntd,
+                            AbstractNodeTypeManager ntMgr,
+                            NamePathResolver resolver) {
+        this.ntd = ntd;
         this.ntMgr = ntMgr;
+        this.resolver = resolver;
+    }
+
+    /**
+     * Returns the node type definition.
+     *
+     * @return the internal node type definition.
+     */
+    public QNodeTypeDefinition getDefinition() {
+        return ntd;
     }
 
     //-----------------------------------------------------------< NodeType >---
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        try {
+            return resolver.getJCRName(ntd.getName());
+        } catch (NamespaceException e) {
+            // should never get here
+            log.error("encountered unregistered namespace in node type name", e);
+            return ntd.getName().toString();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAbstract() {
+        return ntd.isAbstract();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMixin() {
+        return ntd.isMixin();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isQueryable() {
+        return ntd.isQueryable();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getDeclaredSupertypeNames() {
+        Name[] ntNames = ntd.getSupertypes();
+        String[] supertypes = new String[ntNames.length];
+        for (int i = 0; i < ntNames.length; i++) {
+            try {
+                supertypes[i] = resolver.getJCRName(ntNames[i]);
+            } catch (NamespaceException e) {
+                // should never get here
+                log.error("encountered unregistered namespace in node type name", e);
+                supertypes[i] = ntNames[i].toString();
+            }
+        }
+        return supertypes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeType[] getDeclaredSupertypes() {
+        Name[] ntNames = ntd.getSupertypes();
+        NodeType[] supertypes = new NodeType[ntNames.length];
+        for (int i = 0; i < ntNames.length; i++) {
+            try {
+                supertypes[i] = ntMgr.getNodeType(ntNames[i]);
+            } catch (NoSuchNodeTypeException e) {
+                // should never get here
+                log.error("undefined supertype", e);
+                return new NodeType[0];
+            }
+        }
+        return supertypes;
+    }
+
     /**
      * @see javax.jcr.nodetype.NodeType#getDeclaredSubtypes()
      */
@@ -64,7 +166,81 @@
         return getSubtypes(false);
     }        
 
+    /**
+     * {@inheritDoc}
+     */
+    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;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getPrimaryItemName() {
+        // TODO JCR-1947: JSR 283: Node Type Attribute Subtyping Rules
+        try {
+            Name piName = ntd.getPrimaryItemName();
+            if (piName != null) {
+                return resolver.getJCRName(piName);
+            } else {
+                return null;
+            }
+        } catch (NamespaceException e) {
+            // should never get here
+            log.error("encountered unregistered namespace in name of primary item", e);
+            return ntd.getName().toString();
+        }
+    }
+
+    /**
+     * @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;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isNodeType(String nodeTypeName) {
+        Name ntName;
+        try {
+            ntName = resolver.getQName(nodeTypeName);
+        } catch (NamespaceException e) {
+            log.warn("invalid node type name: " + nodeTypeName, e);
+            return false;
+        } catch (NameException e) {
+            log.warn("invalid node type name: " + nodeTypeName, e);
+            return false;
+        }
+        return isNodeType(ntName);
+    }
+
+    /**
+     * Test if this nodetype equals or is directly or indirectly derived from
+     * the node type with the specified <code>nodeTypeName</code>, without
+     * checking of a node type of that name really exists.
+     *
+     * @param nodeTypeName A node type name.
+     * @return true if this node type represents the type with the given
+     * <code>nodeTypeName</code> or if it is directly or indirectly derived
+     * from it; otherwise <code>false</code>. If no node type exists with the
+     * specified name this method will also return <code>false</code>.
+     */
+    public abstract boolean isNodeType(Name nodeTypeName);
+
     //--------------------------------------------------------------------------
+
     /**
      * Returns the node types derived from this node type.
      *

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java?rev=816568&r1=816567&r2=816568&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java
Fri Sep 18 09:59:25 2009
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.spi.commons.nodetype;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 
 import javax.jcr.nodetype.NodeTypeManager;
@@ -28,6 +28,8 @@
 import javax.jcr.nodetype.PropertyDefinitionTemplate;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.RepositoryException;
 
@@ -38,11 +40,6 @@
 public abstract class AbstractNodeTypeManager implements NodeTypeManager {
 
     /**
-     * logger instance
-     */
-    private static final Logger log = LoggerFactory.getLogger(AbstractNodeTypeManager.class);
-
-    /**
      * Return the node type with the specified <code>ntName</code>.
      *
      * @param ntName Name of the node type to be returned.
@@ -52,6 +49,24 @@
     public abstract NodeType getNodeType(Name ntName) throws NoSuchNodeTypeException;
 
     /**
+     * Retrieve the <code>NodeDefinition</code> for the given
+     * <code>QNodeDefinition</code>.
+     *
+     * @param nd the QNodeDefinition.
+     * @return the node definition.
+     */
+    public abstract NodeDefinition getNodeDefinition(QNodeDefinition nd);
+
+    /**
+     * Retrieve the <code>PropertyDefinition</code> for the given
+     * <code>QPropertyDefinition</code>.
+     *
+     * @param pd the QPropertyDefinition.
+     * @return the property definition.
+     */
+    public abstract PropertyDefinition getPropertyDefinition(QPropertyDefinition pd);
+
+    /**
      * Returns the NamePathResolver used to validate JCR names.
      *
      * @return the NamePathResolver used to convert JCR names/paths to internal



Mime
View raw message