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/01 20:40:49 UTC

svn commit: r330118 - in /incubator/graffito/trunk/jcr-nodemanagement: ./ src/java/org/apache/portals/graffito/jcr/exception/ src/java/org/apache/portals/graffito/jcr/nodemanagement/ src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/ sr...

Author: okiessler
Date: Tue Nov  1 12:40:40 2005
New Revision: 330118

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

Added:
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/BaseNodeManagementException.java
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NamespaceCreationException.java
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeCreationException.java
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeRemovalException.java
Removed:
    incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/exception/BaseNodeManagementException.java
Modified:
    incubator/graffito/trunk/jcr-nodemanagement/project.xml
    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/project.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/project.xml?rev=330118&r1=330117&r2=330118&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/project.xml (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/project.xml Tue Nov  1 12:40:40 2005
@@ -35,9 +35,8 @@
   </repository>
 
   <dependencies> 
-
     <dependency>  
-      <id>graffito-commons</id>
+      <id>graffito-jcr-mapping</id>
       <groupId>graffito</groupId>
       <version>1.0-a1-dev</version>
     </dependency>

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=330118&r1=330117&r2=330118&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 Tue Nov  1 12:40:40 2005
@@ -15,9 +15,117 @@
  */
 package org.apache.portals.graffito.jcr.nodemanagement;
 
-/**
+import java.io.InputStream;
+import java.util.List;
+
+import javax.jcr.Session;
+
+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;
+
+/** This interface defines the API for JCR Node Type Management implementations.
+ * It does not contain any JCR vendor specific methods.
+ *
+ * Classes that implement this interface are used to create custom node types in
+ * a JCR repository. Each JCR repository has its own way of doing this as it is
+ * not defined by the JSR-170 spec. The default implementation of graffito
+ * jcr-nodemanagement is Jackrabbit.
  *
  * @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 the 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 
+     */
+    void createNodeTypes(Session session, MappingDescriptor mappingDescriptor) throws NodeTypeCreationException;
+
+    /** This method creates JCR node types based on a graffito jcr-mapping xml
+     * file.
+     * 
+     * @param session Repository session 
+     * @param mappingXmlFile InputStream to a graffito jcr-mapping xml file
+     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException NodeTypeCreationException
+     */
+    void createNodeTypesFromMappingFile(Session session, InputStream mappingXmlFile) throws NodeTypeCreationException;
+
+    /** This method creates a single JCR node type identified by its jcrNodeType
+     * name defined in a graffito jcr-mapping xml file. The MappingDescriptor
+     * object which is created by a graffito jcr-mapping Mapper implementation.
+     * 
+     * @param session Repository session
+     * @param mappingDescriptor Mapping descriptor 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
+     */
+    void createSingleNodeType(Session session, MappingDescriptor mappingDescriptor, String jcrNodeType) 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 
+     */
+    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. 
+     * 
+     * @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 
+     */
+    void createNodeTypeFromClass(Session session, Class clazz, String jcrNodeType, boolean reflectSuperClasses) throws NodeTypeCreationException;
+    
+    /** This method removes all JCR node types that are defined in a given 
+     * graffito jcr-mapping XML file.
+     * 
+     * @param session Repository session 
+     * @param mappingXmlFile InputStream to a graffito jcr-mapping xml file  
+     * @throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException 
+     */
+    void removeNodeTypes(Session session, InputStream mappingXmlFile) 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 
+     */
+    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 
+     */
+    List getAllPrimaryNodeTypeNames();
 }

Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/BaseNodeManagementException.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/BaseNodeManagementException.java?rev=330118&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/BaseNodeManagementException.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/BaseNodeManagementException.java Tue Nov  1 12:40:40 2005
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+/** Base exception for all JCR Node Type Management exceptions.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class BaseNodeManagementException extends Exception
+{
+
+    /** Root exception.
+     */
+    private Exception wrappedException;
+    
+    /** Creates a new instance of BaseNodeManagementException. */
+    public BaseNodeManagementException()
+    {
+    }
+
+    /** Getter for property wrappedException.
+     * 
+     * @return wrappedException
+     */
+    public Exception getWrappedException()
+    {
+        return wrappedException;
+    }
+
+    /** Setter for property wrappedException.
+     * 
+     * @param object wrappedException
+     */
+    public void setWrappedException(Exception object)
+    {
+        this.wrappedException = object;
+    }
+}

Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NamespaceCreationException.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NamespaceCreationException.java?rev=330118&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NamespaceCreationException.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NamespaceCreationException.java Tue Nov  1 12:40:40 2005
@@ -0,0 +1,37 @@
+/*
+ * 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 when a JCR namespace could not be created.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class NamespaceCreationException extends BaseNodeManagementException
+{
+
+    /** Creates a new instance of NamespaceCreationException. */
+    public NamespaceCreationException()
+    {
+    }
+    
+    /** Creates a new instance of NamespaceCreationException. 
+     * @param wrappedException Root exception
+     */
+    public NamespaceCreationException(Exception wrappedException)
+    {
+        setWrappedException(wrappedException);
+    }
+}

Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeCreationException.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeCreationException.java?rev=330118&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeCreationException.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeCreationException.java Tue Nov  1 12:40:40 2005
@@ -0,0 +1,37 @@
+/*
+ * 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 when a JCR node type could not be created.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class NodeTypeCreationException extends BaseNodeManagementException
+{
+    
+    /** Creates a new instance of NodeTypeCreationException. */
+    public NodeTypeCreationException()
+    {
+    }
+    
+    /** Creates a new instance of NodeTypeCreationException. 
+     * @param wrappedException Root exception
+     */
+    public NodeTypeCreationException(Exception wrappedException)
+    {
+        setWrappedException(wrappedException);
+    }
+}

Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeRemovalException.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeRemovalException.java?rev=330118&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeRemovalException.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/exception/NodeTypeRemovalException.java Tue Nov  1 12:40:40 2005
@@ -0,0 +1,37 @@
+/*
+ * 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 when a JCR node type could not be removed.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class NodeTypeRemovalException extends BaseNodeManagementException
+{
+    
+    /** Creates a new instance of NodeTypeRemovalException. */
+    public NodeTypeRemovalException()
+    {
+    }
+    
+    /** Creates a new instance of NodeTypeRemovalException. 
+     * @param wrappedException Root exception
+     */
+    public NodeTypeRemovalException(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=330118&r1=330117&r2=330118&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 Tue Nov  1 12:40:40 2005
@@ -17,13 +17,45 @@
 
 import org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager;
 
-/**
+/** This is the NodeTypeManager implementation for Apache Jackrabbit.
  *
  * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
  */
 public class NodeTypeManagerImpl implements NodeTypeManager {
     
-    /** Creates a new instance of NodeTypeManagerImpl */
+    /** Creates a new instance of NodeTypeManagerImpl. */
     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(javax.jcr.Session session, org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor mappingDescriptor) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException {
+    }
+
+    public void createNodeTypesFromMappingFile(javax.jcr.Session session, java.io.InputStream mappingXmlFile) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException {
+    }
+
+    public void createSingleNodeType(javax.jcr.Session session, org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor mappingDescriptor, String jcrNodeType) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException {
+    }
+
+    public void createSingleNodeTypeFromMappingFile(javax.jcr.Session session, java.io.InputStream mappingXmlFile, String jcrNodeType) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException {
+    }
+
+    public java.util.List getAllPrimaryNodeTypeNames() {
+        return null;
+    }
+
+    public java.util.List getPrimaryNodeTypeNames(String namespace) {
+        return null;
+    }
+
+    public void removeNodeTypes(javax.jcr.Session session, java.io.InputStream mappingXmlFile) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException {
+    }
+
+    public void removeSingleNodeType(javax.jcr.Session session, String jcrNodeType) throws org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException {
     }
 }