jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r426682 - in /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit: api/JackrabbitNodeTypeManager.java core/nodetype/NodeTypeManagerImpl.java
Date Fri, 28 Jul 2006 22:18:38 GMT
Author: jukka
Date: Fri Jul 28 15:18:35 2006
New Revision: 426682

URL: http://svn.apache.org/viewvc?rev=426682&view=rev
Log:
JCR-521: Added JackrabbitNodeTypeManager.hasNodeType(String) contributed by Nicolas Toper.

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java?rev=426682&r1=426681&r2=426682&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/api/JackrabbitNodeTypeManager.java
Fri Jul 28 15:18:35 2006
@@ -72,4 +72,14 @@
     NodeType[] registerNodeTypes(InputStream in, String contentType)
         throws IOException, RepositoryException;
 
+    /**
+     * Checks if a node type with the given name is registered. 
+     *
+     * @param name node type name
+     * @return <code>true</code> if the named node type is registered
+     *         <code>false</code> otherwise
+     * @throws RepositoryException if an error occurs
+     */
+    boolean hasNodeType(String name) throws RepositoryException;
+
 }

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=426682&r1=426681&r2=426682&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Fri Jul 28 15:18:35 2006
@@ -18,6 +18,7 @@
 
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.name.IllegalNameException;
+import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.UnknownPrefixException;
@@ -422,6 +423,18 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasNodeType(String name) throws RepositoryException {
+        try {
+            QName qname = NameFormat.parse(name, nsResolver);
+            return getNodeTypeRegistry().isRegistered(qname);
+        } catch (NameException e) {
+           throw new RepositoryException();
+        }      
+    }
+
     //-------------------------------------------------------------< Dumpable >
     /**
      * {@inheritDoc}
@@ -430,5 +443,5 @@
         ps.println("NodeTypeManager (" + this + ")");
         ps.println();
         ntReg.dump(ps);
-    }
+    }  
 }



Mime
View raw message