jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r646938 [1/2] - in /jackrabbit/trunk/jackrabbit-ocm/src: main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ main/java/org/apache/jackrabbit/ocm/manager/obje...
Date Thu, 10 Apr 2008 19:47:30 GMT
Author: clombart
Date: Thu Apr 10 12:47:23 2008
New Revision: 646938

URL: http://svn.apache.org/viewvc?rev=646938&view=rev
Log:
- working on JCR-1339 : better support for Map. It is important to define an ID field in the class used for the Map elements. This ID will be used as a key in the map. 
- Rename ManagedHashMap into ManageableHashMap in ordrer to follow the same naming convention.
- Now, it is not necessary to define the ElementClassName if the Collection or the Map are parametrized like List<MyClass>

Added:
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableMap.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjects.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjectsUtil.java
      - copied, changed from r636881, jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollectionUtil.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManageableHashMap.java
      - copied, changed from r636881, jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManagedHashMap.java
Removed:
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollectionUtil.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManagedHashMap.java
Modified:
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/CollectionConverter.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollection.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/AbstractCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/MultiValueCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ReferenceCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualPropertiesCollectionConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/CollectionLazyLoader.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ProxyManagerImpl.java
    jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationHashMapTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualNodesCollectionConverterImplTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/AnnotationResidualPropertiesCollectionConverterImplTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterResidualNodesCollectionConverterImplTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/manager/collectionconverter/DigesterResidualPropertiesCollectionConverterImplTest.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/testmodel/Residual.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/testmodel/collection/Element.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/testmodel/collection/HashMapElement.java
    jackrabbit/trunk/jackrabbit-ocm/src/test/java/org/apache/jackrabbit/ocm/testmodel/collection/Main.java

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/CollectionConverter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/CollectionConverter.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/CollectionConverter.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/CollectionConverter.java Thu Apr 10 12:47:23 2008
@@ -23,7 +23,7 @@
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
 
 /**
- * Convert any kind of {@link ManageableCollection} into severals JCR nodes.
+ * Convert any kind of {@link ManageableObjects} into severals JCR nodes.
  *
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
  *
@@ -32,44 +32,44 @@
 {
 
 	/**
-	 * Insert/convert collection elements into some JCR nodes
+	 * Insert/convert collection elements (a Collection or a Map) into some JCR nodes
 	 * @param session The JCR session
 	 * @param parentNode the node which will contains the collection element
 	 * @param collectionDescriptor The collection descriptor
-	 * @param collection the collection to insert
+	 * @param objects The objects to insert
 	 *
 	 * @throws ObjectContentManagerException when it is not possible to insert the collection
 	 *
 	 */
 	public void insertCollection(Session session, Node parentNode,
-			                     CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws ObjectContentManagerException;
+			                     CollectionDescriptor collectionDescriptor, ManageableObjects objects) throws ObjectContentManagerException;
 
 	/**
-	 * Update collection elements already present in the JCR repository
+	 * Update collection elements (a Collection or a Map) already present in the JCR repository
 	 * @param session The JCR session
 	 * @param parentNode the node which will contains the collection element
 	 * @param collectionDescriptor The collection descriptor
-	 * @param collection the collection to update
+	 * @param objects The objects to update
 	 *
 	 * @throws ObjectContentManagerException when it is not possible to update the collection
 	 */
 	public void updateCollection(Session session, Node parentNode,
-			                     CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws ObjectContentManagerException;
+			                     CollectionDescriptor collectionDescriptor, ManageableObjects objects) throws ObjectContentManagerException;
 
 	/**
-	 * Get a {@link ManageableCollection} from the JCR repository
+	 * Get a {@link ManageableObjects} from the JCR repository
 	 * @param session The JCR session
 	 * @param parentNode the node which contains the collection element
 	 * @param collectionDescriptor The collection descriptor
 	 * @param collectionFieldClass The collection class to used (ArrayList, Vector, ..)
-	 * @return The collection populates with all elements found in the JCR repository
+	 * @return The collection or a map populates with all elements found in the JCR repository
 	 *
 	 * @throws ObjectContentManagerException when it is not possible to retrieve the collection
 	 */
-	public ManageableCollection getCollection(Session session, Node parentNode,
+	public ManageableObjects getCollection(Session session, Node parentNode,
 			                                  CollectionDescriptor collectionDescriptor, Class collectionFieldClass) throws ObjectContentManagerException;
 
-	
+
 	/**
 	 * Check if the collection is null. This method is mainly used in the Proxy manager to return a null value or a proxy object
 	 * Without proxy proxy, this method is never called.
@@ -82,7 +82,7 @@
 	 *
 	 *
 	 * @throws ObjectContentManagerException when it is not possible to retrieve the collection
-	 */	
+	 */
 	public boolean isNull(Session session, Node parentNode,
                                       CollectionDescriptor collectionDescriptor, Class collectionFieldClass) throws ObjectContentManagerException;
 }

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollection.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollection.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollection.java Thu Apr 10 12:47:23 2008
@@ -16,32 +16,21 @@
  */
 package org.apache.jackrabbit.ocm.manager.collectionconverter;
 
-import java.util.Iterator;
 
 /**
- * Common interface used to persist any kind of Collection or Map.
+ * Common interface used to persist any kind of Collection.
  *
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  *
  */
-public interface ManageableCollection
+public interface ManageableCollection extends ManageableObjects
 {
     /**
      * Add an object into this ManageableCollection
      * @param object the object to add
      */
 	public void addObject(Object object);
-
-	/**
-	 * @return The ManageableCollection iterator
-	 */
-    public Iterator getIterator();
-
-    /**
-     * @return The ManageableCollection size
-     */
-    public int getSize();
 
 
 }

Added: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableMap.java?rev=646938&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableMap.java (added)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableMap.java Thu Apr 10 12:47:23 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.collectionconverter;
+
+
+/**
+ * Common interface used to persist any kind of Map.
+ *
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ *
+ */
+public interface ManageableMap extends ManageableObjects
+{
+    /**
+     * Add an object into this ManageableMap
+     * @param key the object key
+     * @param object the object to add
+     */
+	public void addObject(Object key, Object object);
+
+
+}

Added: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjects.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjects.java?rev=646938&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjects.java (added)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjects.java Thu Apr 10 12:47:23 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.collectionconverter;
+
+import java.util.Iterator;
+
+/**
+ * Common interface used to persist any kind of Collection or Map.
+ *
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ *
+ */
+public interface ManageableObjects
+{
+	/**
+	 * @return The ManageableCollection iterator
+	 */
+    public Iterator getIterator();
+
+    /**
+     * @return The ManageableCollection size
+     */
+    public int getSize();
+
+
+}

Copied: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjectsUtil.java (from r636881, jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollectionUtil.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjectsUtil.java?p2=jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjectsUtil.java&p1=jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollectionUtil.java&r1=636881&r2=646938&rev=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableCollectionUtil.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/ManageableObjectsUtil.java Thu Apr 10 12:47:23 2008
@@ -19,8 +19,10 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
 
@@ -28,93 +30,97 @@
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManageableArrayList;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManageableSet;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManageableVector;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.ManageableHashMap;
 import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
 
 /**
- * Utility class used to instantiate {@link ManageableCollection}
+ * Utility class used to instantiate {@link ManageableObjects}
+ * A ManageableObjects is a Collection or a Map
  *
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
  *
  */
-public class ManageableCollectionUtil {
+public class ManageableObjectsUtil {
 
     /**
-     * Instantiate a new {@link ManageableCollection}
-     * @param manageableCollectionClassName The manageable collection class name
-     * @return an emtpy created {@link ManageableCollection}
+     * Instantiate a new {@link ManageableObjects}
+     * @param manageableObjectsClassName The manageable objects class name
+     * @return an emtpy created {@link ManageableObjects}
      */
-    public static ManageableCollection getManageableCollection(String manageableCollectionClassName) {
+    public static ManageableObjects getManageableObjects(String manageableObjectsClassName) {
         try {
-            return (ManageableCollection) ReflectionUtils.newInstance(manageableCollectionClassName);
+            return (ManageableObjects) ReflectionUtils.newInstance(manageableObjectsClassName);
         }
         catch (Exception e) {
             throw new JcrMappingException("Cannot create manageable collection : "
-                                           + manageableCollectionClassName,
+                                           + manageableObjectsClassName,
                                            e);
         }
     }
 
     /**
-     * Instantiate a new {@link ManageableCollection}
-     * @param collectionClass the collection class name
+     * Instantiate a new {@link ManageableObjects}
+     * @param manageableObjectsClass the collection class name
      * @return an emtpy created {@link ManageableCollection}
      */
 
-    public static ManageableCollection getManageableCollection(Class collectionClass) {
+    public static ManageableObjects getManageableObjects(Class manageableObjectsClass) {
         try {
 
-            if (collectionClass.equals(ArrayList.class)) {
+            if (manageableObjectsClass.equals(ArrayList.class)) {
                 return new ManageableArrayList();
             }
 
-            if (collectionClass.equals(Vector.class)) {
+            if (manageableObjectsClass.equals(Vector.class)) {
                 return new ManageableVector();
             }
 
-            if (collectionClass.equals(HashSet.class)) {
+            if (manageableObjectsClass.equals(HashSet.class)) {
                 return new ManageableSet();
             }
 
-            if (collectionClass.equals(Collection.class) || collectionClass.equals(List.class)) {
+            if (manageableObjectsClass.equals(Collection.class) || manageableObjectsClass.equals(List.class)) {
                 return new ManageableArrayList();
             }
 
-            if (collectionClass.equals(Set.class)) {
+            if (manageableObjectsClass.equals(Set.class)) {
                 return new ManageableSet();
             }
 
-            Object collection = collectionClass.newInstance();
-            if (!(collection instanceof ManageableCollection)) {
+            if (manageableObjectsClass.equals(Map.class) || manageableObjectsClass.equals(HashMap.class)) {
+            	return new ManageableHashMap();
+            }
+
+            Object manageableObjects = manageableObjectsClass.newInstance();
+            if (!(manageableObjects instanceof ManageableObjects)) {
                 throw new JcrMappingException("Unsupported collection type :"
-                                               + collectionClass.getName());
+                                               + manageableObjectsClass.getName());
             }
             else {
-                return (ManageableCollection) collection;
+                return (ManageableObjects) manageableObjects;
             }
         }
         catch (Exception e) {
-            throw new JcrMappingException("Cannot create manageable collection", e);
+            throw new JcrMappingException("Cannot create manageable objects (Collection or Map)", e);
         }
     }
 
     /**
-     * Convert a java Collection object into a {@link ManageableCollection}.
-     * Until now, only the following class are supported :
-     * Collection, List, ArrayList, Vector
+     * Convert a java Collection or a Map into a {@link ManageableObjects}.
      *
-     * If you need a Map, you have to write your own {@link ManageableCollection}.
-     * @param object the java collection or Map
-     * @return The converted {@link ManageableCollection}
+     * The elements of a Map should have an ID field (see the field descriptor definition).
+     * @param object the collection or the Map objet
+     * @return The converted {@link ManageableObjects}
      *
      */
-    public static ManageableCollection getManageableCollection(Object object) {
+    public static ManageableObjects getManageableObjects(Object object) {
         try {
             if (object == null) {
                 return null;
             }
 
-            if (object instanceof ManageableCollection) {
-                return (ManageableCollection) object;
+            if (object instanceof ManageableObjects) {
+                return (ManageableObjects) object;
 
             }
             if (object.getClass().equals(ArrayList.class)) {
@@ -145,6 +151,12 @@
             if (object.getClass().equals(Set.class)) {
                 return new ManageableSet((Set) object);
             }
+
+            if (object.getClass().equals(Map.class)
+            	|| object.getClass().equals(HashMap.class)	){
+                return new ManageableHashMap((Map)object);
+            }
+
         }
         catch (Exception e) {
             throw new JcrMappingException("Impossible to create the manageable collection", e);

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/AbstractCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/AbstractCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/AbstractCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/AbstractCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -30,7 +30,7 @@
 import org.apache.jackrabbit.ocm.exception.JcrMappingException;
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -60,12 +60,12 @@
 	}
 
 	protected abstract void doInsertCollection(Session session, Node parentNode, CollectionDescriptor descriptor,
-			ManageableCollection collection) throws RepositoryException;
+			ManageableObjects objects) throws RepositoryException;
 
 	protected abstract void doUpdateCollection(Session session, Node parentNode, CollectionDescriptor descriptor,
-			ManageableCollection collection) throws RepositoryException;
+			ManageableObjects objects) throws RepositoryException;
 
-	protected abstract ManageableCollection doGetCollection(Session session, Node parentNode,
+	protected abstract ManageableObjects doGetCollection(Session session, Node parentNode,
 			CollectionDescriptor collectionDescriptor, Class collectionFieldClass) throws RepositoryException;
 
 	protected abstract boolean doIsNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
@@ -75,9 +75,9 @@
 	 * @see org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#insertCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection)
 	 */
 	public void insertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
-			ManageableCollection collection) {
+			ManageableObjects objects) {
 		try {
-			doInsertCollection(session, parentNode, collectionDescriptor, collection);
+			doInsertCollection(session, parentNode, collectionDescriptor, objects);
 		} catch (ItemExistsException iee) {
 			throw new ObjectContentManagerException("Cannot insert collection field : " + collectionDescriptor.getFieldName()
 					+ " of class " + collectionDescriptor.getClassDescriptor().getClassName() + ". An item already exists.", iee);
@@ -105,10 +105,10 @@
 	 * @see org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#updateCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection)
 	 */
 	public void updateCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
-			ManageableCollection collection) {
+			ManageableObjects objects) {
 		try {
 
-				doUpdateCollection(session, parentNode, collectionDescriptor, collection);
+				doUpdateCollection(session, parentNode, collectionDescriptor, objects);
 		} catch (VersionException ve) {
 			throw new ObjectContentManagerException("Cannot insert collection field : " + collectionDescriptor.getFieldName()
 					+ " of class " + collectionDescriptor.getClassDescriptor().getClassName(), ve);
@@ -128,7 +128,7 @@
 	/**
 	 * @see org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#getCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, java.lang.Class)
 	 */
-	public ManageableCollection getCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
+	public ManageableObjects  getCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
 			Class collectionFieldClass) {
 		try {
 			return doGetCollection(session, parentNode, collectionDescriptor, collectionFieldClass);

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -36,7 +36,8 @@
 import org.apache.jackrabbit.ocm.exception.JcrMappingException;
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
@@ -73,8 +74,8 @@
     protected void doInsertCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) throws RepositoryException {
-        addUuidProperties(session, parentNode, collectionDescriptor, collection);
+                                      ManageableObjects objects) throws RepositoryException {
+        addUuidProperties(session, parentNode, collectionDescriptor, objects);
     }
 
 
@@ -85,7 +86,7 @@
     protected void doUpdateCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
-                                 ManageableCollection collection) throws RepositoryException
+                                 ManageableObjects objects) throws RepositoryException
     {
         String jcrName = getCollectionJcrName(collectionDescriptor);
 
@@ -94,18 +95,18 @@
             parentNode.setProperty(jcrName, (Value[]) null);
         }
 
-        if (collection == null) {
+        if (objects == null) {
             return;
         }
 
-        addUuidProperties(session, parentNode, collectionDescriptor, collection);
+        addUuidProperties(session, parentNode, collectionDescriptor, objects);
 
     }
 
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
                                                    Node parentNode,
                                                    CollectionDescriptor collectionDescriptor,
                                                    Class collectionFieldClass) throws RepositoryException {
@@ -117,16 +118,26 @@
             Property property = parentNode.getProperty(jcrName);
             Value[] values = property.getValues();
 
-            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
+
+            // For collection of bean references, only Collections are supported
+            if (! (objects instanceof ManageableCollection))
+            {
+
+            	throw new JcrMappingException("Impossible to retrieve the attribute "
+            			+ collectionDescriptor.getFieldName() + " in the class "
+            			+ collectionDescriptor.getClassDescriptor().getClassName()
+            			+  " because it is not a collection");
+            }
 
             for (int i = 0; i < values.length; i++) {
                 String uuid = values[i].getString();
-                String path = session.getNodeByUUID(uuid).getPath();    			
+                String path = session.getNodeByUUID(uuid).getPath();
     			Object object = objectConverter.getObject(session, path);
-                collection.addObject(object);
+                ((ManageableCollection) objects).addObject(object);
             }
 
-            return collection;
+            return objects;
         }
         catch(Exception e) {
           throw new ObjectContentManagerException("Cannot get the collection field : "
@@ -144,17 +155,20 @@
         return ! parentNode.hasProperty(jcrName);
     }
 
-	private void addUuidProperties(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws UnsupportedRepositoryOperationException, RepositoryException, VersionException, LockException, ConstraintViolationException {
+	private void addUuidProperties(Session session, Node parentNode,
+			CollectionDescriptor collectionDescriptor,
+			ManageableObjects objects)
+	        throws UnsupportedRepositoryOperationException, RepositoryException, VersionException, LockException, ConstraintViolationException {
 		try {
-            if (collection == null) {
+            if (objects == null) {
                 return;
             }
 
             String jcrName = getCollectionJcrName(collectionDescriptor);
-            Value[] values = new Value[collection.getSize()];
+            Value[] values = new Value[objects.getSize()];
             ValueFactory valueFactory = session.getValueFactory();
-            Iterator collectionIterator = collection.getIterator();
-            for (int i = 0; i < collection.getSize(); i++) {
+            Iterator collectionIterator = objects.getIterator();
+            for (int i = 0; i < objects.getSize(); i++) {
                 Object object = collectionIterator.next();
 				if (object != null)
 				{

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -31,7 +31,9 @@
 
 import org.apache.jackrabbit.ocm.exception.JcrMappingException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
@@ -91,8 +93,8 @@
     protected void doInsertCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) throws RepositoryException {
-        if (collection == null) {
+                                      ManageableObjects objects) throws RepositoryException {
+        if (objects == null) {
             return;
         }
 
@@ -108,7 +110,7 @@
 
         ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
 
-        Iterator collectionIterator = collection.getIterator();
+        Iterator collectionIterator = objects.getIterator();
         while (collectionIterator.hasNext()) {
             Object item = collectionIterator.next();
             String elementJcrName = null;
@@ -134,12 +136,12 @@
     protected void doUpdateCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
-                                 ManageableCollection collection) throws RepositoryException {
+                                 ManageableObjects objects) throws RepositoryException {
 
     	String jcrName = getCollectionJcrName(collectionDescriptor);
     	boolean hasNode = parentNode.hasNode(jcrName);
         // If the new value for the collection is null, drop the node matching to the collection
-    	if (collection == null)
+    	if (objects == null)
         {
             if (hasNode)
             {
@@ -151,12 +153,12 @@
     	// If there is not yet a node matching to the collection, insert the collection
     	if (! hasNode)
     	{
-    		this.doInsertCollection(session, parentNode, collectionDescriptor, collection);
+    		this.doInsertCollection(session, parentNode, collectionDescriptor, objects);
     		return;
     	}
 
     	// update process
-    	
+
         ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
         Node collectionNode = parentNode.getNode(jcrName);
         //  If the collection elements have not an id, it is not possible to find the matching JCR nodes => delete the complete collection
@@ -165,7 +167,7 @@
             collectionNode = parentNode.addNode(jcrName);
         }
 
-        Iterator collectionIterator = collection.getIterator();
+        Iterator collectionIterator = objects.getIterator();
 
         Map updatedItems = new HashMap();
         while (collectionIterator.hasNext()) {
@@ -214,7 +216,7 @@
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
                                               Node parentNode,
                                               CollectionDescriptor collectionDescriptor,
                                               Class collectionFieldClass) throws RepositoryException {
@@ -224,7 +226,7 @@
             return null;
         }
 
-        ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+        ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
         Node collectionNode = parentNode.getNode(jcrName);
         NodeIterator children = collectionNode.getNodes();
         Class elementClass = ReflectionUtils.forName(collectionDescriptor.getElementClassName());
@@ -232,10 +234,24 @@
         while (children.hasNext()) {
             Node itemNode = children.nextNode();
             Object item = objectConverter.getObject(session, elementClass, itemNode.getPath());
-            collection.addObject(item);
+            if ( objects instanceof ManageableCollection)
+            	((ManageableCollection)objects).addObject(item);
+            else {
+            	ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass(elementClass);
+            	if (!elementClassDescriptor.hasIdField())
+            	{
+            		throw new JcrMappingException("Impossible to use a map for the field : "
+            				                      + collectionDescriptor.getFieldName()
+            				                      + "in the class : " + collectionDescriptor.getCollectionClassName()
+            				                      + ". The element objects have no id field (check their OCM mapping).");
+            	}
+            	Object elementId = ReflectionUtils.getNestedProperty(item,
+            			                           elementClassDescriptor.getIdFieldDescriptor().getFieldName());
+                ((ManageableMap) objects).addObject(elementId, item);
+            }
         }
 
-        return collection;
+        return objects;
     }
 
     /**

Copied: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManageableHashMap.java (from r636881, jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManagedHashMap.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManageableHashMap.java?p2=jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManageableHashMap.java&p1=jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManagedHashMap.java&r1=636881&r2=646938&rev=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManagedHashMap.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ManageableHashMap.java Thu Apr 10 12:47:23 2008
@@ -21,32 +21,33 @@
 import java.util.Map;
 
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
 
 /**
  * The <code>ManagedHashMap</code> class provides Map support to JCR Mapping
  *
  * @author <a href="mailto:fmeschbe[at]apache[dot]com">Felix Meschberger</a>
  */
-public class ManagedHashMap extends HashMap implements ManageableCollection {
+public class ManageableHashMap extends HashMap implements ManageableMap {
 
-    public ManagedHashMap() {
+    public ManageableHashMap() {
     }
 
-    public ManagedHashMap(int initialCapacity) {
+    public ManageableHashMap(int initialCapacity) {
         super(initialCapacity);
     }
 
-    public ManagedHashMap(Map m) {
+    public ManageableHashMap(Map m) {
         super(m);
     }
 
-    public ManagedHashMap(int initialCapacity, float loadFactor) {
+    public ManageableHashMap(int initialCapacity, float loadFactor) {
         super(initialCapacity, loadFactor);
     }
 
 
-    public void addObject(Object object) {
-        put(object, object);
+    public void addObject(Object key, Object object) {
+        put(key, object);
     }
 
     public Iterator getIterator() {

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/MultiValueCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/MultiValueCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/MultiValueCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/MultiValueCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -29,10 +29,12 @@
 import javax.jcr.ValueFactory;
 import javax.jcr.ValueFormatException;
 
+import org.apache.jackrabbit.ocm.exception.JcrMappingException;
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -68,17 +70,17 @@
     protected void doInsertCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) throws RepositoryException {
+                                      ManageableObjects objects) throws RepositoryException {
         try {
-            if (collection == null) {
+            if (objects == null) {
                 return;
             }
 
             String jcrName = getCollectionJcrName(collectionDescriptor);
-            Value[] values = new Value[collection.getSize()];
+            Value[] values = new Value[objects.getSize()];
             ValueFactory valueFactory = session.getValueFactory();
-            Iterator collectionIterator = collection.getIterator();
-            for (int i = 0; i < collection.getSize(); i++) {
+            Iterator collectionIterator = objects.getIterator();
+            for (int i = 0; i < objects.getSize(); i++) {
                 Object fieldValue = collectionIterator.next();
                 AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters
                     .get(fieldValue.getClass());
@@ -102,7 +104,7 @@
     protected void doUpdateCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
-                                 ManageableCollection collection) throws RepositoryException {
+                                 ManageableObjects objects) throws RepositoryException {
         String jcrName = getCollectionJcrName(collectionDescriptor);
 
         // Delete existing values
@@ -110,16 +112,16 @@
             parentNode.setProperty(jcrName, (Value[]) null);
         }
 
-        if (collection == null) {
+        if (objects == null) {
             return;
         }
 
 
         // Add all collection element into an Value array
-        Value[] values = new Value[collection.getSize()];
+        Value[] values = new Value[objects.getSize()];
         ValueFactory valueFactory = session.getValueFactory();
         int i = 0;
-        for (Iterator collectionIterator = collection.getIterator(); collectionIterator.hasNext(); i++) {
+        for (Iterator collectionIterator = objects.getIterator(); collectionIterator.hasNext(); i++) {
             Object fieldValue = collectionIterator.next();
             AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters
                 .get(fieldValue.getClass());
@@ -132,7 +134,7 @@
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
                                                    Node parentNode,
                                                    CollectionDescriptor collectionDescriptor,
                                                    Class collectionFieldClass) throws RepositoryException {
@@ -144,16 +146,27 @@
             Property property = parentNode.getProperty(jcrName);
             Value[] values = property.getValues();
 
-            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
             String elementClassName = collectionDescriptor.getElementClassName();
             Class elementClass = ReflectionUtils.forName(elementClassName);
+            // For multi value collections, only Collections are supported
+            if (! (objects instanceof ManageableCollection))
+            {
+
+            	throw new JcrMappingException("Impossible to retrieve the attribute "
+            			+ collectionDescriptor.getFieldName() + " in the class "
+            			+ collectionDescriptor.getClassDescriptor().getClassName()
+            			+  " because it is not a collection");
+            }
+
             for (int i = 0; i < values.length; i++) {
                 AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters
                     .get(elementClass);
-                collection.addObject(atomicTypeConverter.getObject(values[i]));
+
+                ((ManageableCollection) objects).addObject(atomicTypeConverter.getObject(values[i]));
             }
 
-            return collection;
+            return objects;
         }
         catch(ValueFormatException vfe) {
           throw new ObjectContentManagerException("Cannot get the collection field : "

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -38,8 +38,11 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.ocm.exception.JcrMappingException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
@@ -107,14 +110,14 @@
     protected void doInsertCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) {
-        if (collection == null) {
+                                      ManageableObjects objects) {
+        if (objects == null) {
             return;
         }
 
         ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
 
-        Iterator collectionIterator = collection.getIterator();
+        Iterator collectionIterator = objects.getIterator();
         while (collectionIterator.hasNext()) {
             Object item = collectionIterator.next();
             String elementJcrName = null;
@@ -139,22 +142,22 @@
     protected void doUpdateCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) throws RepositoryException {
+                                      ManageableObjects objects) throws RepositoryException {
 
         ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass(
                 ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
 
-        if (collection == null || !elementClassDescriptor.hasIdField()) {
+        if (objects == null || !elementClassDescriptor.hasIdField()) {
             this.deleteCollectionItems(session,
                                        parentNode,
                                        elementClassDescriptor.getJcrType());
         }
 
-        if (collection == null) {
+        if (objects == null) {
             return;
         }
 
-        Iterator collectionIterator = collection.getIterator();
+        Iterator collectionIterator = objects.getIterator();
         Map updatedItems = new HashMap();
         while (collectionIterator.hasNext()) {
             Object item = collectionIterator.next();
@@ -201,12 +204,12 @@
     /**
      * @see org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#getCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, java.lang.Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
                                                    Node parentNode,
                                                    CollectionDescriptor collectionDescriptor,
                                                    Class collectionFieldClass) throws RepositoryException {
 	    ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
-        ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+        ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
 
         NodeIterator nodes = this.getCollectionNodes(session, parentNode, elementClassDescriptor.getJcrType());
 
@@ -219,10 +222,25 @@
             Node itemNode = (Node) nodes.next();
             log.debug("Collection node found : " + itemNode.getPath());
             Object item = objectConverter.getObject(session,  itemNode.getPath());
-            collection.addObject(item);
+            mapper.getClassDescriptorByClass(item.getClass());
+            if ( objects instanceof ManageableCollection)
+            	((ManageableCollection)objects).addObject(item);
+            else {
+            	if (!elementClassDescriptor.hasIdField())
+            	{
+            		throw new JcrMappingException("Impossible to use a map for the field : "
+            				                      + collectionDescriptor.getFieldName()
+            				                      + "in the class : " + collectionDescriptor.getCollectionClassName()
+            				                      + ". The element objects have no id field (check their OCM mapping)");
+            	}
+            	Object elementId = ReflectionUtils.getNestedProperty(item,
+            			                           elementClassDescriptor.getIdFieldDescriptor().getFieldName());
+                ((ManageableMap) objects).addObject(elementId, item);
+            }
+
         }
 
-        return collection;
+        return objects;
     }
 
     /**
@@ -238,7 +256,7 @@
 
         String elementClassName = collectionDescriptor.getElementClassName();
         ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.forName(elementClassName));
-		QueryResult queryResult = getQuery(session, parentNode, elementClassDescriptor.getJcrType());    	
+		QueryResult queryResult = getQuery(session, parentNode, elementClassDescriptor.getJcrType());
     	return queryResult.getNodes().getSize() == 0;
     }
 
@@ -270,9 +288,9 @@
     }
 
 
-	
+
 	private QueryResult getQuery(Session session, Node parentNode, String jcrNodeType) throws RepositoryException, InvalidQueryException {
-    	String jcrExpression= "";    	
+    	String jcrExpression= "";
     	if (!parentNode.getPath().startsWith("/jcr:system/jcr:versionStorage"))
     	{
             jcrExpression = "SELECT * FROM " + jcrNodeType + " WHERE jcr:path LIKE '" + parentNode.getPath()
@@ -280,12 +298,12 @@
     	}
     	else
     	{
-    	
+
     		jcrExpression = "SELECT * FROM nt:frozenNode" + " WHERE jcr:path LIKE '" + parentNode.getPath() + "/%'"
     		                 + " AND NOT jcr:path LIKE '" + parentNode.getPath() + "/%/%'"
     		                 + " AND jcr:frozenPrimaryType = '" + jcrNodeType + "'";
 
-    		
+
     	}
         Query jcrQuery = session.getWorkspace().getQueryManager().createQuery(jcrExpression, javax.jcr.query.Query.SQL);
         QueryResult queryResult = jcrQuery.execute();

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ReferenceCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ReferenceCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ReferenceCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ReferenceCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -36,7 +36,8 @@
 
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -69,8 +70,8 @@
     protected void doInsertCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
-                                      ManageableCollection collection) throws RepositoryException {
-        addUuidProperties(session, parentNode, collectionDescriptor, collection);
+                                      ManageableObjects objects) throws RepositoryException {
+        addUuidProperties(session, parentNode, collectionDescriptor, objects);
     }
 
     /**
@@ -80,7 +81,7 @@
     protected void doUpdateCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
-                                 ManageableCollection collection) throws RepositoryException {
+                                 ManageableObjects objects) throws RepositoryException {
         String jcrName = getCollectionJcrName(collectionDescriptor);
 
         // Delete existing values
@@ -88,17 +89,18 @@
             parentNode.setProperty(jcrName, (Value[]) null);
         }
 
-        if (collection == null) {
+        if (objects == null) {
             return;
         }
 
 
-        addUuidProperties(session, parentNode, collectionDescriptor, collection);    }
+        addUuidProperties(session, parentNode, collectionDescriptor, objects);
+    }
 
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
                                                    Node parentNode,
                                                    CollectionDescriptor collectionDescriptor,
                                                    Class collectionFieldClass) throws RepositoryException {
@@ -110,13 +112,17 @@
             Property property = parentNode.getProperty(jcrName);
             Value[] values = property.getValues();
 
-            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
             for (int i = 0; i < values.length; i++) {
 
-                collection.addObject(values[i].getString());
+            	if (objects instanceof ManageableCollection)
+                    ((ManageableCollection)objects).addObject(values[i].getString());
+            	else
+            		throw new ObjectContentManagerException(
+            				"Unsupported data type in ReferenceCollectionConverter : " + objects.getClass().getName());
             }
 
-            return collection;
+            return objects;
         }
         catch(ValueFormatException vfe) {
           throw new ObjectContentManagerException("Cannot get the collection field : "
@@ -141,17 +147,19 @@
         return false;
     }
 
-	private void addUuidProperties(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection) throws UnsupportedRepositoryOperationException, RepositoryException, VersionException, LockException, ConstraintViolationException {
+	private void addUuidProperties(Session session, Node parentNode,
+			             CollectionDescriptor collectionDescriptor, ManageableObjects objects)
+	                     throws UnsupportedRepositoryOperationException, RepositoryException, VersionException, LockException, ConstraintViolationException {
 		try {
-            if (collection == null) {
+            if (objects == null) {
                 return;
             }
 
             String jcrName = getCollectionJcrName(collectionDescriptor);
-            Value[] values = new Value[collection.getSize()];
+            Value[] values = new Value[objects.getSize()];
             ValueFactory valueFactory = session.getValueFactory();
-            Iterator collectionIterator = collection.getIterator();
-            for (int i = 0; i < collection.getSize(); i++) {
+            Iterator collectionIterator = objects.getIterator();
+            for (int i = 0; i < objects.getSize(); i++) {
                 String uuid = (String) collectionIterator.next();
                 values[i] = valueFactory.createValue(uuid, PropertyType.REFERENCE);
 

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -31,7 +31,9 @@
 
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -65,13 +67,13 @@
      */
     protected void doInsertCollection(Session session, Node parentNode,
         CollectionDescriptor collectionDescriptor,
-        ManageableCollection collection) {
+        ManageableObjects objects) {
 
-        if (!(collection instanceof Map)) {
+        if (!(objects instanceof Map)) {
             return;
         }
 
-        Map map = (Map) collection;
+        Map map = (Map) objects;
         for (Iterator ei=map.entrySet().iterator(); ei.hasNext(); ) {
             Map.Entry entry = (Map.Entry) ei.next();
             String name = String.valueOf(entry.getKey());
@@ -85,17 +87,17 @@
      */
     protected void doUpdateCollection(Session session, Node parentNode,
             CollectionDescriptor collectionDescriptor,
-            ManageableCollection collection) throws RepositoryException {
+            ManageableObjects objects) throws RepositoryException {
 
         String jcrName = getCollectionJcrName(collectionDescriptor);
-        if (!(collection instanceof Map)) {
+        if (!(objects instanceof Map)) {
             for (NodeIterator ni=parentNode.getNodes(jcrName); ni.hasNext(); ) {
                 ni.nextNode().remove();
             }
             return;
         }
 
-        Map map = (Map) collection;
+        Map map = (Map) objects;
         Set updatedItems = new HashSet();
         for (Iterator ei=map.entrySet().iterator(); ei.hasNext(); ) {
             Map.Entry entry = (Map.Entry) ei.next();
@@ -131,7 +133,7 @@
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
         Node parentNode, CollectionDescriptor collectionDescriptor,
         Class collectionFieldClass) throws RepositoryException {
 
@@ -142,7 +144,7 @@
                 return null;
             }
 
-            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
             while (ni.hasNext()) {
                 Node node = ni.nextNode();
 
@@ -152,15 +154,22 @@
                 }
 
                 Object item = objectConverter.getObject(session, node.getPath());
-                if (collection instanceof Map) {
+                if (objects instanceof Map) {
                     String name = node.getName();
-                    ((Map) collection).put(name, item);
-                } else {
-                    collection.addObject(item);
+                    ((Map) objects).put(name, item);
+                }
+                else {
+                	if (objects instanceof ManageableCollection)
+                        ((ManageableCollection)objects).addObject(item);
+               	   else
+               	   {
+               		String name = node.getName();
+               		((ManageableMap)objects).addObject(name, item);
+               	   }
                 }
             }
+            return objects;
 
-            return collection;
         } catch (ValueFormatException vfe) {
             throw new ObjectContentManagerException("Cannot get the collection field : "
                 + collectionDescriptor.getFieldName() + "for class "

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualPropertiesCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualPropertiesCollectionConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualPropertiesCollectionConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualPropertiesCollectionConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -33,7 +33,9 @@
 import org.apache.jackrabbit.ocm.exception.ObjectContentManagerException;
 import org.apache.jackrabbit.ocm.manager.atomictypeconverter.AtomicTypeConverter;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableMap;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.mapper.Mapper;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -67,9 +69,9 @@
      */
     protected void doInsertCollection(Session session, Node parentNode,
         CollectionDescriptor collectionDescriptor,
-        ManageableCollection collection) throws RepositoryException {
+        ManageableObjects objects) throws RepositoryException {
         internalSetProperties(session, parentNode, collectionDescriptor,
-            collection, false);
+            objects, false);
     }
 
     /**
@@ -78,15 +80,15 @@
      */
     protected void doUpdateCollection(Session session, Node parentNode,
         CollectionDescriptor collectionDescriptor,
-        ManageableCollection collection) throws RepositoryException {
+        ManageableObjects objects) throws RepositoryException {
         internalSetProperties(session, parentNode, collectionDescriptor,
-            collection, true);
+            objects, true);
     }
 
     /**
      * @see AbstractCollectionConverterImpl#doGetCollection(Session, Node, CollectionDescriptor, Class)
      */
-    protected ManageableCollection doGetCollection(Session session,
+    protected ManageableObjects doGetCollection(Session session,
         Node parentNode, CollectionDescriptor collectionDescriptor,
         Class collectionFieldClass) throws RepositoryException {
         try {
@@ -96,7 +98,7 @@
                 return null;
             }
 
-            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
+            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
             AtomicTypeConverter atomicTypeConverter = getAtomicTypeConverter(collectionDescriptor);
 
             while (pi.hasNext()) {
@@ -120,15 +122,21 @@
                     value = atomicTypeConverter.getObject(prop.getValue());
                 }
 
-                if (collection instanceof Map) {
+                if (objects instanceof Map) {
                     String name = prop.getName();
-                    ((Map) collection).put(name, value);
+                    ((Map) objects).put(name, value);
                 } else {
-                    collection.addObject(value);
+                	if (objects instanceof ManageableCollection)
+                         ((ManageableCollection)objects).addObject(value);
+                	else
+                	{
+                		String name = prop.getName();
+                		((ManageableMap)objects).addObject(name, value);
+                	}
                 }
             }
 
-            return collection;
+            return objects;
         } catch (ValueFormatException vfe) {
             throw new ObjectContentManagerException("Cannot get the collection field : "
                 + collectionDescriptor.getFieldName() + "for class "
@@ -148,13 +156,13 @@
 
     private void internalSetProperties(Session session, Node parentNode,
         CollectionDescriptor collectionDescriptor,
-        ManageableCollection collection, boolean removeExisting)
+        ManageableObjects objects, boolean removeExisting)
         throws RepositoryException {
 
         String jcrName = getCollectionJcrName(collectionDescriptor);
 
         // can only persist maps, not general collections
-        if (!(collection instanceof Map)) {
+        if (!(objects instanceof Map)) {
             return;
         }
 
@@ -171,7 +179,7 @@
         AtomicTypeConverter atomicTypeConverter = getAtomicTypeConverter(collectionDescriptor);
 
         try {
-            Map map = (Map) collection;
+            Map map = (Map) objects;
             ValueFactory valueFactory = session.getValueFactory();
             for (Iterator ei = map.entrySet().iterator(); ei.hasNext();) {
                 Map.Entry entry = (Map.Entry) ei.next();

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/CollectionLazyLoader.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/CollectionLazyLoader.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/CollectionLazyLoader.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/CollectionLazyLoader.java Thu Apr 10 12:47:23 2008
@@ -25,7 +25,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
 
 public class CollectionLazyLoader implements LazyLoader {
@@ -37,7 +37,7 @@
 	private Node collectionParentNode;
 	private CollectionDescriptor collectionDescriptor;
 	private Class collectionFieldClass;
-	
+
 	public CollectionLazyLoader(CollectionConverter collectionConverter, Session session, Node parentNode,
 			                                               CollectionDescriptor collectionDescriptor, Class collectionFieldClass ) {
 		this.collectionConverter = collectionConverter;
@@ -48,9 +48,9 @@
 	}
 
 	public Object loadObject() {
-	
-		
-		ManageableCollection collection = collectionConverter.getCollection(session, collectionParentNode, collectionDescriptor, collectionFieldClass);
-		return collection;
+
+
+		ManageableObjects objects = collectionConverter.getCollection(session, collectionParentNode, collectionDescriptor, collectionFieldClass);
+		return objects;
 	}
 }

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java Thu Apr 10 12:47:23 2008
@@ -43,7 +43,8 @@
 import org.apache.jackrabbit.ocm.manager.cache.impl.RequestObjectCacheImpl;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.impl.DefaultCollectionConverterImpl;
 import org.apache.jackrabbit.ocm.manager.impl.ObjectContentManagerUtil;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
@@ -227,13 +228,13 @@
 			throws NoSuchNodeTypeException, VersionException,
 			ConstraintViolationException, LockException, RepositoryException,
 			ValueFormatException {
-		
+
 		try {
 			objectNode.setProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY,
 					ReflectionUtils.getBeanClass(object).getName());
-			
+
 		} catch (Exception e) {
-			// if it is not possible to add the CLASS_NAME_PROPERTY due to strong constraints in the 
+			// if it is not possible to add the CLASS_NAME_PROPERTY due to strong constraints in the
 			// node type definition, try to add the Discriminator node type.
 			String mixinTypeName;
 			mixinTypeName = ManagerConstant.DISCRIMINATOR_NODE_TYPE;
@@ -241,7 +242,7 @@
 			objectNode.setProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY,
 					ReflectionUtils.getBeanClass(object).getName());
 		}
-		
+
 	}
 
 	/**
@@ -420,8 +421,8 @@
 
             simpleFieldsHelp.retrieveSimpleFields(session, classDescriptor, node, object);
 			retrieveBeanFields(session, classDescriptor, node, path, object, false);
-			retrieveCollectionFields(session, classDescriptor, node, object, false);			
-			
+			retrieveCollectionFields(session, classDescriptor, node, object, false);
+
 			return object;
 		} catch (PathNotFoundException pnfe) {
 			// HINT should never get here
@@ -700,16 +701,16 @@
 
 		CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
 		Class collectionFieldClass = ReflectionUtils.getPropertyType(object, collectionDescriptor.getFieldName());
-		ManageableCollection collection = null;
+		ManageableObjects objects = null;
 		if (collectionDescriptor.isProxy()) {
-			collection = (ManageableCollection) proxyManager.createCollectionProxy(session, collectionConverter, parentNode,
+			objects = (ManageableCollection) proxyManager.createCollectionProxy(session, collectionConverter, parentNode,
 					collectionDescriptor, collectionFieldClass);
 
 		} else {
-			collection = collectionConverter.getCollection(session, parentNode, collectionDescriptor, collectionFieldClass);
+			objects = collectionConverter.getCollection(session, parentNode, collectionDescriptor, collectionFieldClass);
 		}
 
-		ReflectionUtils.setNestedProperty(object, collectionDescriptor.getFieldName(), collection);
+		ReflectionUtils.setNestedProperty(object, collectionDescriptor.getFieldName(), objects);
 	}
 
 	/**
@@ -801,7 +802,7 @@
 
 			CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
 			Object collection = ReflectionUtils.getNestedProperty(object, collectionDescriptor.getFieldName());
-			ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collection);
+			ManageableObjects manageableCollection = ManageableObjectsUtil.getManageableObjects(collection);
 
 			collectionConverter.insertCollection(session, objectNode, collectionDescriptor, manageableCollection);
 		}
@@ -818,7 +819,7 @@
 
 			CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
 			Object collection = ReflectionUtils.getNestedProperty(object, collectionDescriptor.getFieldName());
-			ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collection);
+			ManageableObjects manageableCollection = ManageableObjectsUtil.getManageableObjects(collection);
 
 			collectionConverter.updateCollection(session, objectNode, collectionDescriptor, manageableCollection);
 		}

Modified: jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ProxyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ProxyManagerImpl.java?rev=646938&r1=646937&r2=646938&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ProxyManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-ocm/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ProxyManagerImpl.java Thu Apr 10 12:47:23 2008
@@ -27,8 +27,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection;
-import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollectionUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjectsUtil;
+import org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableObjects;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter;
 import org.apache.jackrabbit.ocm.manager.objectconverter.ProxyManager;
 import org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor;
@@ -37,8 +37,8 @@
 {
 
 	private final static Log log = LogFactory.getLog(ProxyManagerImpl.class);
-	
-	
+
+
 
 	/**
 	 *
@@ -46,7 +46,7 @@
 	 */
 	public  Object createBeanProxy(Session session, ObjectConverter objectConverter, Class beanClass, String path)
 	{
-		
+
        try {
 			if (!session.itemExists(path)) {
 				return null;
@@ -54,8 +54,8 @@
 		} catch (RepositoryException e) {
 			throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible to check,if the object exits on " + path, e);
 		}
-				
-		LazyLoader loader = new BeanLazyLoader(objectConverter, session, beanClass, path) ;		
+
+		LazyLoader loader = new BeanLazyLoader(objectConverter, session, beanClass, path) ;
 		return  Enhancer.create(beanClass, loader);
 	}
 
@@ -64,15 +64,15 @@
 	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ProxyManager#createCollectionProxy(javax.jcr.Session, org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, java.lang.Class)
 	 */
 	public  Object createCollectionProxy(Session session, CollectionConverter collectionConverter, Node parentNode,  CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
-	{	
-		
+	{
+
 		if (collectionConverter.isNull(session, parentNode, collectionDescriptor, collectionFieldClass)) 	{
 			return null;
 		}
-		
-		ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
-		
+
+		ManageableObjects manageableCollection = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
+
 		LazyLoader loader = new CollectionLazyLoader(collectionConverter, session, parentNode, collectionDescriptor, collectionFieldClass);
 		return  Enhancer.create(manageableCollection.getClass(), loader);
-	}	
+	}
 }



Mime
View raw message