You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2007/10/03 17:57:31 UTC

svn commit: r581641 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype: ./ jsr283/

Author: stefan
Date: Wed Oct  3 08:57:30 2007
New Revision: 581641

URL: http://svn.apache.org/viewvc?rev=581641&view=rev
Log:
JCR-1104: JSR 283 support

work in (slow) progress...

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=581641&r1=581640&r2=581641&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java Wed Oct  3 08:57:30 2007
@@ -42,6 +42,7 @@
 
     private boolean mixin;
     private boolean orderableChildNodes;
+    private boolean abstractStatus;
     private QName primaryItemName;
     private HashSet propDefs;
     private HashSet nodeDefs;
@@ -59,6 +60,7 @@
         supertypes = QName.EMPTY_ARRAY;
         mixin = false;
         orderableChildNodes = false;
+        abstractStatus = false;
     }
 
     /**
@@ -167,6 +169,15 @@
     }
 
     /**
+     * Sets the 'abstract' flag.
+     *
+     * @param abstractStatus flag
+     */
+    public void setAbstract(boolean abstractStatus) {
+        this.abstractStatus = abstractStatus;
+    }
+
+    /**
      * Sets the name of the primary item (one of the child items of the node's
      * of this node type)
      *
@@ -243,6 +254,15 @@
      */
     public boolean hasOrderableChildNodes() {
         return orderableChildNodes;
+    }
+
+    /**
+     * Returns the value of the 'abstract' flag.
+     *
+     * @return true if this node type is abstract; false otherwise.
+     */
+    public boolean isAbstract() {
+        return abstractStatus;
     }
 
     /**

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeTemplateImpl.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype;
+
+import org.apache.commons.collections.list.TypedList;
+import org.apache.jackrabbit.core.nodetype.jsr283.NodeDefinitionTemplate;
+import org.apache.jackrabbit.core.nodetype.jsr283.NodeTypeTemplate;
+import org.apache.jackrabbit.core.nodetype.jsr283.PropertyDefinitionTemplate;
+
+import javax.jcr.nodetype.NodeDefinition;
+import javax.jcr.nodetype.PropertyDefinition;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A <code>NodeTypeTemplateImpl</code> ...
+ */
+public class NodeTypeTemplateImpl implements NodeTypeTemplate {
+
+
+    private String name;
+    private String[] superTypeNames;
+    private String primaryItemName;
+    private boolean abstractStatus;
+    private boolean mixin;
+    private boolean orderableChildNodes;
+    private List nodeDefinitionTemplates;
+    private List propertyDefinitionTemplates;
+
+    /**
+     * Default constructor
+     */
+    public NodeTypeTemplateImpl() {
+        nodeDefinitionTemplates = TypedList.decorate(
+                new ArrayList(), NodeDefinitionTemplate.class);
+        propertyDefinitionTemplates = TypedList.decorate(
+                new ArrayList(), PropertyDefinitionTemplate.class);
+    }
+
+    //-----------------------------------------------------< NodeTypeTemplate >
+    /**
+     * {@inheritDoc}
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setDeclaredSuperTypeNames(String[] names) {
+        superTypeNames = names;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAbstract(boolean abstractStatus) {
+        this.abstractStatus = abstractStatus;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setMixin(boolean mixin) {
+        this.mixin = mixin;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setOrderableChildNodes(boolean orderable) {
+        orderableChildNodes = orderable;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setPrimaryItemName(String name) {
+        primaryItemName = name;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List getPropertyDefinitionTemplates() {
+        return propertyDefinitionTemplates;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public List getNodeDefinitionTemplates() {
+        return nodeDefinitionTemplates;
+    }
+
+    //---------------------------------------------------< NodeTypeDefinition >
+    /**
+     * {@inheritDoc}
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String[] getDeclaredSupertypeNames() {
+        return superTypeNames;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isAbstract() {
+        return abstractStatus;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isMixin() {
+        return mixin;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasOrderableChildNodes() {
+        return orderableChildNodes;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getPrimaryItemName() {
+        return primaryItemName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PropertyDefinition[] getDeclaredPropertyDefinitions() {
+        return (PropertyDefinition[]) propertyDefinitionTemplates.toArray(
+                new PropertyDefinition[propertyDefinitionTemplates.size()]);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeDefinition[] getDeclaredChildNodeDefinitions() {
+        return (NodeDefinition[]) nodeDefinitionTemplates.toArray(
+                new NodeDefinition[nodeDefinitionTemplates.size()]);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/InvalidNodeTypeDefinitionException.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype.jsr283;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Exception thrown when an attempt is made to register an invalid node type
+ * definition template.
+ *
+ * @since JCR 2.0
+ */
+public class InvalidNodeTypeDefinitionException extends RepositoryException {
+    /**
+     * Constructs a new instance of this class with <code>null</code> as its
+     * detail message.
+     */
+    public InvalidNodeTypeDefinitionException() {
+        super();
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public InvalidNodeTypeDefinitionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message and root cause.
+     *
+     * @param message   the detail message. The detail message is saved for
+     *                  later retrieval by the {@link #getMessage()} method.
+     * @param rootCause root failure cause
+     */
+    public InvalidNodeTypeDefinitionException(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified root cause.
+     *
+     * @param rootCause root failure cause
+     */
+    public InvalidNodeTypeDefinitionException(Throwable rootCause) {
+        super(rootCause);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeDefinitionTemplate.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype.jsr283;
+
+import javax.jcr.nodetype.NodeDefinition;
+
+/**
+ * The <code>NodeDefinitionTemplate</code> interface extends
+ * <code>NodeDefinition</code> with the addition of write methods, enabling the
+ * characteristics of a child node definition to be set, after which the
+ * <code>NodeDefinitionTemplate</code> is added to a <code>NodeTypeTemplate</code>.
+ * <p/>
+ * See the corresponding <code>get<code/> methods for each attribute in
+ * <code>NodeDefinition</code> for the default values assumed when a new empty
+ * <code>NodeDefinitionTemplate</code> is created (as opposed to one extracted
+ * from an existing <code>NodeType</code>).
+ *
+ * @since JCR 2.0
+ */
+public interface NodeDefinitionTemplate extends NodeDefinition {
+
+    /**
+     * Sets the name of the node.
+     *
+     * @param name a <code>String</code>.
+     */
+    public void setName(String name);
+
+    /**
+     * Sets the auto-create status of the node.
+     *
+     * @param autoCreated a <code>boolean</code>.
+     */
+    public void setAutoCreated(boolean autoCreated);
+
+    /**
+     * Sets the mandatory status of the node.
+     *
+     * @param mandatory a <code>boolean</code>.
+     */
+    public void setMandatory(boolean mandatory);
+
+    /**
+     * Sets the on-parent-version status of the node.
+     *
+     * @param opv an <code>int</code> constant member of <code>OnParentVersionAction</code>.
+     */
+    public void setOnParentVersion(int opv);
+
+    /**
+     * Sets the protected status of the node.
+     *
+     * @param protectedStatus a <code>boolean</code>.
+     */
+    public void setProtected(boolean protectedStatus);
+
+    /**
+     * Sets the required primary types of this node.
+     *
+     * @param requiredPrimaryTypes a <code>String</code> array.
+     */
+    public void setRequiredPrimaryTypes(String[] requiredPrimaryTypes);
+
+    /**
+     * Sets the default primary type of this node.
+     *
+     * @param defaultPrimaryType a <code>String</code>.
+     */
+    public void setDefaultPrimaryType(String defaultPrimaryType);
+
+
+    /**
+     * Sets the same-name sibling status of this node.
+     *
+     * @param allowSameNameSiblings a <code>boolean</code>.
+     */
+    public void setSameNameSiblings(boolean allowSameNameSiblings);
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeDefinition.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype.jsr283;
+
+import javax.jcr.nodetype.PropertyDefinition;
+import javax.jcr.nodetype.NodeDefinition;
+
+/**
+ * The <code>NodeTypeDefinition</code> interface provides methods for
+ * discovering the static definition of a node type. These are accessible both
+ * before and after the node type is registered. Its subclass
+ * <code>NodeType</code> adds methods that are relevant only when the node type
+ * is "live"; that is, after it has been registered. Note that the separate
+ * <code>NodeDefinition</code> interface only plays a significant role in
+ * implementations that support node type registration. In those cases it serves
+ * as the superclass of both <code>NodeType</code> and
+ * <code>NodeTypeTemplate</code>. In implementations that do not support node
+ * type registration, only objects implementing the subinterface
+ * <code>NodeType</code> will be encountered.
+ *
+ * @since JCR 2.0
+ */
+public interface NodeTypeDefinition {
+
+    /**
+     * Returns the name of the 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
+     * <code>null</code>.
+     *
+     * @return a <code>String</code>
+     */
+    public String getName();
+
+    /**
+     * 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
+     */
+    public String[] getDeclaredSupertypeNames();
+
+    /**
+     * 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>
+     */
+    public boolean isAbstract();
+
+    /**
+     * Returns <code>true</code> if this is a mixin type; returns
+     * <code>false</code> if it is primary.
+     * <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>
+     */
+    public boolean isMixin();
+
+    /**
+     * Returns <code>true</code> if nodes of this type must support orderable
+     * child nodes; returns <code>false</code> otherwise. If a node type returns
+     * <code>true</code> on a call to this method, then all nodes of that node
+     * type <i>must</i> support the method <code>Node.orderBefore</code>. If a
+     * node type returns <code>false</code> on a call to this method, then nodes
+     * of that node type <i>may</i> support <code>Node.orderBefore</code>. Only
+     * the primary node type of a node controls that node's status in this regard.
+     * This setting on a mixin node type will not have any effect on the node.
+     * <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>
+     */
+    public boolean hasOrderableChildNodes();
+
+    /**
+     * Returns the name of the primary item (one of the child items of the nodes
+     * of this node type). If this node has no primary item, then this method
+     * returns <code>null</code>. This indicator is used by the method
+     * <code>Node.getPrimaryItem()</code>.
+     * <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>null</code>.
+     *
+     * @return a <code>String</code>
+     */
+    public String getPrimaryItemName();
+
+    /**
+     * Returns an array containing the property definitions 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
+     * <code>null</code>.
+     *
+     * @return an array of <code>PropertyDefinition</code>s
+     */
+    public PropertyDefinition[] getDeclaredPropertyDefinitions();
+
+    /**
+     * Returns an array containing the child node definitions 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
+     * <code>null</code>.
+     *
+     * @return an array of <code>NodeDefinition</code>s
+     */
+    public NodeDefinition[] getDeclaredChildNodeDefinitions();
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeExistsException.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,51 @@
+package org.apache.jackrabbit.core.nodetype.jsr283;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Exception thrown when an attempt is made to register a node type that already exisits,
+ * and <code>allowUpdate</code> has not been set to <code>true</code>.
+ *
+ * @since JCR 2.0
+ */
+public class NodeTypeExistsException extends RepositoryException {
+    /**
+     * Constructs a new instance of this class with <code>null</code> as its
+     * detail message.
+     */
+    public NodeTypeExistsException() {
+        super();
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public NodeTypeExistsException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified detail
+     * message and root cause.
+     *
+     * @param message   the detail message. The detail message is saved for
+     *                  later retrieval by the {@link #getMessage()} method.
+     * @param rootCause root failure cause
+     */
+    public NodeTypeExistsException(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+
+    /**
+     * Constructs a new instance of this class with the specified root cause.
+     *
+     * @param rootCause root failure cause
+     */
+    public NodeTypeExistsException(Throwable rootCause) {
+        super(rootCause);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/NodeTypeTemplate.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype.jsr283;
+
+import java.util.List;
+
+/**
+ * The <code>NodeTypeTemplate</code> interface represents a simple container
+ * structure used to define node types which are then registered through the
+ * <code>NodeTypeManager.registerNodeType</code> method.
+ * <p/>
+ * <code>NodeTypeTemplate</code>, like <code>NodeType</code>, is a subclass of
+ * <code>NodeTypeDefinition</code> so it shares with <code>NodeType</code> those
+ * methods that are relevant to a static definition. In addition,
+ * <code>NodeTypeTemplate</code> provides methods for setting the attributes of
+ * the definition. Implementations of this interface need not contain any
+ * validation logic.
+ * <p/>
+ * See the corresponding <code>get</code> methods for each attribute in
+ * <code>NodeTypeDefinition</code> for the default values assumed when a new
+ * empty <code>NodeTypeTemplate</code> is created (as opposed to one extracted
+ * from an existing <code>NodeType</code>).
+ *
+ * @since JCR 2.0
+ */
+public interface NodeTypeTemplate extends NodeTypeDefinition {
+
+    /**
+     * Sets the name of the node type.
+     *
+     * @param name a <code>String</code>.
+     */
+    public void setName(String name);
+
+    /**
+     * Sets the names of the supertypes of the node type.
+     *
+     * @param names a <code>String</code> array.
+     */
+    public void setDeclaredSuperTypeNames(String[] names);
+
+    /**
+     * Sets the abstract flag of the node type.
+     *
+     * @param abstractStatus a <code>boolean</code>.
+     */
+    public void setAbstract(boolean abstractStatus);
+
+    /**
+     * Sets the mixin flag of the node type.
+     *
+     * @param mixin a <code>boolean</code>.
+     */
+    public void setMixin(boolean mixin);
+
+    /**
+     * Sets the orderable child nodes flag of the node type.
+     *
+     * @param orderable a <code>boolean</code>.
+     */
+    public void setOrderableChildNodes(boolean orderable);
+
+    /**
+     * Sets the name of the primary item.
+     *
+     * @param name a <code>String</code>.
+     */
+    public void setPrimaryItemName(String name);
+
+    /**
+     * Returns a mutable <code>List</code> of <code>PropertyDefinitionTemplate</code>
+     * objects. To define a new <code>NodeTypeTemplate</code> or change an
+     * existing one, <code>PropertyDefinitionTemplate</code> objects can be
+     * added to or removed from this <code>List</code>.
+     *
+     * @return a mutable <code>List</code> of <code>PropertyDefinitionTemplate</code> objects.
+     */
+    public List getPropertyDefinitionTemplates();
+
+    /**
+     * Returns a mutable <code>List</code> of <code>NodeDefinitionTemplate</code>
+     * objects. To define a new <code>NodeTypeTemplate</code> or change an
+     * existing one, <code>NodeDefinitionTemplate</code> objects can be added
+     * to or removed from this <code>List</code>.
+     *
+     * @return a mutable <code>List</code> of <code>NodeDefinitionTemplate</code> objects.
+     */
+    public List getNodeDefinitionTemplates();
+}

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java?rev=581641&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/jsr283/PropertyDefinitionTemplate.java Wed Oct  3 08:57:30 2007
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jackrabbit.core.nodetype.jsr283;
+
+import javax.jcr.Value;
+import javax.jcr.nodetype.PropertyDefinition;
+
+/**
+ * The <code>PropertyDefinitionTemplate</code> interface extends
+ * <code>PropertyDefinition</code> with the addition of write methods, enabling the
+ * characteristics of a child property definition to be set, after which the
+ * <code>PropertyDefinitionTemplate</code> is added to a <code>NodeTypeTemplate</code>.
+ * <p/>
+ * See the corresponding <code>get</code> methods for each attribute in
+ * <code>PropertyDefinition</code> for the default values assumed when a new
+ * empty <code>PropertyDefinitionTemplate</code> is created (as opposed to one
+ * extracted from an existing <code>NodeType</code>).
+ *
+ * @since JCR 2.0
+ */
+public interface PropertyDefinitionTemplate extends PropertyDefinition {
+
+    /**
+     * Sets the name of the property.
+     *
+     * @param name a <code>String</code>.
+     */
+    public void setName(String name);
+
+    /**
+     * Sets the auto-create status of the property.
+     *
+     * @param autoCreated a <code>boolean</code>.
+     */
+    public void setAutoCreated(boolean autoCreated);
+
+    /**
+     * Sets the mandatory status of the property.
+     *
+     * @param mandatory a <code>boolean</code>.
+     */
+    public void setMandatory(boolean mandatory);
+
+    /**
+     * Sets the on-parent-version status of the property.
+     *
+     * @param opv an <code>int</code> constant member of <code>OnParentVersionAction</code>.
+     */
+    public void setOnParentVersion(int opv);
+
+    /**
+     * Sets the protected status of the property.
+     *
+     * @param protectedStatus a <code>boolean</code>.
+     */
+    public void setProtected(boolean protectedStatus);
+
+    /**
+     * Sets the required type of the property.
+     *
+     * @param type an <code>int</code> constant member of <code>PropertyType</code>.
+     */
+    public void setRequiredType(int type);
+
+    /**
+     * Sets the value constraints of the property.
+     *
+     * @param constraints a <code>String</code> array.
+     */
+    public void setValueConstarints(String[] constraints);
+
+    /**
+     * Sets the default value (or values, in the case of a multi-value property) of the property.
+     *
+     * @param defaultValues a <code>Value</code> array.
+     */
+    public void setDefaultValues(Value[] defaultValues);
+
+    /**
+     * Sets the multi-value status of the property.
+     *
+     * @param multiple a <code>boolean</code>.
+     */
+    public void setMultiple(boolean multiple);
+}