jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r159678 - in incubator/jackrabbit/trunk/src: java/org/apache/jackrabbit/core/nodetype/ java/org/apache/jackrabbit/core/nodetype/xml/ test/org/apache/jackrabbit/core/nodetype/xml/
Date Fri, 01 Apr 2005 10:47:12 GMT
Author: tripod
Date: Fri Apr  1 02:47:09 2005
New Revision: 159678

URL: http://svn.apache.org/viewcvs?view=rev&rev=159678
Log:
JCR-92 - Change defaultValues format in NodeTypes XML to jcr value

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/ItemDefFormat.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeDefFormat.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeFormat.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/PropDefFormat.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/ChildItemDef.java
Fri Apr  1 02:47:09 2005
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.core.nodetype;
 
-import org.apache.jackrabbit.core.NamespaceRegistryImpl;
 import org.apache.jackrabbit.core.QName;
 import org.apache.jackrabbit.core.Constants;
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.xml
Fri Apr  1 02:47:09 2005
@@ -168,7 +168,7 @@
         <propertyDef name="jcr:protected" requiredType="Boolean" autoCreate="false" mandatory="true"
onParentVersion="COPY" protected="false" multiple="false"/>
         <propertyDef name="jcr:requiredPrimaryTypes" requiredType="Name" autoCreate="false"
mandatory="true" onParentVersion="COPY" protected="false" multiple="true">
             <defaultValues>
-                <defaultValue>{http://www.jcp.org/jcr/nt/1.0}base</defaultValue>
+                <defaultValue>nt:base</defaultValue>
             </defaultValues>
         </propertyDef>
         <propertyDef name="jcr:defaultPrimaryType" requiredType="Name" autoCreate="false"
mandatory="false" onParentVersion="COPY" protected="false" multiple="false"/>
@@ -374,4 +374,4 @@
         </supertypes>
     </nodeType>
 
-</nodeTypes>
\ No newline at end of file
+</nodeTypes>

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/ItemDefFormat.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/ItemDefFormat.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/ItemDefFormat.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/ItemDefFormat.java
Fri Apr  1 02:47:09 2005
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.nodetype.xml;
 
 import javax.jcr.version.OnParentVersionAction;
+import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.core.NamespaceResolver;
 import org.apache.jackrabbit.core.nodetype.ChildItemDef;
@@ -74,7 +75,7 @@
     /**
      * Writes the item definition to the XML element.
      */
-    protected void write() {
+    protected void write() throws RepositoryException{
         writeName();
         writeAutoCreate();
         writeMandatory();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeDefFormat.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeDefFormat.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeDefFormat.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeDefFormat.java
Fri Apr  1 02:47:09 2005
@@ -24,6 +24,8 @@
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
 import org.w3c.dom.Element;
 
+import javax.jcr.RepositoryException;
+
 /**
  * Utility class for reading and writing node definition XML elements.
  */
@@ -78,7 +80,7 @@
     /**
      * Writes the node definition to the XML element.
      */
-    protected void write() {
+    protected void write() throws RepositoryException {
         super.write();
         writeRequiredPrimaryTypes();
         writeDefaultPrimaryType();

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeFormat.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeFormat.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeFormat.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeFormat.java
Fri Apr  1 02:47:09 2005
@@ -26,6 +26,8 @@
 import org.apache.jackrabbit.core.nodetype.PropDef;
 import org.w3c.dom.Element;
 
+import javax.jcr.RepositoryException;
+
 /**
  * Utility class for reading and writing node type definition XML elements.
  */
@@ -53,7 +55,6 @@
     /** Name of the supertype element. */
     private static final String SUPERTYPE_ELEMENT = "supertype";
 
-
     /** The node type definition. */
     private final NodeTypeDef def;
 
@@ -89,7 +90,7 @@
     /**
      * Writes the node type definition to the XML element.
      */
-    protected void write() {
+    protected void write() throws RepositoryException {
         writeName();
         writeSupertypes();
         writeIsMixin();
@@ -242,7 +243,7 @@
     /**
      * Writes the property definitions of the node type definition.
      */
-    private void writePropertyDefinitions() {
+    private void writePropertyDefinitions() throws RepositoryException {
         PropDef[] defs = def.getPropertyDefs();
         for (int i = 0; i < defs.length; i++) {
             PropDef property = defs[i];
@@ -282,7 +283,7 @@
     /**
      * Writes the child node definitions of the node type definition.
      */
-    private void writeChildNodeDefinitions() {
+    private void writeChildNodeDefinitions() throws RepositoryException {
         ChildNodeDef[] defs = def.getChildNodeDefs();
         for (int i = 0; i < defs.length; i++) {
             ChildNodeDef node = defs[i];

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/PropDefFormat.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/PropDefFormat.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/PropDefFormat.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/xml/PropDefFormat.java
Fri Apr  1 02:47:09 2005
@@ -19,6 +19,7 @@
 import java.util.Vector;
 
 import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.core.InternalValue;
 import org.apache.jackrabbit.core.NamespaceResolver;
@@ -88,7 +89,7 @@
     /**
      * Writes the property definition to the XML element.
      */
-    protected void write() {
+    protected void write() throws RepositoryException {
         super.write();
         writeRequiredType();
         writeValueConstraints();
@@ -138,8 +139,8 @@
                 }
             }
 
-            def.setValueConstraints(
-                    (ValueConstraint[]) vector.toArray(new ValueConstraint[0]));
+            def.setValueConstraints((ValueConstraint[])
+                    vector.toArray(new ValueConstraint[vector.size()]));
         }
     }
 
@@ -151,7 +152,7 @@
         if (constraints != null && constraints.length > 0) {
             Vector values = new Vector();
             for (int i = 0; i < constraints.length; i++) {
-                values.add(constraints[i].getDefinition());
+                values.add(constraints[i].getDefinition(getNamespaceResolver()));
             }
             setGrandChildContents(
                     VALUECONSTRAINTS_ELEMENT, VALUECONSTRAINT_ELEMENT, values);
@@ -161,7 +162,7 @@
     /**
      * Reads and sets the default values of the property definition.
      */
-    private void readDefaultValues() {
+    private void readDefaultValues() throws InvalidNodeTypeDefException {
         String[] defaults = getGrandChildContents(
                 DEFAULTVALUES_ELEMENT, DEFAULTVALUE_ELEMENT);
         if (defaults != null) {
@@ -172,23 +173,27 @@
                 type = PropertyType.STRING;
             }
             for (int i = 0; i < defaults.length; i++) {
-                vector.add(InternalValue.valueOf(defaults[i], type));
+                try {
+                    vector.add(InternalValue.create(defaults[i], type, getNamespaceResolver()));
+                } catch (RepositoryException e) {
+                    throw new InvalidNodeTypeDefException(e);
+                }
             }
 
-            def.setDefaultValues(
-                    (InternalValue[]) vector.toArray(new InternalValue[0]));
+            def.setDefaultValues((InternalValue[])
+                    vector.toArray(new InternalValue[vector.size()]));
         }
     }
 
     /**
      * Writes the default values of the property definition.
      */
-    private void writeDefaultValues() {
+    private void writeDefaultValues() throws RepositoryException {
         InternalValue[] defaults = def.getDefaultValues();
         if (defaults != null && defaults.length > 0) {
             Vector values = new Vector();
             for (int i = 0; i < defaults.length; i++) {
-                values.add(defaults[i].toString());
+                values.add(defaults[i].toJCRValue(getNamespaceResolver()).getString());
             }
             setGrandChildContents(
                     DEFAULTVALUES_ELEMENT, DEFAULTVALUE_ELEMENT, values);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/TestAll.java?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/TestAll.java
Fri Apr  1 02:47:09 2005
@@ -395,7 +395,7 @@
         assertEquals("nameProperty valueConstraints",
                 1, def.getValueConstraints().length);
         assertEquals("nameProperty valueConstraints[0]",
-                "{test-namespace}testName",
+                "test:testName",
                 (def.getValueConstraints())[0].getDefinition());
         assertEquals("nameProperty defaultValues",
                 1, def.getDefaultValues().length);
@@ -411,7 +411,7 @@
         assertEquals("pathProperty valueConstraints",
                 1, def.getValueConstraints().length);
         assertEquals("pathProperty valueConstraints[0]",
-                "/{test-namespace}testPath",
+                "/test:testPath",
                 (def.getValueConstraints())[0].getDefinition());
         assertEquals("pathProperty defaultValues",
                 0, def.getDefaultValues().length);
@@ -425,7 +425,7 @@
         assertEquals("referenceProperty valueConstraints",
                 1, def.getValueConstraints().length);
         assertEquals("referenceProperty valueConstraints[0]",
-                "{test-namespace}testType",
+                "test:testType",
                 (def.getValueConstraints())[0].getDefinition());
         assertEquals("referenceProperty defaultValues",
                 0, def.getDefaultValues().length);

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml?view=diff&r1=159677&r2=159678
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml
Fri Apr  1 02:47:09 2005
@@ -127,24 +127,24 @@
                  requiredType="Name" autoCreate="false" mandatory="false"
                  onParentVersion="IGNORE" protected="false" multiple="false">
       <valueConstraints>
-        <valueConstraint>{test-namespace}testName</valueConstraint>
+        <valueConstraint>test:testName</valueConstraint>
       </valueConstraints>
       <defaultValues>
-        <defaultValue>{test-namespace}testName</defaultValue>
+        <defaultValue>test:testName</defaultValue>
       </defaultValues>
     </propertyDef>
     <propertyDef name="test:pathProperty"
                  requiredType="Path" autoCreate="false" mandatory="false"
                  onParentVersion="IGNORE" protected="false" multiple="false">
       <valueConstraints>
-        <valueConstraint>/{test-namespace}testPath</valueConstraint>
+        <valueConstraint>/test:testPath</valueConstraint>
       </valueConstraints>
     </propertyDef>
     <propertyDef name="test:referenceProperty"
                  requiredType="Reference" autoCreate="false" mandatory="false"
                  onParentVersion="IGNORE" protected="false" multiple="false">
       <valueConstraints>
-        <valueConstraint>{test-namespace}testType</valueConstraint>
+        <valueConstraint>test:testType</valueConstraint>
       </valueConstraints>
     </propertyDef>
     <propertyDef name="test:stringProperty"
@@ -188,4 +188,4 @@
     </childNodeDef>
   </nodeType>
 
-</nodeTypes>
\ No newline at end of file
+</nodeTypes>



Mime
View raw message