You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by ok...@apache.org on 2005/11/12 20:38:30 UTC

svn commit: r332834 - in /incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement: NodeTypeManager.java exception/OperationNotSupportedException.java impl/jackrabbit/NodeTypeManagerImpl.java

Author: okiessler
Date: Sat Nov 12 12:38:14 2005
New Revision: 332834

URL: http://svn.apache.org/viewcvs?rev=332834&view=rev
Log:
Issue: GRFT-67

Added:
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/OperationNotSupportedException.java
Modified:
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java

Modified: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java?rev=332834&r1=332833&r2=332834&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java Sat Nov 12 12:38:14 2005
@@ -1,12 +1,12 @@
 /*
  * Copyright 2000-2005 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,8 +22,10 @@
 
 import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
 import org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor;
+
 import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException;
 import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.OperationNotSupportedException;
 
 /** This interface defines the API for JCR Node Type Management implementations.
  * It does not contain any JCR vendor specific methods.
@@ -36,113 +38,140 @@
  * In order to create JCR custom node types you need to provide an established
  * session to a JCR repository. The user that is logged into has to have the
  * necessary permissions to create nodes (user has to have "superuser" rights).
- * 
+ *
  * The JCR Node Type Management tools are an extension to the graffito jcr-mapping
  * tools. NodeTypeManager implementations depend on the graffito jcr-mapping
  * xml file and the object model defined by graffito jcr-mapping.
  *
  * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
  */
-public interface NodeTypeManager
-{
+public interface NodeTypeManager {
+    
     /** Creates a new namespace in the repository.
-     * 
+     *
      * @param namespace Namespace
      * @param namespaceUri Full namespace URI
      */
     void createNamespace(String namespace, String namespaceUri);
-
+    
     /** This method creates JCR node types based on the MappingDescriptor object
      * which is created by a graffito jcr-mapping Mapper implementation. A
-     * Mapper reads one to many graffito-jcr mapping XML File. 
-     * 
-     * @param session Repository session 
-     * @param mappingDescriptor Mapping descriptor object created by graffito jcr-mapping
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException 
+     * Mapper reads one to many graffito-jcr mapping XML File.
+     *
+     * @param session Repository session
+     * @param mappingDescriptor Mapping descriptor object created by graffito
+     * jcr-mapping
+     * @throws NodeTypeCreationException NodeTypeCreationException
      */
-    void createNodeTypes(Session session, MappingDescriptor mappingDescriptor) throws NodeTypeCreationException;
-
+    void createNodeTypes(Session session, MappingDescriptor mappingDescriptor)
+    throws NodeTypeCreationException;
+    
     /** This method creates JCR node types based on ClassDescriptor objects
      * which are created by a graffito jcr-mapping Mapper implementation. A
-     * Mapper reads one to many graffito-jcr mapping XML File. 
-     * 
-     * @param session Repository session 
-     * @param classDescriptors Array of ClassDescriptor objects created by graffito jcr-mapping
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException 
+     * Mapper reads one to many graffito-jcr mapping XML File.
+     *
+     * @param session Repository session
+     * @param classDescriptors Array of ClassDescriptor objects created by
+     * graffito jcr-mapping
+     * @throws NodeTypeCreationException NodeTypeCreationException
      */
-    void createNodeTypes(Session session, ClassDescriptor[] classDescriptors) throws NodeTypeCreationException;    
+    void createNodeTypes(Session session, ClassDescriptor[] classDescriptors)
+    throws NodeTypeCreationException;
     
     /** This method creates JCR node types based on graffito jcr-mapping xml
      * files.
-     * 
-     * @param session Repository session 
+     *
+     * @param session Repository session
      * @param mappingXmlFiles InputStreams to graffito jcr-mapping xml files
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException
+     * @throws NodeTypeCreationException NodeTypeCreationException
      */
-    void createNodeTypesFromMappingFiles(Session session, InputStream[] mappingXmlFiles) throws NodeTypeCreationException;
-
+    void createNodeTypesFromMappingFiles(Session session,
+            InputStream[] mappingXmlFiles)
+            throws NodeTypeCreationException;
+    
     /** This method creates a single JCR node type identified by its ClassDescriptor
      * read from the graffito-jcr mapping file.
-     * 
+     *
      * @param session Repository session
-     * @param classDescriptor ClassDescriptor object created by graffito jcr-mapping 
-     * @param jcrNodeType Name of the class that needs to be created identified by its jcrNodeType name
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException
+     * @param classDescriptor ClassDescriptor object created by graffito jcr-mapping
+     * @param jcrNodeType Name of the class that needs to be created identified
+     * by its jcrNodeType name
+     * @throws NodeTypeCreationException NodeTypeCreationException
      */
-    void createSingleNodeType(Session session, ClassDescriptor classDescriptor) throws NodeTypeCreationException;
-
-    /** This method creates a single JCR node type identified by its jcrNodeType name defined in a graffito jcr-mapping xml file.
-     * 
+    void createSingleNodeType(Session session, ClassDescriptor classDescriptor)
+    throws NodeTypeCreationException;
+    
+    /** This method creates a single JCR node type identified by its jcrNodeType
+     * name defined in a graffito jcr-mapping xml file.
+     *
      * @param session Repository session
-     * @param mappingXmlFile InputStream to a graffito jcr-mapping xml file 
-     * @param jcrNodeType Name of the class that needs to be created identified by its jcrNodeType name 
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException
-     */
-    void createSingleNodeTypeFromMappingFile(Session session, InputStream mappingXmlFile, String jcrNodeType) throws NodeTypeCreationException;
-
-    /**
-     * This method creates a JCR node type from a given Java Bean class by using
+     * @param mappingXmlFile InputStream to a graffito jcr-mapping xml file
+     * @param jcrNodeType Name of the class that needs to be created identified
+     * by its jcrNodeType name
+     * @throws NodeTypeCreationException NodeTypeCreationException
+     */
+    void createSingleNodeTypeFromMappingFile(Session session,
+            InputStream mappingXmlFile, String jcrNodeType)
+            throws NodeTypeCreationException;
+    
+    /** This method creates a JCR node type from a given Java Bean class by using
      * reflection. It creates required JCR property definitions from primitive
      * Java class properties using the same property name. Non-primitive class
-     * properties are skipped. 
-     * 
+     * properties are skipped.
+     *
      * @param session Repository session
      * @param clazz Java class
      * @param jcrNodeType Name of JCR node type (including namespace)
      * @param reflectSuperClasses If true, all base classes are also reflected
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException
+     * @throws NodeTypeCreationException NodeTypeCreationException
      */
-    void createNodeTypeFromClass(Session session, Class clazz, String jcrNodeType, boolean reflectSuperClasses) throws NodeTypeCreationException;
+    void createNodeTypeFromClass(Session session, Class clazz,
+            String jcrNodeType, boolean reflectSuperClasses)
+            throws NodeTypeCreationException;
     
-    /** This method removes all JCR node types that are defined in one to many 
+    /** This method created JCR node types from a JCR vendor specific
+     * configuration file.
+     *
+     * @param session Repository session
+     * @param jcrRepositoryXmlConfigurationFile InputStream to file
+     * @throws OperationNotSupportedException OperationNotSupportedException
+     * @throws NodeTypeCreationException NodeTypeCreationException
+     */
+    void createNodeTypesFromConfiguration(Session session,
+            InputStream jcrRepositoryConfigurationFile)
+            throws OperationNotSupportedException, NodeTypeCreationException;
+    
+    /** This method removes all JCR node types that are defined in one to many
      * graffito jcr-mapping XML files.
-     * 
-     * @param session Repository session 
-     * @param mappingXmlFiles InputStreams to graffito jcr-mapping xml file  
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException NodeTypeRemovalException
+     *
+     * @param session Repository session
+     * @param mappingXmlFiles InputStreams to graffito jcr-mapping xml file
+     * @throws NodeTypeRemovalException NodeTypeRemovalException
      */
-    void removeNodeTypes(Session session, InputStream[] mappingXmlFiles) throws NodeTypeRemovalException;
+    void removeNodeTypes(Session session, InputStream[] mappingXmlFiles)
+    throws NodeTypeRemovalException;
     
     /** This method removes a single JCR node type identified by its jcrNodeType
      * name.
-     * 
+     *
      * @param session Repository session
-     * @param jcrNodeType 
-     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException NodeTypeRemovalException
+     * @param jcrNodeType
+     * @throws NodeTypeRemovalException NodeTypeRemovalException
      */
-    void removeSingleNodeType(Session session, String jcrNodeType) throws NodeTypeRemovalException;
-
+    void removeSingleNodeType(Session session, String jcrNodeType)
+    throws NodeTypeRemovalException;
+    
     /** Returns the names of all node types in the repository identified by a
      * given namespace.
-     * 
+     *
      * @param namespace Name of nodetypes to return
      * @return list of matching JCR node types
      */
     List getPrimaryNodeTypeNames(String namespace);
-
+    
     /** Returns a list of all JCR node types.
-     * 
-     * @return list of all JCR node types 
+     *
+     * @return list of all JCR node types
      */
     List getAllPrimaryNodeTypeNames();
 }

Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/OperationNotSupportedException.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/OperationNotSupportedException.java?rev=332834&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/OperationNotSupportedException.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/OperationNotSupportedException.java Sat Nov 12 12:38:14 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2000-2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.jcr.nodemanagement.exception;
+
+/** Exception that is thrown if a JCR operation is not supported by
+ * a JCR repository implementation.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class OperationNotSupportedException extends BaseNodeManagementException
+{
+    
+    /** Creates a new instance of NodeTypeRemovalException. */
+    public OperationNotSupportedException()
+    {
+    }
+    
+    /** Creates a new instance of NodeTypeRemovalException. 
+     * @param wrappedException Root exception
+     */
+    public OperationNotSupportedException(Exception wrappedException)
+    {
+        setWrappedException(wrappedException);
+    }
+}

Modified: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java?rev=332834&r1=332833&r2=332834&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java Sat Nov 12 12:38:14 2005
@@ -15,7 +15,18 @@
  */
 package org.apache.portals.graffito.jcr.nodemanagement.impl.jackrabbit;
 
+import java.io.InputStream;
+import java.util.List;
+
+import javax.jcr.Session;
+
+import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
+import org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor;
+
 import org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.OperationNotSupportedException;
 
 /** This is the NodeTypeManager implementation for Apache Jackrabbit.
  *
@@ -28,50 +39,68 @@
     public NodeTypeManagerImpl()
     {
     }
-
+    
     public void createNamespace(String namespace, String namespaceUri)
     {
     }
-
-    public void createNodeTypeFromClass(javax.jcr.Session session, Class clazz, String jcrNodeType, boolean reflectSuperClasses) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createNodeTypes(Session session, MappingDescriptor mappingDescriptor)
+    throws NodeTypeCreationException
     {
     }
-
-    public void createNodeTypes(javax.jcr.Session session, org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor[] classDescriptors) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createNodeTypes(Session session, ClassDescriptor[] classDescriptors)
+    throws NodeTypeCreationException
     {
     }
-
-    public void createNodeTypes(javax.jcr.Session session, org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor mappingDescriptor) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createNodeTypesFromMappingFiles(Session session,
+            InputStream[] mappingXmlFiles)
+            throws NodeTypeCreationException
     {
     }
-
-    public void createNodeTypesFromMappingFiles(javax.jcr.Session session, java.io.InputStream[] mappingXmlFiles) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createSingleNodeType(Session session, ClassDescriptor classDescriptor)
+    throws NodeTypeCreationException
     {
     }
-
-    public void createSingleNodeType(javax.jcr.Session session, org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor classDescriptor) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createSingleNodeTypeFromMappingFile(Session session,
+            InputStream mappingXmlFile, String jcrNodeType)
+            throws NodeTypeCreationException
     {
     }
-
-    public void createSingleNodeTypeFromMappingFile(javax.jcr.Session session, java.io.InputStream mappingXmlFile, String jcrNodeType) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException
+    
+    public void createNodeTypeFromClass(Session session, Class clazz,
+            String jcrNodeType, boolean reflectSuperClasses)
+            throws NodeTypeCreationException
     {
     }
+    
 
-    public java.util.List getAllPrimaryNodeTypeNames()
+    public void createNodeTypesFromConfiguration(Session session,
+            InputStream jcrRepositoryConfigurationFile)
+            throws OperationNotSupportedException, NodeTypeCreationException
     {
-        return null;
     }
-
-    public java.util.List getPrimaryNodeTypeNames(String namespace)
+    
+    public void removeNodeTypes(Session session, InputStream[] mappingXmlFiles)
+    throws NodeTypeRemovalException
     {
-        return null;
     }
-
-    public void removeNodeTypes(javax.jcr.Session session, java.io.InputStream[] mappingXmlFiles) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException
+    
+    public void removeSingleNodeType(Session session, String jcrNodeType)
+    throws NodeTypeRemovalException
     {
     }
-
-    public void removeSingleNodeType(javax.jcr.Session session, String jcrNodeType) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException
+    
+    public List getPrimaryNodeTypeNames(String namespace)
     {
+        return null;
+    }
+    
+    public List getAllPrimaryNodeTypeNames()
+    {
+        return null;
     }
 }