jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r563252 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src: dtd/ main/java/org/apache/jackrabbit/ocm/manager/impl/ main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ main/java/org/apache/jackrabbit/ocm/mapp...
Date Mon, 06 Aug 2007 20:18:47 GMT
Author: clombart
Date: Mon Aug  6 13:18:46 2007
New Revision: 563252

URL: http://svn.apache.org/viewvc?view=rev&rev=563252
Log:
* Remove fieldType. this attribute is not used in the object mapping. 
* Review one constructor in ObjectContentManagerImpl.

Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/dtd/jackrabbit-ocm.dtd
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/ClassDescriptor.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/FieldDescriptor.java

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/dtd/jackrabbit-ocm.dtd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/dtd/jackrabbit-ocm.dtd?view=diff&rev=563252&r1=563251&r2=563252
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/dtd/jackrabbit-ocm.dtd
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/dtd/jackrabbit-ocm.dtd
Mon Aug  6 13:18:46 2007
@@ -57,7 +57,6 @@
 <!--
     Field descriptor - A field descriptor maps one atomic object attribute (primitive types,
String, Long, ...)  into a JCR property
     * fieldName : the field/attribute name
-    * fieldType: the primitive type or fully qualified class name of the field (optional)
     * jcrName : the jcr property name (optional). If it is not defined, fieldname is used
to specify the jcr property name
     * id : specifies if the field is an id. Id is optional. If the class contains an id field,
some process can run faster
     * path : specified if the field is the object path
@@ -65,7 +64,7 @@
     * converter : AtomicTypeConverter class name to used for this field descriptor. If not
defined, a default one is provided by default in function of the field type
     * jcrDefaultValue : if the field is null, this default value will be used, optional
     * jcrValueConstraints : a comma separated list of acceptable values, optional
-    * jcrType: specifies the JCR property type (supported jcr property types: STRING, DATE,
LONG, DOUBLE, BOOLEAN), optional
+    * jcrType: specifies the JCR property type (supported jcr property types: String , Date
, Long , Doube , Boolean , Binary), optional
     * jcrAutoCreated: specifies if this JCR property will be autocreated (true/false / default
is false), optional
     * jcrMandatory: specifies if this JCR property is mandatory (true/false / default is
false), optional
     * jcrOnParentVersion: specifies how this JCR property acts on inherited versioned node
properties (default is COPY), optional
@@ -76,7 +75,6 @@
 <!ELEMENT field-descriptor EMPTY>
 <!ATTLIST field-descriptor
 	fieldName CDATA #REQUIRED
-	fieldType CDATA #IMPLIED
 	jcrName CDATA #IMPLIED 
 	id (true | false) "false"
 	path (true | false) "false"
@@ -84,7 +82,7 @@
 	converter CDATA #IMPLIED
 	jcrDefaultValue CDATA #IMPLIED
 	jcrValueConstraints CDATA #IMPLIED 
-    jcrType (String | Date | Long | Double | Boolean | Binary) #IMPLIED
+    jcrType (String | Date | Long | Doube | Boolean | Binary) #IMPLIED
     jcrAutoCreated (true | false) "false"
     jcrMandatory (true | false) "false"
     jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | IGNORE | ABORT) "COPY"
@@ -127,7 +125,7 @@
 
 <!--
     Collection descriptor - A collection descriptor maps one object attribute based on a
collection (or a map) into a series of JCR nodes.
-    * fieldName : the field/attribute name (matching to the collection attribute)
+    * fieldName : the field/attribute name (matching to the collection attribute), this attribute
is used only with some collection converters.
     * jcrName : the jcr property name (optional). If it is not defined, fieldname is used
to specify the jcr node name
     * proxy : Use lazy loading or not. if true, this attributes is not loaded when the main
object is retrieve. it will be loaded when the get method is called.
     * autoRetrieve : If false, the collection associated to this descriptor is not retrieved
when the main ojbect is retrieved

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java?view=diff&rev=563252&r1=563251&r2=563252
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
Mon Aug  6 13:18:46 2007
@@ -47,6 +47,7 @@
 import org.apache.jackrabbit.ocm.exception.LockedException;
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.exception.VersionException;
+import org.apache.jackrabbit.ocm.lock.Lock;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
 import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.DefaultAtomicTypeConverterProvider;
 import org.apache.jackrabbit.ocm.manager.cache.ObjectCache;
@@ -63,7 +64,6 @@
 import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
 import org.apache.jackrabbit.ocm.version.Version;
 import org.apache.jackrabbit.ocm.version.VersionIterator;
-import org.apache.jackrabbit.ocm.lock.Lock;
 /**
  *
  * Default implementation for {@link org.apache.jackrabbit.ocm.manager.ObjectContentManager}
@@ -103,23 +103,31 @@
 
     /**
      * Creates a new <code>ObjectContentManager</code> that uses the passed in
-     * <code>Mapper</code>, <code>QueryManager</code> and a default

-     * <code>ObjectConverter</code>
+     * <code>Mapper</code>, and a <code>Session</code>
      *
      * @param mapper the Mapper component
-     * @param queryManager the query manager to used
      * @param session The JCR session
      */
-    public ObjectContentManagerImpl(Mapper mapper,
-                                  QueryManager queryManager,
-                                  Session session) {
-        this.mapper = mapper;
-        this.session = session;
-        this.requestObjectCache = new RequestObjectCacheImpl();        
-        this.objectConverter = new ObjectConverterImpl(mapper, new DefaultAtomicTypeConverterProvider(),
new ProxyManagerImpl(), requestObjectCache);
-        this.queryManager = queryManager;
-        
-        RepositoryUtil.setupSession(session);
+    public ObjectContentManagerImpl(Session session, Mapper mapper) {
+        try 
+        {
+			this.session = session;
+			this.mapper = mapper;
+			// Use default setting for the following dependencies
+			DefaultAtomicTypeConverterProvider converterProvider = new DefaultAtomicTypeConverterProvider();
+			Map atomicTypeConverters = converterProvider.getAtomicTypeConverters();
+			this.queryManager = new QueryManagerImpl(mapper, atomicTypeConverters, session.getValueFactory());
+			this.requestObjectCache = new RequestObjectCacheImpl();        
+			this.objectConverter = new ObjectConverterImpl(mapper, converterProvider, new ProxyManagerImpl(),
requestObjectCache);
+			
+			RepositoryUtil.setupSession(session);
+		} 
+        catch (RepositoryException e) 
+        {
+            throw new org.apache.jackrabbit.ocm.exception.RepositoryException(
+                    "Impossible to instantiate the object content manager", e);
+
+		}
 
     }
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java?view=diff&rev=563252&r1=563251&r2=563252
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
Mon Aug  6 13:18:46 2007
@@ -276,9 +276,7 @@
 		else
 		{
 			// Get the default atomic converter in function of the classname
-			if (null != fd.getFieldTypeClass()) {
-				fieldTypeClass = fd.getFieldTypeClass();
-			} else if (null != object) {
+			 if (null != object) {
 				fieldTypeClass = ReflectionUtils.getPropertyType(object, fieldName);
 			}
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/ClassDescriptor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/ClassDescriptor.java?view=diff&rev=563252&r1=563251&r2=563252
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/ClassDescriptor.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/ClassDescriptor.java
Mon Aug  6 13:18:46 2007
@@ -133,7 +133,10 @@
      * @param jcrNodeType The jcrNodeType to set.
      */
     public void setJcrNodeType(String jcrNodeType) {
-        this.jcrNodeType = jcrNodeType;
+    	if (jcrNodeType != null && ! jcrNodeType.equals(""))
+    	{
+    	   this.jcrNodeType = jcrNodeType;
+    	}
     }
 
     /**
@@ -330,7 +333,12 @@
      * @param superTypes Comma separated list of JCR node super types
      */
     public void setJcrSuperTypes(String superTypes) {
-        this.jcrSuperTypes = superTypes;
+
+    	if (superTypes != null && ! superTypes.equals(""))
+    	{
+    	   this.jcrSuperTypes = superTypes;
+    	}
+    	
     }
 
     /**
@@ -352,7 +360,12 @@
             jcrMixinTypes = mixinTypes[0].split(" *, *");
         }
     }
-
+    public void setJcrMixinTypes(String mixinTypes) {                
+    	if (mixinTypes != null && ! mixinTypes.equals(""))
+    	{
+    	    jcrMixinTypes = mixinTypes.split(" *, *");
+    	}
+    }
     /**
      * @return Returns the mappingDescriptor.
      */
@@ -424,7 +437,8 @@
      * @param className
      */
     public void setExtend(String className) {
-        this.superClassName = className;
+        if (className.equals("")) className = null;
+    	this.superClassName = className;
     }
 
     /**
@@ -539,33 +553,12 @@
             if (!merged.containsKey(collectionDescriptor.getFieldName())) {
                 merged.put(collectionDescriptor.getFieldName(), collectionDescriptor);
             }
-//            else {
-//                log.warn("Collection name conflict in " + this.className + " - field :
" +collectionDescriptor.getFieldName() + " -  this  field name is also defined  in the ancestor
class : " + this.getExtend());
-//            }
         }
 
         return merged;
     }    
     
-    
-//    private List mergeInterfaces(List  existing, Collection superSource) {
-//        if (null == superSource) {
-//            return existing;
-//        }
-//
-//        ArrayList merged = new ArrayList(existing);
-//        for (Iterator it = superSource.iterator(); it.hasNext();)
-//        {
-//             String interfaceName = (String) it.next();
-//             if (! merged.contains(interfaceName))
-//             {
-//            	     merged.add(interfaceName);
-//             }            	 
-//        }
-//        
-//        return merged;
-//    }    
-    
+       
     
 	public String toString() {
 		return "Class Descriptor : " +  this.getClassName();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/FieldDescriptor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/FieldDescriptor.java?view=diff&rev=563252&r1=563251&r2=563252
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/FieldDescriptor.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/model/FieldDescriptor.java
Mon Aug  6 13:18:46 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.ocm.mapper.model;
 
-import org.apache.jackrabbit.ocm.exception.JcrMappingException;
-import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
 
 
 /**
@@ -29,9 +27,7 @@
  *
  */
 public class FieldDescriptor implements PropertyDefDescriptor {
-    private String fieldName;
-    private String fieldType;
-    private Class fieldTypeClass;
+    private String fieldName;    
     private String jcrName;
     private String jcrType;
     private boolean jcrAutoCreated;
@@ -62,39 +58,6 @@
         this.fieldName = fieldName;
     }
 
-    /**
-     * @return the primitive or fully qualified class of the field
-     * or <tt>null</tt> if not specified in the mapping
-     */
-    public String getFieldType() {
-        return this.fieldType;
-    }
-
-    /**
-     * Sets the type of the field. It supports primitive types, specified as
-     * int, long, etc or fully qualified class names.
-     *
-     * @param fieldType the type of the field
-     */
-    public void setFieldType(String fieldType) {
-        this.fieldType = fieldType;
-    }
-
-    /**
-     * @return the field class of the field
-     * or <tt>null</tt> if not specified in the mapping
-     * or if the class was not found
-     */
-    public Class getFieldTypeClass() {
-        if (this.fieldType == null) {
-            return null;
-        }
-        if (this.fieldTypeClass == null) {
-            this.fieldTypeClass = loadFieldTypeClass();
-        }
-
-        return this.fieldTypeClass;
-    }
 
     /**
      * @return Returns the jcrName.
@@ -300,51 +263,14 @@
         }
 
 	}
-
-	/**
-     * Initialize the fieldTypeClass.
-     *
-     * @return the primitive class or the class accordign to fieldType
-     */
-    private Class loadFieldTypeClass() {
-        if (this.fieldType == null) {
-            return null;
-        }
-        if ("byte".equals(this.fieldType)) {
-            return byte.class;
-        }
-        else if ("short".equals(this.fieldType)) {
-            return short.class;
-        }
-        else if ("int".equals(this.fieldType)) {
-            return int.class;
-        }
-        else if ("long".equals(this.fieldType)) {
-            return long.class;
-        }
-        else if ("float".equals(this.fieldType)) {
-            return float.class;
-        }
-        else if ("double".equals(this.fieldType)) {
-            return double.class;
-        }
-        else if ("char".equals(this.fieldType)) {
-            return char.class;
-        }
-        else if ("boolean".equals(this.fieldType)) {
-            return boolean.class;
-        }
-        else {
-            try {
-                return ReflectionUtils.forName(this.fieldType);
-            }
-            catch (JcrMappingException jme) {
-                ; // nothing to do; it will be dynamically determined
-            }
-        }
-
-        return null;
+	
+    public void setJcrValueConstraints(String jcrValueConstraints) {                
+    	if (jcrValueConstraints != null && ! jcrValueConstraints.equals(""))
+    	{
+    		this.jcrValueConstraints = jcrValueConstraints.split(" *, *");
+    	}
     }
+
     
 	public String toString() {
 		



Mime
View raw message