jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r782921 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype: compact/CompactNodeTypeDefReader.java xml/NodeTypeReader.java
Date Tue, 09 Jun 2009 08:59:00 GMT
Author: angela
Date: Tue Jun  9 08:58:59 2009
New Revision: 782921

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

- use valuefactory that supports 283 features

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java?rev=782921&r1=782920&r2=782921&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/compact/CompactNodeTypeDefReader.java
Tue Jun  9 08:58:59 2009
@@ -26,19 +26,22 @@
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDefinitionImpl;
 import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.core.value.InternalValueFactory;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.Lexer;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 import org.apache.jackrabbit.spi.commons.query.qom.Operator;
+import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
+import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.value.ValueHelper;
-import org.apache.jackrabbit.value.ValueFactoryImpl;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
@@ -163,17 +166,27 @@
     /**
      * the current namespace mapping
      */
-    private NamespaceMapping nsMapping;
+    private final NamespaceMapping nsMapping;
 
     /**
      * Name and Path resolver
      */
-    private NamePathResolver resolver;
+    private final NamePathResolver resolver;
+
+    /**
+     * Value factory
+     */
+    private final ValueFactory valueFactory;
+
+    /**
+     * Factory for InternalValue(s)
+     */
+    private final QValueFactory qValueFactory = InternalValueFactory.getInstance();
 
     /**
      * the underlying lexer
      */
-    private Lexer lexer;
+    private final Lexer lexer;
 
     /**
      * the current token
@@ -202,6 +215,8 @@
         lexer = new Lexer(r, systemId);
         this.nsMapping = mapping;
         this.resolver = new DefaultNamePathResolver(nsMapping);
+        valueFactory = new ValueFactoryQImpl(qValueFactory, resolver);
+
         nextToken();
         parse();
     }
@@ -593,15 +608,15 @@
         if (!currentTokenEquals(Lexer.DEFAULT)) {
             return;
         }
-        List defaultValues = new ArrayList();
+        List<InternalValue> defaultValues = new ArrayList();
         do {
             nextToken();
             InternalValue value = null;
             try {
                 Value v = ValueHelper.convert(
                         currentToken, pdi.getRequiredType(),
-                        ValueFactoryImpl.getInstance());
-                value = InternalValue.create(v, resolver);
+                        valueFactory);
+                value = (InternalValue) ValueFormat.getQValue(v, resolver, qValueFactory);
             } catch (ValueFormatException e) {
                 lexer.fail("'" + currentToken + "' is not a valid string"
                         + " representation of a value of type " + pdi.getRequiredType());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java?rev=782921&r1=782920&r2=782921&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeReader.java
Tue Jun  9 08:58:59 2009
@@ -27,17 +27,22 @@
 import org.apache.jackrabbit.core.nodetype.ValueConstraint;
 import org.apache.jackrabbit.core.util.DOMWalker;
 import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.core.value.InternalValueFactory;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
+import org.apache.jackrabbit.spi.commons.value.ValueFactoryQImpl;
+import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.value.ValueHelper;
-import org.apache.jackrabbit.value.ValueFactoryImpl;
 
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.NamespaceException;
+import javax.jcr.ValueFactory;
+import javax.jcr.Value;
 import javax.jcr.query.qom.QueryObjectModelConstants;
 import javax.jcr.version.OnParentVersionAction;
 import java.io.IOException;
@@ -87,6 +92,10 @@
     /** The name, path resolver. */
     private final NamePathResolver resolver;
 
+    private final ValueFactory valueFactory;
+
+    private final QValueFactory qValueFactory = InternalValueFactory.getInstance();
+
     /**
      * Creates a node type definition file reader.
      *
@@ -98,6 +107,7 @@
         namespaces = walker.getNamespaces();
         NamespaceResolver nsResolver = new AdditionalNamespaceResolver(namespaces);
         resolver = new DefaultNamePathResolver(nsResolver);
+        valueFactory = new ValueFactoryQImpl(qValueFactory, resolver);
     }
 
     /**
@@ -284,7 +294,7 @@
 
         // default values
         if (walker.enterElement(Constants.DEFAULTVALUES_ELEMENT)) {
-            List values = new ArrayList();
+            List<InternalValue> values = new ArrayList();
             int type = def.getRequiredType();
             if (type == PropertyType.UNDEFINED) {
                 type = PropertyType.STRING;
@@ -292,8 +302,8 @@
             while (walker.iterateElements(Constants.DEFAULTVALUE_ELEMENT)) {
                 String value = walker.getContent();
                 try {
-                    values.add(InternalValue.create(ValueHelper.convert(
-                            value, type, ValueFactoryImpl.getInstance()), resolver));
+                    Value v = ValueHelper.convert(value, type, valueFactory);
+                    values.add((InternalValue) ValueFormat.getQValue(v, resolver, qValueFactory));
                 } catch (RepositoryException e) {
                     throw new InvalidNodeTypeDefException(
                             "Unable to create default value: " + value, e);



Mime
View raw message