jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r581387 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src: main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/ test/java/org/apache/jackrabbit/ocm/ test/java/org/apache/jackrabbit/ocm/manager/auto/ test/java/org/...
Date Tue, 02 Oct 2007 21:12:47 GMT
Author: clombart
Date: Tue Oct  2 14:12:46 2007
New Revision: 581387

URL: http://svn.apache.org/viewvc?rev=581387&view=rev
Log:
Working on annotations : 
Give the possibility to defined annotations on the attribute declaration and on the getter 
code clean-up
Continue the unit tests (still in progress)

Added:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Implement.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AnnotationAutoTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/DigesterAutoTest.java
      - copied, changed from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/ObjectContentManagerAutoTest.java
Removed:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/ObjectContentManagerAutoTest.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AllTests.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Atomic.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Default.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/CmsObject.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Content.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Document.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Folder.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/CmsObjectImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/ContentImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentStream.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/FolderImpl.java

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java Tue Oct  2 14:12:46 2007
@@ -22,12 +22,17 @@
 import java.beans.PropertyDescriptor;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.exception.InitMapperException;
 import org.apache.jackrabbit.ocm.mapper.DescriptorReader;
 import org.apache.jackrabbit.ocm.mapper.model.BeanDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.FieldDescriptor;
+import org.apache.jackrabbit.ocm.mapper.model.ImplementDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor;
+import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
 
 /**
  * Helper class that reads the xml mapping file and load all class descriptors into memory (object graph)
@@ -37,6 +42,8 @@
  */
 public class AnnotationDescriptorReader implements DescriptorReader
 {
+	private static final Log log = LogFactory.getLog(AnnotationDescriptorReader.class);
+	
 	List<Class> annotatedClassNames;
     public AnnotationDescriptorReader(List<Class> annotatedClassNames)
     {
@@ -59,91 +66,104 @@
 	
 	private ClassDescriptor buildClassDescriptor(MappingDescriptor mappingDescriptor, Class clazz)  
 	{
-		Node annotationNode =  (Node) clazz.getAnnotation(Node.class);
-		ClassDescriptor descriptor = new ClassDescriptor();
-		descriptor.setClassName(clazz.getName());
-		descriptor.setJcrType(annotationNode.jcrType());
-		if (annotationNode.jcrSuperTypes() != null && ! annotationNode.jcrSuperTypes().equals(""))
+		ClassDescriptor classDescriptor = null;
+		
+		Node nodeAnnotation =  (Node) clazz.getAnnotation(Node.class);
+		if (nodeAnnotation != null)
+		{
+			classDescriptor = createClassDescriptor(clazz, nodeAnnotation);			
+			addAttributeDescriptors(mappingDescriptor, classDescriptor, clazz);
+			return classDescriptor;
+		}
+		else
 		{
-		     descriptor.setJcrSuperTypes(annotationNode.jcrSuperTypes());
+			throw  new InitMapperException("The persistent class " + clazz.getName() + " has not @Node annotation");
 		}
+	
+		
 		
-		if (annotationNode.jcrMixinTypes() != null && ! annotationNode.jcrMixinTypes().equals(""))
+	}
+
+	private ClassDescriptor createClassDescriptor(Class clazz, Node nodeAnnotation) 
+	{
+		ClassDescriptor classDescriptor = new ClassDescriptor();
+		classDescriptor.setClassName(clazz.getName());
+		classDescriptor.setJcrType(nodeAnnotation.jcrType());
+		if (nodeAnnotation.jcrSuperTypes() != null && ! nodeAnnotation.jcrSuperTypes().equals(""))
+		{
+		     classDescriptor.setJcrSuperTypes(nodeAnnotation.jcrSuperTypes());
+		}
+		
+		if (nodeAnnotation.jcrMixinTypes() != null && ! nodeAnnotation.jcrMixinTypes().equals(""))
 		{		
-		     descriptor.setJcrMixinTypes(annotationNode.jcrMixinTypes());
+		     classDescriptor.setJcrMixinTypes(nodeAnnotation.jcrMixinTypes());
 		}
 		
-		if (annotationNode.extend() != null && ! annotationNode.extend().equals(""))
+		if (nodeAnnotation.extend() != null && ! nodeAnnotation.extend().equals(Object.class))
 		{
-		     descriptor.setExtend(annotationNode.extend());
+		     classDescriptor.setExtend(nodeAnnotation.extend().getName());
 		}
 		
-		descriptor.setAbstract(annotationNode.isAbstract());
-		descriptor.setInterface(clazz.isInterface());
-		
-		addFieldDescriptors(descriptor, clazz);
-		addBeanDescriptors(descriptor, clazz);
-		addCollectionDescriptors(mappingDescriptor, descriptor, clazz);
-		return descriptor;
+		classDescriptor.setAbstract(nodeAnnotation.isAbstract());
+		classDescriptor.setInterface(clazz.isInterface());
+		return classDescriptor;
 	}
-
-	private void addCollectionDescriptors(MappingDescriptor mappingDescriptor, ClassDescriptor descriptor,Class clazz) {
-		BeanInfo beanInfo;
-		try {
-			beanInfo = Introspector.getBeanInfo(clazz);
-		} catch (IntrospectionException e) {
-			throw new RuntimeException(e);
+	
+	private void addImplementDescriptor(ClassDescriptor classDescriptor, Class clazz) 
+	{
+		Implement implementAnnotation = (Implement) clazz.getAnnotation(Implement.class);
+		if (implementAnnotation != null) 
+		{
+            ImplementDescriptor implementDescriptor =  new ImplementDescriptor();
+            implementDescriptor.setInterfaceName(implementAnnotation.interfaceName().getName());
+            classDescriptor.addImplementDescriptor(implementDescriptor);
 		}
-		PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
-		for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
-			Collection jcrChildNode = propertyDescriptor.getReadMethod().getAnnotation(Collection.class);
-			if (jcrChildNode != null) {
-				Class targetClass = jcrChildNode.type();
-				CollectionDescriptor collectionDescriptor = new CollectionDescriptor();
-				ClassDescriptor classDescriptor = mappingDescriptor.getClassDescriptorByName(targetClass.getName());
-
-				if (classDescriptor == null)
-					throw new RuntimeException(
-							"Unable to reference class "
-									+ targetClass.getName()
-									+ " as a child node since it has not been registered, ordering perhaps?");
-
-				if (jcrChildNode.jcrName() != null && ! jcrChildNode.jcrName().equals(""))
-				{
-				   collectionDescriptor.setJcrName(jcrChildNode.jcrName());
-				}
-				else
-				{
-				   collectionDescriptor.setJcrName(propertyDescriptor.getName());
-				}
-				
-				Node annotationNode = (Node) targetClass.getAnnotation(Node.class);
-				collectionDescriptor.setDefaultPrimaryType(annotationNode.jcrType());
-				collectionDescriptor.setJcrSameNameSiblings(jcrChildNode.sameNameSiblings());
-				collectionDescriptor.setJcrAutoCreated(jcrChildNode.autoCreate());
-				collectionDescriptor.setJcrProtected(jcrChildNode.protect());
-				collectionDescriptor.setJcrOnParentVersion(jcrChildNode.onParentVersion());
-				collectionDescriptor.setJcrMandatory(jcrChildNode.mandatory());
-				collectionDescriptor.setAutoInsert(jcrChildNode.autoInsert());
-				collectionDescriptor.setAutoRetrieve(jcrChildNode.autoRetrieve());
-				collectionDescriptor.setAutoUpdate(jcrChildNode.autoUpdate());
-				collectionDescriptor.setCollectionClassName(propertyDescriptor.getReadMethod().getReturnType().getName());
-				collectionDescriptor.setElementClassName(targetClass.getName());
-				collectionDescriptor.setCollectionConverter(jcrChildNode.converter().getName());
-				collectionDescriptor.setFieldName(propertyDescriptor.getName());
-
-				collectionDescriptor.setJcrType(annotationNode.jcrType());
-				collectionDescriptor.setJcrSameNameSiblings(jcrChildNode.sameNameSiblings());
-				collectionDescriptor.setProxy(jcrChildNode.proxy());
+		
+	}
+	
+	/**
+	 * Add FieldDescriptors, BeanDescriptors and CollectionDescriptors.
+	 * The descriptots can be defined on the getter methods or on the field declation. 
+	 * 
+	 * @param mappingDescriptor The mapping descriptor
+	 * @param classDescriptor the classdescriptor for which the descriptors have to be added
+	 * @param clazz The associated class
+	 */
+	private void addAttributeDescriptors(MappingDescriptor mappingDescriptor, ClassDescriptor classDescriptor,Class clazz) {
+ 
+		addDescriptorsFromFields(mappingDescriptor, classDescriptor, clazz);
+		addDescriptorsFromGetters(mappingDescriptor, classDescriptor, clazz);
+	}
 
-				descriptor.addCollectionDescriptor(collectionDescriptor);
+	private void addDescriptorsFromFields(MappingDescriptor mappingDescriptor, ClassDescriptor classDescriptor, Class clazz) {
+	    
+		java.lang.reflect.Field[] fields = clazz.getDeclaredFields();
+	    for (int index = 0; index < fields.length; index++) 
+	    {
+			Field fieldAnnotation = fields[index].getAnnotation(Field.class);
+			if (fieldAnnotation != null) {
+				addFieldDescriptor(classDescriptor, fields[index].getName(), fieldAnnotation);
+			}
+			
+			// Check if there is an Bean annotation
+			Bean beanAnnotation = fields[index].getAnnotation(Bean.class);
+			if (beanAnnotation != null) {
+				addBeanDescriptor(classDescriptor, fields[index].getName(), beanAnnotation);
 			}
+			
+			// Check if there is an Collection annotation
+			Collection collectionAnnotation = fields[index].getAnnotation(Collection.class);
+			if (collectionAnnotation != null) {
+				addCollectionDescriptor(mappingDescriptor, classDescriptor, fields[index].getName(), 
+						                fields[index].getName(), collectionAnnotation);
+			}
+					
+		   	
 		}
-
+		
 	}
 
-	
-	private void addBeanDescriptors(ClassDescriptor descriptor,Class clazz) {
+	private void addDescriptorsFromGetters(MappingDescriptor mappingDescriptor, ClassDescriptor classDescriptor, Class clazz) {
 		BeanInfo beanInfo;
 		try {
 			beanInfo = Introspector.getBeanInfo(clazz);
@@ -152,103 +172,164 @@
 		}
 		PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
 		for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
-			Bean jcrChildNode = propertyDescriptor.getReadMethod().getAnnotation(Bean.class);
-			if (jcrChildNode != null) {
-				
-				BeanDescriptor beanDescriptor = new BeanDescriptor();
-				beanDescriptor.setFieldName(propertyDescriptor.getName());
-				if (jcrChildNode.jcrName() != null && ! jcrChildNode.jcrName().equals(""))
-				{
-				   beanDescriptor.setJcrName(jcrChildNode.jcrName());
-				}
-				else
-				{
-					beanDescriptor.setJcrName(propertyDescriptor.getName());
-				}
-				
-				beanDescriptor.setProxy(jcrChildNode.proxy());				
-				beanDescriptor.setConverter(jcrChildNode.converter().getName());
-				beanDescriptor.setAutoInsert(jcrChildNode.autoInsert());
-				beanDescriptor.setAutoRetrieve(jcrChildNode.autoRetrieve());
-				beanDescriptor.setAutoUpdate(jcrChildNode.autoUpdate());
-				beanDescriptor.setJcrType(jcrChildNode.jcrType());
-				beanDescriptor.setJcrAutoCreated(jcrChildNode.jcrAutoCreated());
-				beanDescriptor.setJcrMandatory(jcrChildNode.jcrMandatory());
-				beanDescriptor.setJcrOnParentVersion(jcrChildNode.jcrOnParentVersion());
-				beanDescriptor.setJcrProtected(jcrChildNode.jcrProtected());			            
-				beanDescriptor.setJcrSameNameSiblings(jcrChildNode.jcrSameNameSiblings());				
 
-				descriptor.addBeanDescriptor(beanDescriptor);
+			// Check if there is an Field annotation
+			Field fieldAnnotation = propertyDescriptor.getReadMethod().getAnnotation(Field.class);
+			if (fieldAnnotation != null) {
+				addFieldDescriptor(classDescriptor, propertyDescriptor.getName(), fieldAnnotation);
+			}
+			
+			// Check if there is an Bean annotation
+			Bean beanAnnotation = propertyDescriptor.getReadMethod().getAnnotation(Bean.class);
+			if (beanAnnotation != null) {
+				addBeanDescriptor(classDescriptor, propertyDescriptor.getName(), beanAnnotation);
 			}
+			
+			// Check if there is an Collection annotation
+			Collection collectionAnnotation = propertyDescriptor.getReadMethod().getAnnotation(Collection.class);
+			if (collectionAnnotation != null) {
+				addCollectionDescriptor(mappingDescriptor, classDescriptor, propertyDescriptor.getName(), 
+						                propertyDescriptor.getReadMethod().getReturnType().getName(), collectionAnnotation);
+			}
+		}
+	}
+
+
+	private void addCollectionDescriptor(MappingDescriptor mappingDescriptor, ClassDescriptor descriptor,
+			                             String fieldName, String collectionClassName, Collection collectionAnnotation) {
+		
+		Class targetClass = collectionAnnotation.elementClassName();
+		CollectionDescriptor collectionDescriptor = new CollectionDescriptor();
+		ClassDescriptor classDescriptor = mappingDescriptor.getClassDescriptorByName(targetClass.getName());
+
+		//TODO : This check can be done later by AbstractMapperImpl
+		if (classDescriptor == null)
+			throw new InitMapperException(
+					"Unable to reference class "
+							+ targetClass.getName()
+							+ " as a child node since it has not been registered, ordering perhaps?");
+		
+		collectionDescriptor.setFieldName(fieldName);
+		
+		if (collectionAnnotation.jcrName() != null && ! collectionAnnotation.jcrName().equals(""))
+		{
+		   collectionDescriptor.setJcrName(collectionAnnotation.jcrName());
+		}
+		else
+		{
+		   collectionDescriptor.setJcrName(fieldName);
+		}
+		
+		Node annotationNode = (Node) targetClass.getAnnotation(Node.class);
+		collectionDescriptor.setProxy(collectionAnnotation.proxy());
+		
+		collectionDescriptor.setAutoInsert(collectionAnnotation.autoInsert());
+		collectionDescriptor.setAutoRetrieve(collectionAnnotation.autoRetrieve());
+		collectionDescriptor.setAutoUpdate(collectionAnnotation.autoUpdate());
+		collectionDescriptor.setCollectionClassName(collectionClassName);
+		if (! collectionAnnotation.elementClassName().equals(Object.class))
+		{
+			collectionDescriptor.setElementClassName(collectionAnnotation.elementClassName().getName());
 		}
+		else
+		{
+		    collectionDescriptor.setElementClassName(targetClass.getName());
+		}
+		
+		collectionDescriptor.setCollectionConverter(collectionAnnotation.collectionConverter().getName());
+		
+		collectionDescriptor.setJcrType(annotationNode.jcrType());
+		collectionDescriptor.setJcrSameNameSiblings(collectionAnnotation.jcrSameNameSiblings());
+		collectionDescriptor.setJcrAutoCreated(collectionAnnotation.jcrAutoCreated());
+		collectionDescriptor.setJcrProtected(collectionAnnotation.jcrProtected());
+		collectionDescriptor.setJcrOnParentVersion(collectionAnnotation.jcrOnParentVersion());
+		collectionDescriptor.setJcrMandatory(collectionAnnotation.jcrMandatory());
+		
 
+		descriptor.addCollectionDescriptor(collectionDescriptor);
 	}
 	
-	private void addFieldDescriptors(ClassDescriptor descriptor, Class clazz) {
-		BeanInfo beanInfo;
-		try {
-			beanInfo = Introspector.getBeanInfo(clazz);
-		} catch (IntrospectionException e) {
-			throw new RuntimeException(e);
+	private void addBeanDescriptor(ClassDescriptor classDescriptor, String fieldName, Bean beanAnnotation) {
+		BeanDescriptor beanDescriptor = new BeanDescriptor();
+		beanDescriptor.setFieldName(fieldName);
+		if (beanAnnotation.jcrName() != null && ! beanAnnotation.jcrName().equals(""))
+		{
+		   beanDescriptor.setJcrName(beanAnnotation.jcrName());
+		}
+		else
+		{
+			beanDescriptor.setJcrName(fieldName);
 		}
+		
+		beanDescriptor.setProxy(beanAnnotation.proxy());				
+		beanDescriptor.setConverter(beanAnnotation.converter().getName());
+		beanDescriptor.setAutoInsert(beanAnnotation.autoInsert());
+		beanDescriptor.setAutoRetrieve(beanAnnotation.autoRetrieve());
+		beanDescriptor.setAutoUpdate(beanAnnotation.autoUpdate());
+		beanDescriptor.setJcrType(beanAnnotation.jcrType());
+		beanDescriptor.setJcrAutoCreated(beanAnnotation.jcrAutoCreated());
+		beanDescriptor.setJcrMandatory(beanAnnotation.jcrMandatory());
+		beanDescriptor.setJcrOnParentVersion(beanAnnotation.jcrOnParentVersion());
+		beanDescriptor.setJcrProtected(beanAnnotation.jcrProtected());			            
+		beanDescriptor.setJcrSameNameSiblings(beanAnnotation.jcrSameNameSiblings());				
 
-		PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
-		for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
-			Field jcrProperty = propertyDescriptor.getReadMethod().getAnnotation(Field.class);
-			if (jcrProperty != null) {
-				FieldDescriptor fieldDescriptor = new FieldDescriptor();				
-				fieldDescriptor.setFieldName(propertyDescriptor.getName());
-				if ((jcrProperty.jcrName() != null) && (!jcrProperty.jcrName().equals("")))
-				{
-					fieldDescriptor.setJcrName(jcrProperty.jcrName());	
-				}
-				else
-				{
-					fieldDescriptor.setJcrName(propertyDescriptor.getName());	
-				}
-				fieldDescriptor.setId(jcrProperty.id());				
-				fieldDescriptor.setPath(jcrProperty.path());
-				fieldDescriptor.setUuid(jcrProperty.uuid());
-				
-				// It is not possible to set a null value into an annotation attribute.
-				// If the converter == Object.class, it should be considered as null
-				if (! jcrProperty.converter().equals(Object.class))
-				{
-				    fieldDescriptor.setConverter(jcrProperty.converter().getName());
-				}
-				
-				// It is not possible to set a null value into an annotation attribute.
-				// If the jcrDefaultValue value is an empty string => it should be considered as null
-				if ((jcrProperty.jcrDefaultValue() != null) && (!jcrProperty.jcrDefaultValue().equals("")))
-				{
-				     fieldDescriptor.setJcrDefaultValue(jcrProperty.jcrDefaultValue());
-				}
-				
-				// It is not possible to set a null value into an annotation attribute.
-				// If the jcrValueConstraints value is an empty string => it should be considered as null
-				if ((jcrProperty.jcrValueConstraints() != null) && (!jcrProperty.jcrValueConstraints().equals("")))
-				{	
-				     fieldDescriptor.setJcrValueConstraints(jcrProperty.jcrValueConstraints());
-				}
-				
-				// It is not possible to set a null value into an annotation attribute.
-				// If the jcrProperty value is an empty string => it should be considered as null
-				if ((jcrProperty.jcrType() != null) && (!jcrProperty.jcrType().equals("")))
-				{
-				    fieldDescriptor.setJcrType(jcrProperty.jcrType());
-				}
-				
-				fieldDescriptor.setJcrAutoCreated(jcrProperty.jcrAutoCreated());
-				fieldDescriptor.setJcrMandatory(jcrProperty.jcrMandatory());
-				fieldDescriptor.setJcrOnParentVersion(jcrProperty.jcrOnParentVersion());
-				fieldDescriptor.setJcrProtected(jcrProperty.jcrProtected());
-				fieldDescriptor.setJcrMultiple(jcrProperty.jcrMultiple());
+		classDescriptor.addBeanDescriptor(beanDescriptor);
+	}
+
+
+	private void addFieldDescriptor(ClassDescriptor classDescriptor, String fieldName, Field fieldAnnotation) 
+	{
 				
-				//fieldDescriptor.setJcrType(value)
-				descriptor.addFieldDescriptor(fieldDescriptor);
-			}
+		FieldDescriptor fieldDescriptor = new FieldDescriptor();				
+		fieldDescriptor.setFieldName(fieldName);
+		if ((fieldAnnotation.jcrName() != null) && (!fieldAnnotation.jcrName().equals("")))
+		{
+			fieldDescriptor.setJcrName(fieldAnnotation.jcrName());	
 		}
-
+		else
+		{
+			fieldDescriptor.setJcrName(fieldName);	
+		}
+		fieldDescriptor.setId(fieldAnnotation.id());				
+		fieldDescriptor.setPath(fieldAnnotation.path());
+		fieldDescriptor.setUuid(fieldAnnotation.uuid());
+		
+		// It is not possible to set a null value into an annotation attribute.
+		// If the converter == Object.class, it should be considered as null
+		if (! fieldAnnotation.converter().equals(Object.class))
+		{
+		    fieldDescriptor.setConverter(fieldAnnotation.converter().getName());
+		}
+		
+		// It is not possible to set a null value into an annotation attribute.
+		// If the jcrDefaultValue value is an empty string => it should be considered as null
+		if ((fieldAnnotation.jcrDefaultValue() != null) && (!fieldAnnotation.jcrDefaultValue().equals("")))
+		{
+		     fieldDescriptor.setJcrDefaultValue(fieldAnnotation.jcrDefaultValue());
+		}
+		
+		// It is not possible to set a null value into an annotation attribute.
+		// If the jcrValueConstraints value is an empty string => it should be considered as null
+		if ((fieldAnnotation.jcrValueConstraints() != null) && (!fieldAnnotation.jcrValueConstraints().equals("")))
+		{	
+		     fieldDescriptor.setJcrValueConstraints(fieldAnnotation.jcrValueConstraints());
+		}
+		
+		// It is not possible to set a null value into an annotation attribute.
+		// If the jcrProperty value is an empty string => it should be considered as null
+		if ((fieldAnnotation.jcrType() != null) && (!fieldAnnotation.jcrType().equals("")))
+		{
+		    fieldDescriptor.setJcrType(fieldAnnotation.jcrType());
+		}
+		
+		fieldDescriptor.setJcrAutoCreated(fieldAnnotation.jcrAutoCreated());
+		fieldDescriptor.setJcrMandatory(fieldAnnotation.jcrMandatory());
+		fieldDescriptor.setJcrOnParentVersion(fieldAnnotation.jcrOnParentVersion());
+		fieldDescriptor.setJcrProtected(fieldAnnotation.jcrProtected());
+		fieldDescriptor.setJcrMultiple(fieldAnnotation.jcrMultiple());
+		
+		//fieldDescriptor.setJcrType(value)
+		classDescriptor.addFieldDescriptor(fieldDescriptor);
 	}    
 
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java Tue Oct  2 14:12:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.mapper.impl.annotation;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 import org.apache.jackrabbit.ocm.manager.beanconverter.impl.DefaultBeanConverterImpl;
 
@@ -27,6 +29,7 @@
  * 
  */
 @Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.METHOD })
 public @interface Bean {
 
 	String jcrName() default "";

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java Tue Oct  2 14:12:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.mapper.impl.annotation;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.DefaultCollectionConverterImpl;
 
@@ -28,32 +30,35 @@
  * 
  */
 @Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.METHOD })
 public @interface Collection {
 
-	Class converter() default DefaultCollectionConverterImpl.class;
-
-    String jcrName() default ""; 
-    
-    boolean sameNameSiblings() default false;
-
-    boolean autoCreate() default false;
-
-    boolean protect() default false;
-
-    String onParentVersion() default "COPY";
-
-    boolean mandatory() default false;
+	String jcrName() default "";
 
+	boolean proxy() default false;
+	
+	boolean autoRetrieve() default true;
+	
+	boolean autoUpdate() default true;
+	
     boolean autoInsert() default true;
 
-    boolean autoRetrieve() default true;
-
-    boolean autoUpdate() default true;
+    // Use Object.class as default value 
+    // because it is not possible to have a default null value in annotation field
+    Class elementClassName() default Object.class;      
+    
+	Class collectionConverter() default DefaultCollectionConverterImpl.class;
 
-    Class type();    
+    String jcrType() default "";
     
-    boolean proxy() default false;
+    boolean jcrAutoCreated() default false; 
     
+    boolean jcrMandatory() default false; 
+    
+    String jcrOnParentVersion() default "COPY";
+    
+    boolean jcrProtected() default false;
+        
+    boolean jcrSameNameSiblings() default false;    
     
-
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java Tue Oct  2 14:12:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.mapper.impl.annotation;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 /**
  * Allows the annotation of a getter method to show that it will be mapped to a JCR property
@@ -26,6 +28,7 @@
  * 
  */
 @Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.FIELD, ElementType.METHOD })
 public @interface Field {
     
     String jcrName() default "";    

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Implement.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Implement.java?rev=581387&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Implement.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Implement.java Tue Oct  2 14:12:46 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.ocm.mapper.impl.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation allow to defined the implement descriptor on the class 
+ * level
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+public @interface Implement 
+{
+    Class interfaceName();    
+}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java Tue Oct  2 14:12:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.mapper.impl.annotation;
 
+import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
 /**
  * Allows for the annotation of a Java class so mapping through OCM to a JCR node
@@ -26,18 +28,24 @@
  * 
  */
 @Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
 public @interface Node {
     
 	String jcrType() default "nt:unstructured";
 	String jcrSuperTypes() default "";
 	String jcrMixinTypes() default "";
     // Define the extend setting in the mapping descriptor - Provide less flexibility if we use the java instrospection	
-	String extend() default "";
+	Class extend() default Object.class;
 
 	// Define the abstract setting in the mapping descriptor - Provide less flexibility if we use the java instrospection
 	boolean isAbstract() default false; 
 	
+//	 Define the inteface setting in the mapping descriptor - Provide less flexibility if we use the java instrospection
+	boolean isInterface() default false;
+	
 	// Discriminator is used when an object hierarchy tree is mapped into the same jcr node type
 	// TODO : try to drop it from the mapping strategy. it should be hidden in the persistence manager impl. 
 	boolean discriminator() default true;
+	
+	
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/AnnotationTestBase.java Tue Oct  2 14:12:46 2007
@@ -28,6 +28,14 @@
 import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
 import org.apache.jackrabbit.ocm.testmodel.Atomic;
 import org.apache.jackrabbit.ocm.testmodel.Default;
+import org.apache.jackrabbit.ocm.testmodel.auto.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.auto.Content;
+import org.apache.jackrabbit.ocm.testmodel.auto.Document;
+import org.apache.jackrabbit.ocm.testmodel.auto.Folder;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.CmsObjectImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.ContentImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.FolderImpl;
 
 /**
  * Base class for testcases. Provides priviledged access to the jcr test
@@ -65,8 +73,6 @@
 		
 		Mapper mapper = new AnnotationMapperImpl(classes);
 		ocm = new ObjectContentManagerImpl(session, mapper);
-		
-		
 		
 	}
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AllTests.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AllTests.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AllTests.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AllTests.java Tue Oct  2 14:12:46 2007
@@ -36,8 +36,8 @@
     public static Test buildSuite() {
         TestSuite suite= new TestSuite("Test for org.apache.jackrabbit.ocm.manager.auto");
         //$JUnit-BEGIN$
-        suite.addTestSuite(ObjectContentManagerAutoTest.class);
-
+        suite.addTestSuite(DigesterAutoTest.class);
+        suite.addTestSuite(AnnotationAutoTest.class);
         //$JUnit-END$
 
         return suite;

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AnnotationAutoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AnnotationAutoTest.java?rev=581387&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AnnotationAutoTest.java (added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/AnnotationAutoTest.java Tue Oct  2 14:12:46 2007
@@ -0,0 +1,176 @@
+/*
+ * 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.ocm.manager.auto;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Repository;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.DigesterTestBase;
+import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
+import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
+import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.AnnotationMapperImpl;
+import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
+import org.apache.jackrabbit.ocm.testmodel.auto.CmsObject;
+import org.apache.jackrabbit.ocm.testmodel.auto.Content;
+import org.apache.jackrabbit.ocm.testmodel.auto.Document;
+import org.apache.jackrabbit.ocm.testmodel.auto.Folder;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.CmsObjectImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.ContentImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.DocumentImpl;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.DocumentStream;
+import org.apache.jackrabbit.ocm.testmodel.auto.impl.FolderImpl;
+
+/**
+ * Test autoupdate setting
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ */
+public class AnnotationAutoTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(AnnotationAutoTest.class);
+
+	/**
+	 * <p>Defines the test case name for junit.</p>
+	 * @param testName The test case name.
+	 */
+	public AnnotationAutoTest(String testName) throws Exception {
+		super(testName);
+
+	}
+
+	public static Test suite() {
+		// All methods starting with "test" will be executed in the test suite.
+		return new RepositoryLifecycleTestSetup(new TestSuite(
+				AnnotationAutoTest.class));
+	}
+
+	public void tearDown() throws Exception {
+
+		cleanUpRepisotory();
+		super.tearDown();
+		
+	}
+
+	
+	public void testAuto() {
+		
+		ObjectContentManager ocm = this.getObjectContentManager();
+
+		//---------------------------------------------------------------------------------------------------------
+		// Insert cmsobjects
+		//---------------------------------------------------------------------------------------------------------
+	    Folder  folder = new FolderImpl();
+	    folder.setPath("/folder2");
+	    folder.setName("folder2");        
+		
+	    Document document = new DocumentImpl();
+	    document.setPath("/folder2/document4");
+	    document.setName("document4");
+	    document.setContentType("plain/text"); 
+	    DocumentStream documentStream = new DocumentStream();
+	    documentStream.setEncoding("utf-8");
+	    documentStream.setContent("Test Content 4".getBytes());
+	    document.setDocumentStream(documentStream);       
+
+	    Folder subFolder = new FolderImpl();
+	    subFolder.setName("subfolder");
+	    subFolder.setPath("/folder2/subfolder");
+	    	    	    
+	    folder.addChild(document);
+	    folder.addChild(subFolder);
+	    ocm.insert(folder);               		
+		ocm.save();
+		
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve folder2 
+		//---------------------------------------------------------------------------------------------------------	
+		Folder folder2 = (Folder) ocm.getObject( "/folder2");
+		assertNotNull("folder 2 is null", folder2);
+		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,0); // autoInsert = false
+		
+		//---------------------------------------------------------------------------------------------------------	
+		// Insert nested objects
+		//---------------------------------------------------------------------------------------------------------
+		ocm.insert(subFolder);
+		ocm.insert(document);
+		ocm.save();
+		
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve folder2 
+		//---------------------------------------------------------------------------------------------------------	
+		 folder2 = (Folder) ocm.getObject( "/folder2");
+		assertNotNull("folder 2 is null", folder2);
+		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,0); // autoInsert = false
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve children attribute 
+		//---------------------------------------------------------------------------------------------------------			
+		ocm.retrieveMappedAttribute(folder2, "children");
+		assertNotNull("folder 2 is null", folder2);
+		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,2);
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));		
+		
+		//---------------------------------------------------------------------------------------------------------	
+		// Update 
+		//---------------------------------------------------------------------------------------------------------	
+		folder2.setChildren(null);
+		ocm.update(folder2); // autoupdate = false for the children attribute. So no update on the children collection
+		ocm.save();
+
+		//---------------------------------------------------------------------------------------------------------	
+		// Retrieve children attribute 
+		//---------------------------------------------------------------------------------------------------------			
+		ocm.retrieveMappedAttribute(folder2, "children");
+		assertNotNull("folder 2 is null", folder2);
+		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,2);
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
+		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));		
+		
+		
+	}
+	
+	protected void initObjectContentManager() throws UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
+	{
+		Repository repository = RepositoryUtil.getRepository("repositoryTest");	
+		session = RepositoryUtil.login(repository, "superuser", "superuser");
+		List<Class> classes = new ArrayList<Class>();
+		
+		classes.add(CmsObject.class);
+		classes.add(Content.class);
+		classes.add(Folder.class);
+		classes.add(Document.class);
+		classes.add(CmsObjectImpl.class);
+		classes.add(ContentImpl.class);
+		classes.add(FolderImpl.class);
+		classes.add(DocumentImpl.class);
+		
+		Mapper mapper = new AnnotationMapperImpl(classes);
+		ocm = new ObjectContentManagerImpl(session, mapper);
+
+		
+	}	
+}
\ No newline at end of file

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/DigesterAutoTest.java (from r580157, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/ObjectContentManagerAutoTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/DigesterAutoTest.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/DigesterAutoTest.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/ObjectContentManagerAutoTest.java&r1=580157&r2=581387&rev=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/ObjectContentManagerAutoTest.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/auto/DigesterAutoTest.java Tue Oct  2 14:12:46 2007
@@ -43,14 +43,14 @@
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  */
-public class ObjectContentManagerAutoTest extends DigesterTestBase {
-	private final static Log log = LogFactory.getLog(ObjectContentManagerAutoTest.class);
+public class DigesterAutoTest extends DigesterTestBase {
+	private final static Log log = LogFactory.getLog(DigesterAutoTest.class);
 
 	/**
 	 * <p>Defines the test case name for junit.</p>
 	 * @param testName The test case name.
 	 */
-	public ObjectContentManagerAutoTest(String testName) throws Exception {
+	public DigesterAutoTest(String testName) throws Exception {
 		super(testName);
 
 	}
@@ -58,7 +58,7 @@
 	public static Test suite() {
 		// All methods starting with "test" will be executed in the test suite.
 		return new RepositoryLifecycleTestSetup(new TestSuite(
-				ObjectContentManagerAutoTest.class));
+				DigesterAutoTest.class));
 	}
 
 	public void tearDown() throws Exception {

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Atomic.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Atomic.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Atomic.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Atomic.java Tue Oct  2 14:12:46 2007
@@ -19,7 +19,6 @@
 import java.io.InputStream;
 import java.sql.Timestamp;
 import java.util.Calendar;
-import java.util.Collection;
 import java.util.Date;
 
 import org.apache.jackrabbit.ocm.manager.atomic.Int2BooleanTypeConverterImpl;
@@ -36,31 +35,36 @@
  * @version $Id: Exp $
  */
 @Node
-public class Atomic
-{
+public class Atomic 
+{	
+	@Field(path=true) protected String path;
+	@Field private String string;
+	@Field private Boolean booleanObject;
+	@Field private boolean booleanPrimitive;
+	@Field private Integer integerObject;
+	@Field private int intPrimitive;
+	@Field private byte[] byteArray;
+	@Field private Calendar calendar;
+	@Field private Date date;
+	@Field private Double doubleObject;
+	@Field private double doublePrimitive;
+	@Field private InputStream inputStream;
+	@Field private Timestamp timestamp;
 	
-	private String path;
-    private String string;
-    private Boolean booleanObject;
-    private boolean booleanPrimitive;
-    private Integer integerObject;
-    private int intPrimitive;
-    private byte[] byteArray;
-    private Calendar calendar;
-    private Date date;
-    private Double doubleObject;
-    private double doublePrimitive;
-    private InputStream inputStream;
-    private Timestamp timestamp;
-    private boolean int2boolean;
-    private Collection multiValue;
+	@Field (converter = Int2BooleanTypeConverterImpl.class) 
+	private boolean int2boolean;
     
+	@Field (converter = NameTypeConverterImpl.class)
     private String namedProperty;
+    
+    @Field (converter = PathTypeConverterImpl.class)
     private String pathProperty; // used to refer another node
+    
+    @Field (converter = UndefinedTypeConverterImpl.class)
     private Object undefinedProperty;
     
     
-    @Field(path=true)
+    
     public String getPath() {
 		return path;
 	}
@@ -68,7 +72,7 @@
 		this.path = path;
 	}
 	
-	@Field
+	
 	public Boolean getBooleanObject()
     {
         return booleanObject;
@@ -79,7 +83,7 @@
         this.booleanObject = booleanObject;
     }
     
-    @Field
+    
     public boolean isBooleanPrimitive()
     {
         return booleanPrimitive;
@@ -90,7 +94,7 @@
         this.booleanPrimitive = booleanPrimitive;
     }
     
-    @Field
+    
     public Integer getIntegerObject()
     {
         return integerObject;
@@ -101,7 +105,7 @@
         this.integerObject = integerObject;
     }
     
-    @Field
+    
     public int getIntPrimitive()
     {
         return intPrimitive;
@@ -112,7 +116,7 @@
         this.intPrimitive = intPrimitive;
     }
     
-    @Field
+    
     public String getString()
     {
         return string;
@@ -122,7 +126,7 @@
         this.string = string;
     }
     
-    @Field
+    
     public byte[] getByteArray()
     {
         return byteArray;
@@ -133,7 +137,7 @@
         this.byteArray = byteArray;
     }
     
-    @Field
+    
     public Calendar getCalendar()
     {
         return calendar;
@@ -145,7 +149,7 @@
         this.calendar = calandar;
     }
     
-    @Field
+    
     public Date getDate()
     {
         return date;
@@ -156,7 +160,7 @@
         this.date = date;
     }
     
-    @Field
+    
     public Double getDoubleObject()
     {
         return doubleObject;
@@ -167,7 +171,7 @@
         this.doubleObject = doubleObject;
     }
     
-    @Field
+    
     public double getDoublePrimitive()
     {
         return doublePrimitive;
@@ -178,7 +182,7 @@
         this.doublePrimitive = doublePrimitive;
     }
     
-    @Field
+    
     public InputStream getInputStream()
     {
         return inputStream;
@@ -188,7 +192,7 @@
         this.inputStream = inputStream;
     }
     
-    @Field
+    
     public Timestamp getTimestamp()
     {
         return timestamp;
@@ -198,8 +202,7 @@
     {
         this.timestamp = timestamp;
     }
-        
-    @Field (converter = Int2BooleanTypeConverterImpl.class)
+            
 	public boolean isInt2boolean() 
 	{
 		return int2boolean;
@@ -211,18 +214,6 @@
 	}
 	
 	
-	public Collection getMultiValue()
-	{
-		return multiValue;
-	}
-	
-	
-	public void setMultiValue(Collection multiValue)
-	{
-		this.multiValue = multiValue;
-	}
-	
-	@Field (converter = NameTypeConverterImpl.class)
 	public String getNamedProperty() {
 		return namedProperty;
 	}
@@ -232,8 +223,7 @@
 	{
 		this.namedProperty = namedProperty;
 	}
-	
-	@Field (converter = PathTypeConverterImpl.class)
+		
 	public String getPathProperty() 
 	{
 		return pathProperty;
@@ -244,7 +234,7 @@
 		this.pathProperty = pathProperty;
 	}
 	
-	@Field (converter = UndefinedTypeConverterImpl.class)
+	
 	public Object getUndefinedProperty() 
 	{
 		return undefinedProperty;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Default.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Default.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Default.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/Default.java Tue Oct  2 14:12:46 2007
@@ -24,20 +24,22 @@
  * Simple object used to test default value assignement
  */
 @Node(jcrType="ocm:DefTestPrimary", discriminator=false)
-public class Default {
-    private String path;
+public class Default 
+{
+	@Field(path=true) private String path;
 
-    private String p1;
+	@Field(jcrName="ocm:p1") private String p1;
 
-    private String p2;
+	@Field(jcrName="ocm:p2") private String p2;
 
+	@Field(jcrName="ocm:p3", jcrDefaultValue="p3DescriptorDefaultValue")
     private String p3;
 
-    private String p4;
+	@Field(jcrName="ocm:p4") private String p4;
 
-    private String p5;
+	@Field(jcrName="ocm:p5") private String p5;
 
-    @Field(path=true)
+    
     public String getPath() {
         return path;
     }
@@ -48,8 +50,7 @@
 
     /**
      * @return the p1
-     */
-    @Field(jcrName="ocm:p1")
+     */    
     public String getP1() {
         return p1;
     }
@@ -63,8 +64,7 @@
 
     /**
      * @return the p2
-     */
-    @Field(jcrName="ocm:p2")
+     */    
     public String getP2() {
         return p2;
     }
@@ -78,8 +78,7 @@
 
     /**
      * @return the p3
-     */
-    @Field(jcrName="ocm:p3", jcrDefaultValue="p3DescriptorDefaultValue")
+     */    
     public String getP3() {
         return p3;
     }
@@ -93,8 +92,7 @@
 
     /**
      * @return the p4
-     */
-    @Field(jcrName="ocm:p4")
+     */    
     public String getP4() {
         return p4;
     }
@@ -108,8 +106,7 @@
 
     /**
      * @return the p5
-     */
-    @Field(jcrName="ocm:p5")
+     */    
     public String getP5() {
         return p5;
     }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/CmsObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/CmsObject.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/CmsObject.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/CmsObject.java Tue Oct  2 14:12:46 2007
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.auto;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+
+@Node(isInterface=true, jcrType="ocm:cmsobject")
 public interface CmsObject {
 
 	public String getName();

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Content.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Content.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Content.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Content.java Tue Oct  2 14:12:46 2007
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.auto;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+
+@Node(isInterface=true, jcrType="ocm:content", extend=CmsObject.class)
 public interface Content extends CmsObject {
 
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Document.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Document.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Document.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Document.java Tue Oct  2 14:12:46 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.auto;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.auto.impl.DocumentStream;
 
+@Node(isInterface=true, jcrType="ocm:document", extend=Content.class)
 public interface Document extends Content {
 
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Folder.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Folder.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Folder.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/Folder.java Tue Oct  2 14:12:46 2007
@@ -18,7 +18,11 @@
 
 import java.util.List;
 
-public interface Folder  extends CmsObject{
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+@Node(isInterface=true, jcrType="ocm:folder", extend=CmsObject.class)
+public interface Folder  extends CmsObject
+{
 
 	public List getChildren();
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/CmsObjectImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/CmsObjectImpl.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/CmsObjectImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/CmsObjectImpl.java Tue Oct  2 14:12:46 2007
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.auto.impl;
 
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.ParentBeanConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.auto.CmsObject;
 import org.apache.jackrabbit.ocm.testmodel.auto.Folder;
 
@@ -28,18 +32,22 @@
  * 
  * 
  */
-public class CmsObjectImpl implements CmsObject
+@Node(jcrType="ocm:cmsobjectimpl", discriminator=false, isAbstract=true)
+public abstract class CmsObjectImpl implements CmsObject
 {
     
-    protected String path;        
-    protected String name;
+	@Field(path=true) protected String path;
+    
+    @Field(jcrName="ocm:name", id=true) protected String name;
+  
+    @Bean(converter=ParentBeanConverterImpl.class)
     protected Folder parentFolder;
     
 
     /**
      * 
      * @see org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject#getName()
-     */
+     */    
 	public String getName() {
 		return name;
 	}
@@ -56,6 +64,7 @@
 	 * 
 	 * @see org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject#getPath()
 	 */
+	
 	public String getPath() {
 		return path;
 	}
@@ -70,6 +79,7 @@
 	 * 
 	 * @see org.apache.jackrabbit.ocm.testmodel.interfaces.CmsObject#getParentFolder()
 	 */
+	
 	public Folder getParentFolder() {
 		return parentFolder;
 	}

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/ContentImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/ContentImpl.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/ContentImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/ContentImpl.java Tue Oct  2 14:12:46 2007
@@ -16,18 +16,16 @@
  */
 package org.apache.jackrabbit.ocm.testmodel.auto.impl;
 
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.auto.Content;
 
-
-
-
-
 /**
- * Content object
+ * Content implementation
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * 
  */
+@Node(jcrType="ocm:contentimpl",  isAbstract=true, extend=CmsObjectImpl.class, discriminator=false)
 public abstract class ContentImpl  extends CmsObjectImpl implements Content
 {
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentImpl.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentImpl.java Tue Oct  2 14:12:46 2007
@@ -19,21 +19,29 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.auto.Document;
 
 /**
- * CMS VersionnedDocument implementation.
+ * Document implementation.
  *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * 
  */
+
+@Node(jcrType="ocm:documentimpl", extend=ContentImpl.class, discriminator=false)
+@Implement(interfaceName=Document.class)
 public class DocumentImpl extends ContentImpl implements Document
 {
     protected final static Log log =  LogFactory.getLog(DocumentImpl.class);
     
-    protected long size;
-    protected String contentType;   
+    @Field(jcrName="ocm:size") protected long size;
+    @Field(jcrName="ocm:contenttype") protected String contentType;   
         
+    @Bean(jcrName="ocm:documentstream", autoUpdate=false, autoInsert=false, autoRetrieve=false ) 
     protected DocumentStream documentStream;
 
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentStream.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentStream.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/DocumentStream.java Tue Oct  2 14:12:46 2007
@@ -22,24 +22,24 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 
 /**
- * Content object
+ * Document Content
  *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  * 
  */
+
+@Node(jcrType="ocm:documentstream", discriminator=false)
 public class DocumentStream 
 {
     protected final static Log log = LogFactory.getLog(DocumentStream.class);
       
-    protected byte[] content;
-    
-    protected String encoding;
-    
-    protected String path;
+    @Field( jcrName="ocm:binarycontent") protected byte[] content;    
+    @Field( jcrName="ocm:encoding") protected String encoding;    
+    @Field(path=true) protected String path;
 
 
     /**

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/FolderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/FolderImpl.java?rev=581387&r1=581386&r2=581387&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/FolderImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/testmodel/auto/impl/FolderImpl.java Tue Oct  2 14:12:46 2007
@@ -19,21 +19,26 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Implement;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
 import org.apache.jackrabbit.ocm.testmodel.auto.CmsObject;
 import org.apache.jackrabbit.ocm.testmodel.auto.Folder;
 
-
-
-
 /**
- * CMS Folder Test
+ * Forlder implementation
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- * @version $Id: Folder.java,v 1.1 2004/12/22 20:36:59 christophe Exp $
+ * 
  */
+@Node(jcrType="ocm:folderimpl", extend=CmsObjectImpl.class ,discriminator=false)
+@Implement(interfaceName=Folder.class)
 public class FolderImpl extends CmsObjectImpl implements Folder 
 {
-
+    @Collection(proxy=true, autoUpdate=false, autoInsert=false, autoRetrieve=false, 
+    		    elementClassName=CmsObjectImpl.class,  
+    			collectionConverter=NTCollectionConverterImpl.class)
     protected List children = new ArrayList();
 
 	/**



Mime
View raw message