jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r762675 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype: NodeTypeImpl.java NodeTypeManagerImpl.java
Date Wed, 08 Apr 2009 04:09:59 GMT
Author: angela
Date: Tue Apr  7 10:23:49 2009
New Revision: 762675

URL: http://svn.apache.org/viewvc?rev=762675&view=rev
Log:
minor improvement: Use ValueFactory exposed by Session instead of accessing instance of commons
ValueFactoryImpl directly.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java?rev=762675&r1=762674&r2=762675&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeImpl.java
Tue Apr  7 10:23:49 2009
@@ -22,7 +22,6 @@
 import org.apache.jackrabbit.api.jsr283.nodetype.NodeTypeDefinition;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.value.ValueFactoryImpl;
 import org.apache.jackrabbit.value.ValueHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,6 +30,7 @@
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
@@ -51,6 +51,8 @@
     private final NodeTypeManagerImpl ntMgr;
     // resolver used to translate qualified names to JCR names
     private final NamePathResolver resolver;
+    // value factory used for type conversion
+    private final ValueFactory valueFactory;
     private final DataStore store;
 
     /**
@@ -66,10 +68,12 @@
      * @param resolver
      */
     NodeTypeImpl(EffectiveNodeType ent, NodeTypeDef ntd,
-                 NodeTypeManagerImpl ntMgr, NamePathResolver resolver, DataStore store) {
+                 NodeTypeManagerImpl ntMgr, NamePathResolver resolver,
+                 ValueFactory valueFactory, DataStore store) {
         this.ent = ent;
         this.ntMgr = ntMgr;
         this.resolver = resolver;
+        this.valueFactory = valueFactory;
         this.ntd = ntd;
         this.store = store;
     }
@@ -444,7 +448,7 @@
                 // type conversion required
                 Value targetVal = ValueHelper.convert(
                         value, targetType,
-                        ValueFactoryImpl.getInstance());
+                        valueFactory);
                 internalValue = InternalValue.create(targetVal, resolver, store);
             } else {
                 // no type conversion required
@@ -521,8 +525,7 @@
                     if (targetType != type) {
                         // type conversion required
                         Value targetVal = ValueHelper.convert(
-                                values[i], targetType,
-                                ValueFactoryImpl.getInstance());
+                                values[i], targetType, valueFactory);
                         internalValue = InternalValue.create(targetVal, resolver, store);
                     } else {
                         // no type conversion required

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?rev=762675&r1=762674&r2=762675&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Tue Apr  7 10:23:49 2009
@@ -44,6 +44,7 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
+import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
@@ -83,6 +84,11 @@
     private final SessionImpl session;
 
     /**
+     * The value factory obtained from the current session.
+     */
+    private final ValueFactory valueFactory;
+
+    /**
      * The root node definition.
      */
     private final NodeDefinitionImpl rootNodeDef;
@@ -112,11 +118,14 @@
      *
      * @param ntReg      node type registry
      * @param session    current session
+     * @throws RepositoryException If an error occurs.
      */
     public NodeTypeManagerImpl(
-            NodeTypeRegistry ntReg, SessionImpl session, DataStore store) {
+            NodeTypeRegistry ntReg, SessionImpl session, DataStore store)
+            throws RepositoryException {
         this.ntReg = ntReg;
         this.session = session;
+        this.valueFactory = session.getValueFactory();
         this.ntReg.addListener(this);
         this.store = store;
 
@@ -185,7 +194,7 @@
             if (nt == null) {
                 EffectiveNodeType ent = ntReg.getEffectiveNodeType(name);
                 NodeTypeDef def = ntReg.getNodeTypeDef(name);
-                nt = new NodeTypeImpl(ent, def, this, session, store);
+                nt = new NodeTypeImpl(ent, def, this, session, valueFactory, store);
                 ntCache.put(name, nt);
             }
             return nt;



Mime
View raw message