jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r578974 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping: ./ src/main/java/org/apache/jackrabbit/ocm/manager/impl/ src/main/java/org/apache/jackrabbit/ocm/mapper/impl/ src/main/java/org/apache/jackrabbit/ocm/mapper/impl/ann...
Date Mon, 24 Sep 2007 21:13:37 GMT
Author: clombart
Date: Mon Sep 24 14:13:35 2007
New Revision: 578974

URL: http://svn.apache.org/viewvc?rev=578974&view=rev
Log:
Reorganise the ocm project - First step :
1/ move the annotation support into the core pck
2/ Rename some class name in order to follow the same naming convention. 
3/ review the pom.xml : run only with java 1.5
I continue to work on this reorg

Added:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/
    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/AnnotationMapperImpl.java
  (with props)
    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
  (with props)
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
  (with props)
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
  (with props)
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.java
  (with props)
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterDescriptorReader.java
      - copied, changed from r578593, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterDescriptorReader.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterMapperImpl.java
      - copied, changed from r578593, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterMapperImpl.java
Removed:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterDescriptorReader.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterMapperImpl.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/pom.xml
    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/test/java/org/apache/jackrabbit/ocm/manager/basic/ObjectContentManagerSameNameSiblingTest.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/pom.xml?rev=578974&r1=578973&r2=578974&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/pom.xml (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/pom.xml Mon Sep 24 14:13:35
2007
@@ -42,6 +42,14 @@
   <!-- ====================================================================== -->
   <build>
     <plugins>
+	<plugin>
+	   <inherited>true</inherited>
+	    <artifactId>maven-compiler-plugin</artifactId>
+	    <configuration>
+		    <target>1.5</target>
+		    <source>1.5</source>
+	    </configuration>
+      </plugin>	    
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>

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?rev=578974&r1=578973&r2=578974&view=diff
==============================================================================
--- 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 Sep 24 14:13:35 2007
@@ -56,7 +56,7 @@
 import org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl;
 import org.apache.jackrabbit.ocm.manager.objectconverter.impl.ProxyManagerImpl;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.mapper.impl.DigesterMapperImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.digester.DigesterMapperImpl;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
 import org.apache.jackrabbit.ocm.query.Query;
 import org.apache.jackrabbit.ocm.query.QueryManager;

Added: 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=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,230 @@
+/*
+ * 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.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.util.List;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+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.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)
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ *
+ */
+public class AnnotationDescriptorReader implements DescriptorReader
+{
+	List<String> annotatedClassNames;
+    public AnnotationDescriptorReader(List<String> annotatedClassNames)
+    {
+   	     this.annotatedClassNames = annotatedClassNames;
+    }
+    
+    
+
+    public MappingDescriptor loadClassDescriptors()
+	{
+		MappingDescriptor mappingDescriptor = new MappingDescriptor();	
+		for (String className : annotatedClassNames) {
+			Class clazz = ReflectionUtils.forName(className);
+			ClassDescriptor classDescriptor = buildClassDescriptor(mappingDescriptor, clazz);
+			mappingDescriptor.addClassDescriptor(classDescriptor);
+		}
+		return mappingDescriptor;
+		
+	}
+	
+	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());
+		descriptor.setJcrSuperTypes(annotationNode.jcrSuperTypes());		
+		descriptor.setJcrMixinTypes(annotationNode.jcrMixinTypes());
+		descriptor.setExtend(annotationNode.extend());		
+		descriptor.setAbstract(annotationNode.isAbstract());
+		descriptor.setInterface(clazz.isInterface());
+		
+		addFieldDescriptors(descriptor, clazz);
+		addBeanDescriptors(descriptor, clazz);
+		addCollectionDescriptors(mappingDescriptor, descriptor, clazz);
+		return descriptor;
+	}
+
+	private void addCollectionDescriptors(MappingDescriptor mappingDescriptor, ClassDescriptor
descriptor,Class clazz) {
+		BeanInfo beanInfo;
+		try {
+			beanInfo = Introspector.getBeanInfo(clazz);
+		} catch (IntrospectionException e) {
+			throw new RuntimeException(e);
+		}
+		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());
+
+				descriptor.addCollectionDescriptor(collectionDescriptor);
+			}
+		}
+
+	}
+
+	
+	private void addBeanDescriptors(ClassDescriptor descriptor,Class clazz) {
+		BeanInfo beanInfo;
+		try {
+			beanInfo = Introspector.getBeanInfo(clazz);
+		} catch (IntrospectionException e) {
+			throw new RuntimeException(e);
+		}
+		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);
+			}
+		}
+
+	}
+	
+	private void addFieldDescriptors(ClassDescriptor descriptor, Class clazz) {
+		BeanInfo beanInfo;
+		try {
+			beanInfo = Introspector.getBeanInfo(clazz);
+		} catch (IntrospectionException e) {
+			throw new RuntimeException(e);
+		}
+
+		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 a annotation attribute.
+				// If the converter == Object.class, it shoudl be considered as null
+				if (! jcrProperty.converter().equals(Object.class))
+				{
+				    fieldDescriptor.setConverter(jcrProperty.converter().getName());
+				}
+				fieldDescriptor.setJcrDefaultValue(jcrProperty.jcrDefaultValue());			
+				fieldDescriptor.setJcrValueConstraints(jcrProperty.jcrDefaultValue());
+				fieldDescriptor.setJcrType(jcrProperty.jcrType());
+				
+				fieldDescriptor.setJcrAutoCreated(jcrProperty.jcrAutoCreated());
+				fieldDescriptor.setJcrMandatory(jcrProperty.jcrMandatory());
+				fieldDescriptor.setJcrOnParentVersion(jcrProperty.jcrOnParentVersion());
+				fieldDescriptor.setJcrProtected(jcrProperty.jcrProtected());
+				fieldDescriptor.setJcrMultiple(jcrProperty.jcrMultiple());
+				
+				//fieldDescriptor.setJcrType(value)
+				descriptor.addFieldDescriptor(fieldDescriptor);
+			}
+		}
+
+	}    
+
+
+}

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationMapperImpl.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/AnnotationMapperImpl.java?rev=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationMapperImpl.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationMapperImpl.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.util.List;
+
+import org.apache.jackrabbit.ocm.mapper.Mapper;
+import org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl;
+
+/**
+ * An implementation of the OCM mapper that builds class descriptors based on
+ * the use of annotations on the underlying classes
+ * 
+ * @author Philip Dodds
+ * 
+ */
+public class AnnotationMapperImpl extends AbstractMapperImpl implements Mapper {
+
+	
+	public AnnotationMapperImpl(List<String> annotatedClassNames)
+	{		
+        descriptorReader = new AnnotationDescriptorReader(annotatedClassNames);
+        this.buildMapper();
+	}
+
+}

Propchange: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationMapperImpl.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 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=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Bean.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.DefaultBeanConverterImpl;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * 
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Bean {
+
+	String jcrName() default "";
+    boolean proxy() default false;	 
+    Class converter() default DefaultBeanConverterImpl.class;    
+    boolean autoInsert() default true;
+    boolean autoRetrieve() default true;
+    boolean autoUpdate() default true;
+    
+    // The folling annotation props are used to create jcr node type. 
+    // There are not necessary for the mapping bean strategies. 
+    String jcrType() default "";    
+    boolean jcrAutoCreated() default false;
+    boolean jcrMandatory() default false;        
+    String jcrOnParentVersion() default "COPY";    
+    boolean jcrProtected() default false; 
+    boolean jcrSameNameSiblings() default false; 
+            
+	       
+
+
+}

Added: 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=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.DefaultCollectionConverterImpl;
+
+/**
+ * Allows the annotation of getting methods to show that they reflect a child node in JCR
+ * 
+ * @author Philip Dodds
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+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;
+
+    boolean autoInsert() default true;
+
+    boolean autoRetrieve() default true;
+
+    boolean autoUpdate() default true;
+
+    Class type();    
+    
+    boolean proxy() default false;
+    
+    
+
+}

Propchange: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Collection.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 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=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Allows the annotation of a getter method to show that it will be mapped to a JCR property
+ * 
+ * @author Philip Dodds
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Field {
+    
+    String jcrName() default "";    
+
+    boolean id() default false;
+    
+    boolean path() default false;
+    
+    boolean uuid() default false;
+    
+    // Use Object.class as default value 
+    // because it is not possible to have a default null value in annotation field
+    Class converter() default Object.class;
+    
+    String jcrDefaultValue() default "";
+    
+    String jcrValueConstraints() default ""; 
+    
+    String jcrType() default ""; 
+    
+    boolean jcrAutoCreated() default false;     
+    
+    boolean jcrMandatory() default false;    
+    
+    String jcrOnParentVersion() default "COPY";
+    
+    boolean jcrProtected() default false;
+    
+    boolean jcrMultiple () default false;
+    
+}

Propchange: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Field.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 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=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Allows for the annotation of a Java class so mapping through OCM to a JCR node
+ * 
+ * @author Philip Dodds
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+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 "";
+
+	// Define the abstract setting in the mapping descriptor - Provide less flexibility if we
use the java instrospection
+	boolean isAbstract() 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;
+}

Propchange: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/Node.java
------------------------------------------------------------------------------
    svn:executable = *

Added: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.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/SuperType.java?rev=578974&view=auto
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.java
(added)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.java
Mon Sep 24 14:13:35 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Used when you wish to specify JCR super types for a class
+ * 
+ * @author Philip Dodds
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SuperType {
+
+    String name() default "nt:base";
+
+}

Propchange: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/SuperType.java
------------------------------------------------------------------------------
    svn:executable = *

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterDescriptorReader.java
(from r578593, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterDescriptorReader.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterDescriptorReader.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterDescriptorReader.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterDescriptorReader.java&r1=578593&r2=578974&rev=578974&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterDescriptorReader.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterDescriptorReader.java
Mon Sep 24 14:13:35 2007
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.ocm.mapper.impl;
+package org.apache.jackrabbit.ocm.mapper.impl.digester;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;

Copied: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterMapperImpl.java
(from r578593, jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterMapperImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterMapperImpl.java?p2=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterMapperImpl.java&p1=jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterMapperImpl.java&r1=578593&r2=578974&rev=578974&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/DigesterMapperImpl.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/digester/DigesterMapperImpl.java
Mon Sep 24 14:13:35 2007
@@ -14,17 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.ocm.mapper.impl;
+package org.apache.jackrabbit.ocm.mapper.impl.digester;
 
 
 
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
 
-import org.apache.jackrabbit.ocm.exception.InitMapperException;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.mapper.model.MappingDescriptor;
+import org.apache.jackrabbit.ocm.mapper.impl.AbstractMapperImpl;
 
 /**
  *

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/basic/ObjectContentManagerSameNameSiblingTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/basic/ObjectContentManagerSameNameSiblingTest.java?rev=578974&r1=578973&r2=578974&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/basic/ObjectContentManagerSameNameSiblingTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/manager/basic/ObjectContentManagerSameNameSiblingTest.java
Mon Sep 24 14:13:35 2007
@@ -21,7 +21,6 @@
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
-import java.util.Map;
 
 import javax.jcr.Repository;
 import javax.jcr.UnsupportedRepositoryOperationException;
@@ -34,15 +33,10 @@
 import org.apache.jackrabbit.ocm.RepositoryLifecycleTestSetup;
 import org.apache.jackrabbit.ocm.TestBase;
 import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl.DefaultAtomicTypeConverterProvider;
 import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerImpl;
-import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
-import org.apache.jackrabbit.ocm.manager.objectconverter.impl.ObjectConverterImpl;
-import org.apache.jackrabbit.ocm.mapper.impl.DigesterMapperImpl;
 import org.apache.jackrabbit.ocm.query.Filter;
 import org.apache.jackrabbit.ocm.query.Query;
 import org.apache.jackrabbit.ocm.query.QueryManager;
-import org.apache.jackrabbit.ocm.query.impl.QueryManagerImpl;
 import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
 import org.apache.jackrabbit.ocm.testmodel.Atomic;
 import org.apache.jackrabbit.ocm.testmodel.Page;

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java?rev=578974&r1=578973&r2=578974&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/mapper/DigesterMapperImplTest.java
Mon Sep 24 14:13:35 2007
@@ -23,8 +23,7 @@
 import junit.framework.TestSuite;
 
 import org.apache.jackrabbit.ocm.exception.JcrMappingException;
-import org.apache.jackrabbit.ocm.mapper.Mapper;
-import org.apache.jackrabbit.ocm.mapper.impl.DigesterMapperImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.digester.DigesterMapperImpl;
 import org.apache.jackrabbit.ocm.mapper.model.BeanDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;



Mime
View raw message