incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r407383 [1/2] - in /incubator/graffito/trunk/jcr/jcr-mapping/src: java/org/apache/portals/graffito/jcr/persistence/ java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/ java/org/apache/portals/graffito/jcr/persistence/...
Date Wed, 17 May 2006 21:49:44 GMT
Author: clombart
Date: Wed May 17 14:49:42 2006
New Revision: 407383

URL: http://svn.apache.org/viewvc?rev=407383&view=rev
Log:
* Add ParentFolderBeanConverter
* Review inheritance, interface support, ...
* Add new method on the persistence manager : getObject (without class ref).

Added:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/AbstractBeanConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerQueryInheritanceConcreteClassTest.java
Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceConstant.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/ObjectIterator.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanLazyLoader.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping.xml
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceConcreteClassTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInterfaceHierarchyTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerSameNameSiblingTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanDescriptorTest.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyTest.java

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceConstant.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceConstant.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceConstant.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceConstant.java Wed May 17 14:49:42 2006
@@ -30,5 +30,8 @@
 	public static final String DISCRIMINATOR_NODE_TYPE = "graffito:discriminator";
 	public static final String DISCRIMINATOR_PROPERTY_NAME = "graffito:classname"; 
 	
+	
+	public static final String FROZEN_NODE_TYPE = "nt:frozenNode";
+	public static final String FROZEN_PRIMARY_TYPE_PROPERTY = "jcr:frozenPrimaryType";
         
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java Wed May 17 14:49:42 2006
@@ -75,6 +75,25 @@
 
     /**
      * Get an object from the JCR repository 
+     * @param path the object path
+     * @return the object found or null
+     * 
+     * @throws PersistenceException when it is not possible to retrieve the object 
+     */
+    public Object getObject( String path) throws PersistenceException;
+
+    /**
+     * Get an object from the JCR repository 
+     * @param path the object path
+     * @param versionNumber The desired object version number
+     * @return the object found or null
+     * 
+     * @throws PersistenceException when it is not possible to retrieve the object 
+     */
+    public Object getObject(String path, String versionNumber) throws PersistenceException;
+    
+    /**
+     * Get an object from the JCR repository 
      * @param objectClass the object class
      * @param path the object path
      * @return the object found or null

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImpl.java Wed May 17 14:49:42 2006
@@ -105,7 +105,7 @@
 
         Node collectionNode = parentNode.addNode(jcrName);
         
-        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); 
+        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); 
 
         Iterator collectionIterator = collection.getIterator();
         int elementCollectionCount = 0;
@@ -148,7 +148,7 @@
         }
 
         
-        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));         
+        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
         if (!elementClassDescriptor.hasIdField()) {
@@ -225,7 +225,7 @@
         
         while (children.hasNext()) {
             Node itemNode = children.nextNode();
-            Object item = objectConverter.getObject(session, elementClass, itemNode.getPath());
+            Object item = objectConverter.getObject(session, itemNode.getPath());
             collection.addObject(item);
         }
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImpl.java Wed May 17 14:49:42 2006
@@ -102,7 +102,7 @@
             return;
         }
         
-        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
+        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
 
         Iterator collectionIterator = collection.getIterator();
         int elementCollectionCount = 0;
@@ -133,7 +133,7 @@
                                       CollectionDescriptor collectionDescriptor,
                                       ManageableCollection collection) throws RepositoryException {
         Mapper mapper = collectionDescriptor.getClassDescriptor().getMappingDescriptor().getMapper();
-        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor(
+        ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass(
                 ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
 
         if (collection == null || !elementClassDescriptor.hasIdField()) {
@@ -199,7 +199,7 @@
                                                    Node parentNode,
                                                    CollectionDescriptor collectionDescriptor,
                                                    Class collectionFieldClass) throws RepositoryException {
-	    ClassDescriptor elementClassDescriptor = mapper.getClassDescriptor( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); 
+	    ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName())); 
         ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
         Class elementClass = ReflectionUtils.forName(collectionDescriptor.getElementClassName());
         Iterator children = this.getCollectionNodes(session, parentNode,
@@ -208,7 +208,7 @@
         while (children.hasNext()) {
             Node itemNode = (Node) children.next();
             log.debug("Collection node found : " + itemNode.getPath());
-            Object item = objectConverter.getObject(session, elementClass, itemNode.getPath());
+            Object item = objectConverter.getObject(session,  itemNode.getPath());
             collection.addObject(item);
         }
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/ObjectIterator.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/ObjectIterator.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/ObjectIterator.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/ObjectIterator.java Wed May 17 14:49:42 2006
@@ -79,7 +79,7 @@
 		try
 		{
 			Node node = nodeIterator.nextNode();
-			return objectConverter.getObject(session, objectClass, node.getPath());
+			return objectConverter.getObject(session, node.getPath());
 		}
 		catch (Exception e)
 		{

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java Wed May 17 14:49:42 2006
@@ -179,6 +179,51 @@
      * @throws JcrMappingException if the mapping for the class is not correct
      * @throws PersistenceException if the object cannot be retrieved from the path
      */
+    public Object getObject( String path) {
+        try {
+            if (!session.itemExists(path)) {
+                return null;
+            }
+        }         
+        catch(RepositoryException e) {
+            throw new org.apache.portals.graffito.jcr.exception.RepositoryException(
+                    "Impossible to get the object at " + path, e);
+        }
+
+        return objectConverter.getObject(session,  path);
+
+    }
+
+    /**
+     * @see org.apache.portals.graffito.jcr.persistence.PersistenceManager#getObject(java.lang.Class, java.lang.String, java.lang.String)
+     */
+    public Object getObject( String path, String versionName) {
+        String pathVersion = null;
+        try {
+            if (!session.itemExists(path)) {
+                return null;
+            }
+
+            Version version = this.getVersion(path, versionName);
+            pathVersion = version.getPath() + "/jcr:frozenNode";
+
+        } 
+        catch(RepositoryException e) {
+            throw new org.apache.portals.graffito.jcr.exception.RepositoryException(
+                    "Impossible to get the object at " + path + " - version :" + versionName,
+                    e);
+        }
+
+        return objectConverter.getObject(session,  pathVersion);
+    }
+
+    /**
+     * @see org.apache.portals.graffito.jcr.persistence.PersistenceManager#getObject(java.lang.Class, java.lang.String)
+     * @throws org.apache.portals.graffito.jcr.exception.RepositoryException if the underlying repository
+     *  has thrown a javax.jcr.RepositoryException
+     * @throws JcrMappingException if the mapping for the class is not correct
+     * @throws PersistenceException if the object cannot be retrieved from the path
+     */
     public Object getObject(Class objectClass, String path) {
         try {
             if (!session.itemExists(path)) {
@@ -215,8 +260,8 @@
         }
 
         return objectConverter.getObject(session, objectClass, pathVersion);
-    }
-
+    }    
+    
     /**
      * @see org.apache.portals.graffito.jcr.persistence.PersistenceManager#insert(java.lang.Object)
      */
@@ -367,7 +412,7 @@
      */
     public boolean isPersistent(final Class clazz) {
         boolean isPersistent = false;
-        ClassDescriptor classDescriptor = mapper.getClassDescriptor(clazz);
+        ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(clazz);
         if (classDescriptor != null) {
             isPersistent = true;
         }
@@ -396,9 +441,7 @@
             Object object = null;
             if (nodeIterator.hasNext()) {
                 Node node = nodeIterator.nextNode();
-                object = objectConverter.getObject(session,
-                                                   query.getFilter().getFilterClass(),
-                                                   node.getPath());
+                object = objectConverter.getObject(session, node.getPath());
             }
 
             return object;
@@ -430,9 +473,7 @@
             while (nodeIterator.hasNext()) {
                 Node node = nodeIterator.nextNode();
                 log.debug("Node found : " + node.getPath());
-                result.add(objectConverter.getObject(session,
-                                                     query.getFilter().getFilterClass(),
-                                                     node.getPath()));
+                result.add(objectConverter.getObject(session,  node.getPath()));
             }
 
             return result;

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java Wed May 17 14:49:42 2006
@@ -58,8 +58,19 @@
      * 
      * @throws PersistenceException when it is not possible to retrieve the object
      */
-    public Object getObject(Session session, Class clazz, String path) throws PersistenceException;
+    public Object getObject(Session session, String path) throws PersistenceException;
     
+    /**
+     * Retrieve an object from the JCR repo
+     * 
+     * @param session The JCR session 
+     * @param clazz The class assigned to the object to retrieve
+     * @param path the JCR path
+     * @return The object found or null
+     * 
+     * @throws PersistenceException when it is not possible to retrieve the object
+     */
+    public Object getObject(Session session, Class clazz, String path) throws PersistenceException;
     
 	/**
 	 * Insert the object 

Added: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/AbstractBeanConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/AbstractBeanConverterImpl.java?rev=407383&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/AbstractBeanConverterImpl.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/AbstractBeanConverterImpl.java Wed May 17 14:49:42 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.portals.graffito.jcr.persistence.objectconverter.impl;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.exception.JcrMappingException;
+import org.apache.portals.graffito.jcr.exception.PersistenceException;
+import org.apache.portals.graffito.jcr.exception.RepositoryException;
+import org.apache.portals.graffito.jcr.mapper.model.BeanDescriptor;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.BeanConverter;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
+
+public abstract class AbstractBeanConverterImpl implements BeanConverter {
+
+	protected  ObjectConverter objectConverter;
+	
+	public AbstractBeanConverterImpl(ObjectConverter objectConverter)
+	{
+		this.objectConverter = objectConverter;
+	}
+	private final static Log log = LogFactory.getLog(AbstractBeanConverterImpl.class);
+	
+    public abstract void insert(Session session, Node parentNode, BeanDescriptor descriptor, Object object)
+			throws PersistenceException, RepositoryException, 	JcrMappingException;
+
+	public abstract  void update(Session session, Node parentNode, 	BeanDescriptor descriptor, Object object)
+			throws PersistenceException, RepositoryException,	JcrMappingException;
+	
+	public abstract Object getObject(Session session, Node parentNode,BeanDescriptor descriptor, Class beanClass)
+			throws PersistenceException, RepositoryException,JcrMappingException ;
+
+	public abstract void remove(Session session, Node parentNode,	BeanDescriptor descriptor)
+	          throws PersistenceException,	RepositoryException, JcrMappingException ;
+}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanLazyLoader.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanLazyLoader.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanLazyLoader.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/BeanLazyLoader.java Wed May 17 14:49:42 2006
@@ -45,6 +45,6 @@
 
 	public Object loadObject() 
 	{				
-		return objectConverter.getObject(session, beanClass, path);		
+		return objectConverter.getObject(session, path);		
 	}
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java Wed May 17 14:49:42 2006
@@ -50,12 +50,11 @@
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollectionUtil;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.DefaultCollectionConverterImpl;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.BeanConverter;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
 import org.apache.portals.graffito.jcr.reflection.ReflectionUtils;
 import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
 
-import sun.reflect.misc.ReflectUtil;
-
 /**
  * Default implementation for {@link ObjectConverterImpl}
  * 
@@ -141,7 +140,7 @@
 	 *      javax.jcr.Node, java.lang.String, java.lang.Object)
 	 */
 	public void insert(Session session, Node parentNode, String nodeName, Object object) {
-		ClassDescriptor classDescriptor = getClassDescriptor(object.getClass());
+		ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());
 
 		String jcrNodeType = classDescriptor.getJcrNodeType();
 		if ((jcrNodeType == null) || jcrNodeType.equals("")) {
@@ -178,7 +177,7 @@
 				while (interfacesIterator.hasNext())
 				{
 					String interfaceName = (String)  interfacesIterator.next();
-					ClassDescriptor interfaceDescriptor =  mapper.getClassDescriptor(ReflectionUtils.forName(interfaceName));
+					ClassDescriptor interfaceDescriptor =  mapper.getClassDescriptorByClass(ReflectionUtils.forName(interfaceName));
 					objectNode.addMixin(interfaceDescriptor.getJcrNodeType().trim());
 				}			    
 			}
@@ -230,7 +229,7 @@
 	 */
 	public void update(Session session, Node parentNode, String nodeName, Object object) {
 		try {
-			ClassDescriptor classDescriptor = getClassDescriptor(ReflectionUtils.getBeanClass(object));
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object));
 			Node objectNode = parentNode.getNode(nodeName);
 
 			checkNodeType(session, classDescriptor);
@@ -252,6 +251,54 @@
 	 * @see org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter#getObject(javax.jcr.Session,
 	 *      java.lang.Class, java.lang.String)
 	 */
+	public Object getObject(Session session,  String path) {
+		try {
+			if (!session.itemExists(path)) {
+				return null;
+			}
+			
+			ClassDescriptor classDescriptor =null;
+			Node node = (Node) session.getItem(path);
+			if (node.hasProperty(PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME))
+			{
+				String className = node.getProperty(PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME).getValue().getString();
+				classDescriptor = mapper.getClassDescriptorByClass(Class.forName(className));				
+			}
+			else
+			{
+				String nodeType = node.getPrimaryNodeType().getName();
+				if (nodeType.equals(PersistenceConstant.FROZEN_NODE_TYPE))
+				{
+					nodeType = node.getProperty(PersistenceConstant.FROZEN_PRIMARY_TYPE_PROPERTY).getString();
+				}
+			    classDescriptor = mapper.getClassDescriptorByNodeType(nodeType);
+			}
+			
+			if (null == classDescriptor) {
+				throw new JcrMappingException("Impossible to find the classdescriptor for " + path + ". There is no discriminator and associated  JCR node type");
+			}
+
+			Object object = ReflectionUtils.newInstance(classDescriptor.getClassName());
+
+			retrieveSimpleFields(session, classDescriptor, node, object);
+			retrieveBeanFields(session, classDescriptor, node, path, object);
+			retrieveCollectionFields(session, classDescriptor, node, object);
+
+			return object;
+		} catch (ClassNotFoundException clnf) {
+			throw new PersistenceException("Impossible to instantiate the object at " + path, clnf);
+		} catch (PathNotFoundException pnfe) {
+			// HINT should never get here
+			throw new PersistenceException("Impossible to get the object at " + path, pnfe);
+		} catch (RepositoryException re) {
+			throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Impossible to get the object at " + path, re);
+		}
+	}
+
+	/**
+	 * @see org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter#getObject(javax.jcr.Session,
+	 *      java.lang.Class, java.lang.String)
+	 */
 	public Object getObject(Session session, Class clazz, String path) {
 		try {
 			if (!session.itemExists(path)) {
@@ -304,6 +351,7 @@
 		}
 	}
 
+	
 	/**
 	 * Validates the node type used by the class descriptor.
 	 * 
@@ -373,9 +421,9 @@
 
 			boolean compatible = checkCompatibleNodeTypes(nodeType, classDescriptor);
 
-			if (!compatible && checkVersionNode && "nt:frozenNode".equals(nodeType.getName())) {
+			if (!compatible && checkVersionNode && PersistenceConstant.FROZEN_NODE_TYPE.equals(nodeType.getName())) {
 				NodeTypeManager ntMgr = session.getWorkspace().getNodeTypeManager();
-				nodeType = ntMgr.getNodeType(node.getProperty("jcr:frozenPrimaryType").getString());
+				nodeType = ntMgr.getNodeType(node.getProperty(PersistenceConstant.FROZEN_PRIMARY_TYPE_PROPERTY).getString());
 
 				compatible = checkCompatibleNodeTypes(nodeType, classDescriptor);
 			}
@@ -428,7 +476,7 @@
 	 * @throws JcrMappingException
 	 */
 	public String getPath(Session session, Object object) {
-		ClassDescriptor classDescriptor = getClassDescriptor(object.getClass());
+		ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());
 
 		final FieldDescriptor pathFieldDescriptor = classDescriptor.getPathFieldDescriptor();
 		if (pathFieldDescriptor == null) {
@@ -523,11 +571,14 @@
 
 			} else {
 				if (beanDescriptor.isInline()) {
-					bean = this.retrieveSimpleFields(session, getClassDescriptor(beanClass), node, bean);
-				} else if (null != beanDescriptor.getBeanConverter()) {
-					bean = beanDescriptor.getBeanConverter().getObject(session, node, beanDescriptor, beanClass);
+					bean = this.retrieveSimpleFields(session, mapper.getClassDescriptorByClass(beanClass), node, bean);
+				} else if (null != beanDescriptor.getConverter() && ! "".equals(beanDescriptor.getConverter())) {
+					String converterClassName =  beanDescriptor.getConverter();
+					Object[] param = {this};
+					BeanConverter beanConverter =(BeanConverter) ReflectionUtils.invokeConstructor(converterClassName,param);
+					bean = beanConverter.getObject(session, node, beanDescriptor, beanClass);
 				} else {
-					bean = this.getObject(session, beanClass, path + "/" + beanDescriptor.getJcrName());
+					bean = this.getObject(session,  path + "/" + beanDescriptor.getJcrName());
 				}
 			}
 			ReflectionUtils.setNestedProperty(object, beanName, bean);
@@ -568,9 +619,12 @@
 			Object bean = ReflectionUtils.getNestedProperty(object, beanDescriptor.getFieldName());
 			if (bean != null) {
 				if (beanDescriptor.isInline()) {
-					this.storeSimpleFields(session, bean, getClassDescriptor(bean.getClass()), objectNode);
-				} else if (null != beanDescriptor.getBeanConverter()) {
-					beanDescriptor.getBeanConverter().insert(session, objectNode, beanDescriptor, object);
+					this.storeSimpleFields(session, bean, mapper.getClassDescriptorByClass(bean.getClass()), objectNode);
+				} else if (null != beanDescriptor.getConverter() && ! "".equals(beanDescriptor.getConverter())) {
+					String converterClassName =  beanDescriptor.getConverter();
+					Object[] param = {this};
+					BeanConverter beanConverter =(BeanConverter) ReflectionUtils.invokeConstructor(converterClassName,param);
+					beanConverter.insert(session, objectNode, beanDescriptor, object);
 				} else {
 					this.insert(session, objectNode, jcrName, bean);
 				}
@@ -594,9 +648,12 @@
 				if ((bean == null)) {
 					if (beanDescriptor.isInline()) {
 						Class beanClass = ReflectionUtils.getPropertyType(object, beanDescriptor.getFieldName());
-						this.storeSimpleFields(session, bean, getClassDescriptor(beanClass), objectNode);
-					} else if (null != beanDescriptor.getBeanConverter()) {
-						beanDescriptor.getBeanConverter().remove(session, objectNode, beanDescriptor);
+						this.storeSimpleFields(session, bean, mapper.getClassDescriptorByClass(beanClass), objectNode);
+					} else if (null != beanDescriptor.getConverter() && ! "".equals(beanDescriptor.getConverter())) {
+						String converterClassName =  beanDescriptor.getConverter();
+						Object[] param = {this};
+						BeanConverter beanConverter =(BeanConverter) ReflectionUtils.invokeConstructor(converterClassName,param);
+						beanConverter.remove(session, objectNode, beanDescriptor);
 					} else {
 						if (objectNode.hasNode(jcrName)) {
 							objectNode.getNode(jcrName).remove();
@@ -604,9 +661,12 @@
 					}
 				} else {
 					if (beanDescriptor.isInline()) {
-						this.storeSimpleFields(session, bean, getClassDescriptor(bean.getClass()), objectNode);
-					} else if (null != beanDescriptor.getBeanConverter()) {
-						beanDescriptor.getBeanConverter().update(session, objectNode, beanDescriptor, bean);
+						this.storeSimpleFields(session, bean, mapper.getClassDescriptorByClass(bean.getClass()), objectNode);
+					} else if (null != beanDescriptor.getConverter() && ! "".equals(beanDescriptor.getConverter())) {
+						String converterClassName =  beanDescriptor.getConverter();
+						Object[] param = {this};
+						BeanConverter beanConverter =(BeanConverter) ReflectionUtils.invokeConstructor(converterClassName,param);
+						beanConverter.update(session, objectNode, beanDescriptor, bean);
 					} else {
 						this.update(session, objectNode, jcrName, bean);
 					}
@@ -746,19 +806,13 @@
 	}
 
 	private ClassDescriptor getClassDescriptor(Class beanClass) {
-		ClassDescriptor classDescriptor = mapper.getClassDescriptor(beanClass);
+		ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(beanClass);
 		if (null == classDescriptor) {
 			throw new JcrMappingException("Class of type: " + beanClass.getName()
 					+ " is not JCR persistable. Maybe element 'class-descriptor' for this type in mapping file is missing");
 		}
 
-		// if(classDescriptor.isAbstract())
-		// {
-		// throw new PersistenceException("Cannot persist/retrieve abstract
-		// class " + beanClass.getName());
-		// }
-
 		return classDescriptor;
-	}
-
+	}	
+	
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ParentBeanConverterImpl.java Wed May 17 14:49:42 2006
@@ -25,57 +25,44 @@
 import org.apache.portals.graffito.jcr.exception.RepositoryException;
 import org.apache.portals.graffito.jcr.mapper.model.BeanDescriptor;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.BeanConverter;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
 
-public class ParentBeanConverterImpl implements BeanConverter {
+public class ParentBeanConverterImpl extends AbstractBeanConverterImpl  implements BeanConverter {
 
 	private final static Log log = LogFactory.getLog(ParentBeanConverterImpl.class);
 	
+	public ParentBeanConverterImpl(ObjectConverter objectConverter) 
+	{
+		super(objectConverter);	
+	}
+
 	public void insert(Session session, Node parentNode, BeanDescriptor descriptor, Object object)
 			throws PersistenceException, RepositoryException, 	JcrMappingException {
-                  try {
-					log.debug("Reference Converter - path : " +parentNode.getPath());
-					log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
-					
-				} catch (javax.jcr.RepositoryException e) {
-					throw new RepositoryException(e);
-				} 
 	}
 
 	public void update(Session session, Node parentNode, 	BeanDescriptor descriptor, Object object)
 			throws PersistenceException, RepositoryException,	JcrMappingException {
-        try {
-			log.debug("Reference Converter - path : " +parentNode.getPath());
-			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
-			
-		} catch (javax.jcr.RepositoryException e) {
-			throw new RepositoryException(e);
-		} 
-
-
 	}
 
 	public Object getObject(Session session, Node parentNode,BeanDescriptor descriptor, Class beanClass)
 			throws PersistenceException, RepositoryException,JcrMappingException {
         try {
-			log.debug("Reference Converter - path : " +parentNode.getPath());
-			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
+			log.debug("ParentBeanConverter  - path : " +parentNode.getPath());
+			Node grandParentNode = parentNode.getParent();
+			if (grandParentNode.getPath().equals("/"))
+			{
+				return null;
+			}
+			return objectConverter.getObject(session, grandParentNode.getPath());
 			
 		} catch (javax.jcr.RepositoryException e) {
 			throw new RepositoryException(e);
 		} 
-		return null;
+		
 	}
 
 	public void remove(Session session, Node parentNode,	BeanDescriptor descriptor)
 	          throws PersistenceException,	RepositoryException, JcrMappingException {
-        try {
-			log.debug("Reference Converter - path : " +parentNode.getPath());
-			log.debug("Reference Converter - descriptor : " + descriptor.getFieldName() + "-" + descriptor.getJcrName());
-			
-		} catch (javax.jcr.RepositoryException e) {
-			throw new RepositoryException(e);
-		} 
-
 
 	}
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryImpl.java Wed May 17 14:49:42 2006
@@ -49,7 +49,7 @@
 	public QueryImpl(Filter filter, Mapper mapper) 
 	{				
 		this.filter = filter;
-		classDescriptor = mapper.getClassDescriptor(filter.getFilterClass());
+		classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
 	}
 
 	/**

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java Wed May 17 14:49:42 2006
@@ -39,7 +39,7 @@
     }
 
     public Filter createFilter(Class classQuery) {
-        return new FilterImpl(mapper.getClassDescriptor(classQuery),
+        return new FilterImpl(mapper.getClassDescriptorByClass(classQuery),
                               atomicTypeConverters,
                               classQuery);
     }
@@ -53,7 +53,7 @@
         Filter filter = query.getFilter();
 
         // Check if the class has  an inheritance discriminator field
-        ClassDescriptor classDescriptor = mapper.getClassDescriptor(filter.getFilterClass());
+        ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
         if (classDescriptor.hasDiscriminator()) {
             Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor);
             filter = filter.addAndFilter(discrininatorFilter);
@@ -110,7 +110,7 @@
     }
 
     private String getNodeType(Filter filter) {
-        ClassDescriptor classDescriptor = mapper.getClassDescriptor(filter.getFilterClass());
+        ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
 
         String jcrNodeType = classDescriptor.getJcrNodeType();
         if (jcrNodeType == null || jcrNodeType.equals(""))

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java Wed May 17 14:49:42 2006
@@ -22,7 +22,6 @@
 import org.apache.commons.beanutils.ConstructorUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
-import org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter;
 
 
 /**
@@ -83,17 +82,14 @@
      * @param objects
      * @return
      */
-    public static CollectionConverter invokeConstructor(String className, 
-                                                        Object[] params) {
+    public static Object  invokeConstructor(String className,  Object[] params) {
         try {
             Class converterClass= Class.forName(className);
     
-            return (CollectionConverter) ConstructorUtils.invokeConstructor(converterClass, params);
+            return  ConstructorUtils.invokeConstructor(converterClass, params);
         }
         catch(Exception ex) {
-            throw new JcrMappingException("Cannot create instance for class "
-                    + className,
-                    ex);
+            throw new JcrMappingException("Cannot create instance for class "  + className,  ex);
         }
     }
 
@@ -121,9 +117,7 @@
             return Class.forName(clazz).newInstance();
         }
         catch(Exception ex) {
-            throw new JcrMappingException("Cannot create instance for class "
-                    + clazz,
-                    ex);
+            throw new JcrMappingException("Cannot create instance for class "  + clazz, ex);
         }
     }
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml Wed May 17 14:49:42 2006
@@ -3,7 +3,7 @@
 <!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
 <graffito-jcr>
     <class-descriptor
-		className="org.apache.portals.graffito.jcr.testmodel.Atomic" jcrNodeType="nt:unstructured" discriminator="false" >
+		className="org.apache.portals.graffito.jcr.testmodel.Atomic" jcrNodeType="nt:unstructured" discriminator="true" >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="string" jcrName="string" />
 		<field-descriptor fieldName="booleanObject" jcrName="booleanObject" />
@@ -20,7 +20,7 @@
 	</class-descriptor>
 
     <class-descriptor
-		className="org.apache.portals.graffito.jcr.testmodel.MultiValue" jcrNodeType="nt:unstructured" discriminator="false" >
+		className="org.apache.portals.graffito.jcr.testmodel.MultiValue" jcrNodeType="nt:unstructured" discriminator="true" >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="name" jcrName="name" />
 		<collection-descriptor fieldName="multiValues" jcrName="multiValue" proxy="false" 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-inheritance.xml Wed May 17 14:49:42 2006
@@ -57,13 +57,13 @@
 		
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="name" jcrName="graffito:name" id="true" />
-		<!--  bean-descriptor  fieldName="parentFolder" 						 
-						  converter="org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ParentBeanConverterImpl" / -->
+		<bean-descriptor  fieldName="parentFolder" 						 
+						  converter="org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ParentBeanConverterImpl" />
 
 	</class-descriptor>     
 
 	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.FolderImpl" jcrNodeType="graffito:folderimpl" 
-	                                    extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl" >
+	                                    extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl" discriminator="false"  >
 		<implement-descriptor interfaceName="org.apache.portals.graffito.jcr.testmodel.interfaces.Folder" />	  		                                    
 		<collection-descriptor fieldName="children" proxy="true" 
 		                       elementClassName="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl" 
@@ -71,19 +71,19 @@
 	</class-descriptor >	
 
 	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.ContentImpl" jcrNodeType="graffito:contentimpl" abstract="true"
-	                                   extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl" >
+	                                   extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.CmsObjectImpl" discriminator="false"  >
        		<implement-descriptor interfaceName="org.apache.portals.graffito.jcr.testmodel.interfaces.Content" />	  		                                    
 	</class-descriptor>	
 		
 	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentImpl" jcrNodeType="graffito:documentimpl" 
-	                                    extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.ContentImpl" >
+	                                    extend="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.ContentImpl" discriminator="false" >
 		<implement-descriptor interfaceName="org.apache.portals.graffito.jcr.testmodel.interfaces.Document" />	  		                                    	                                    
 		<field-descriptor fieldName="contentType" jcrName="graffito:contenttype" />  
 		<field-descriptor fieldName="size" jcrName="graffito:size" />  	
 		<bean-descriptor fieldName="documentStream" jcrName="graffito:documentstream" proxy="true"  />			
 	</class-descriptor >	
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream" jcrNodeType="graffito:documentstream"  >
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.inheritance.impl.DocumentStream" jcrNodeType="graffito:documentstream"  discriminator="false"  >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="encoding" jcrName="graffito:encoding" />
 		<field-descriptor fieldName="content" jcrName="graffito:binarycontent" />

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml Wed May 17 14:49:42 2006
@@ -61,14 +61,14 @@
 
 	</class-descriptor>
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C">
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C" discriminator="false">
 		<!-- Field-descriptor is used to map simple attributes to jcr property -->
 		<field-descriptor fieldName="id" jcrName="graffito:id" 	id="true" />
 		<field-descriptor fieldName="name" jcrName="graffito:name" />
 	</class-descriptor>
 
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrNodeType="graffito:page">
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrNodeType="graffito:page" discriminator="false">
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="title" jcrName="graffito:title" />
 		<collection-descriptor fieldName="paragraphs" proxy="false" 
@@ -76,7 +76,7 @@
 		                       collectionConverter="org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl" />
 	</class-descriptor>
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrNodeType="graffito:paragraph">
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrNodeType="graffito:paragraph" discriminator="false">
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="text" jcrName="graffito:text"/>
 	</class-descriptor>
@@ -92,7 +92,7 @@
 		                       
 	</class-descriptor>
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Element" jcrNodeType="graffito:element">
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Element" jcrNodeType="graffito:element" discriminator="false">
 		<field-descriptor fieldName="id" jcrName="graffito:id"  />
 		<field-descriptor fieldName="text" jcrName="graffito:text" />
 	</class-descriptor>

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping.xml?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping.xml Wed May 17 14:49:42 2006
@@ -74,7 +74,7 @@
 	</class-descriptor>
 
 
-	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Main" jcrNodeType="nt:unstructured" discriminator="false" >
+	<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Main" jcrNodeType="nt:unstructured"  >
 		<field-descriptor fieldName="path" path="true" />
 		<field-descriptor fieldName="text" jcrName="text" />
 		<collection-descriptor fieldName="elements"  proxy="false" 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java Wed May 17 14:49:42 2006
@@ -30,6 +30,7 @@
 import org.apache.portals.graffito.jcr.mapper.model.FieldDescriptor;
 import org.apache.portals.graffito.jcr.testmodel.A;
 import org.apache.portals.graffito.jcr.testmodel.B;
+import org.apache.portals.graffito.jcr.testmodel.C;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.Ancestor;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.AnotherDescendant;
 import org.apache.portals.graffito.jcr.testmodel.inheritance.Descendant;
@@ -72,7 +73,7 @@
 					.buildMapper();
 			assertNotNull("Mapper is null", mapper);
 
-			ClassDescriptor classDescriptor = mapper.getClassDescriptor(A.class);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(A.class);
 			assertNotNull("ClassDescriptor is null", classDescriptor);
 			assertTrue("Invalid classname", classDescriptor.getClassName().equals(A.class.getName()));
 			assertTrue("Invalid path field", classDescriptor.getPathFieldDescriptor().getFieldName().equals("path"));
@@ -87,7 +88,7 @@
 			assertTrue("Invalid jcrName for field b", beanDescriptor	.getJcrName().equals("b"));
 			assertEquals("Invalid bean-descriptor inline", true, beanDescriptor.isInline());
 			assertNull("Invalid bean default converter", beanDescriptor.getConverter());
-			assertNull("Invalid bean converter", beanDescriptor	.getBeanConverter());
+			
 
 			CollectionDescriptor collectionDescriptor = classDescriptor.getCollectionDescriptor("collection");
 			assertNotNull("CollectionDescriptor is null", collectionDescriptor);
@@ -99,6 +100,26 @@
 	}
 
 	/**
+	 * Simple test mapper
+	 *
+	 */
+	public void testDiscriminatorSetting() {
+		try {
+
+			Mapper mapper = new DigesterMapperImpl("./src/test-config/jcrmapping-testmappings.xml").buildMapper();
+			assertNotNull("Mapper is null", mapper);
+
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByNodeType("graffito:C");
+			//ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(C.class);
+			assertNotNull("ClassDescriptor is null", classDescriptor);
+			assertTrue("Invalid classname", classDescriptor.getClassName().equals(C.class.getName()));			
+		} catch (JcrMappingException e) {
+			e.printStackTrace();
+			fail("Impossible to retrieve the converter " + e);
+		}
+	}
+
+	/**
 	 * Test optional mapping properties
 	 *
 	 */
@@ -109,7 +130,7 @@
 			assertNotNull("Mapper is null", mapper);
 
 			ClassDescriptor classDescriptor = mapper
-					.getClassDescriptor(B.class);
+					.getClassDescriptorByClass(B.class);
 			assertNotNull("ClassDescriptor is null", classDescriptor);
 			assertTrue("Invalid classname", classDescriptor.getClassName()
 					.equals(B.class.getName()));
@@ -136,7 +157,7 @@
 			assertEquals(b2Field.getJcrOnParentVersion(), "IGNORE");
 
 			ClassDescriptor classDescriptor2 = mapper
-					.getClassDescriptor(A.class);
+					.getClassDescriptorByClass(A.class);
 			assertNotNull("ClassDescriptor is null", classDescriptor2);
 			assertTrue("Invalid classname", classDescriptor2.getClassName()
 					.equals(A.class.getName()));
@@ -183,7 +204,7 @@
 			assertNotNull("Mapper is null", mapper);
 
 			ClassDescriptor classDescriptor = mapper
-					.getClassDescriptor(Ancestor.class);
+					.getClassDescriptorByClass(Ancestor.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertEquals("Incorrect path field", classDescriptor
 					.getPathFieldDescriptor().getFieldName(), "path");
@@ -205,7 +226,7 @@
 			assertEquals("Invalid number of descendants", descendandDescriptors
 					.size(), 2);
 
-			classDescriptor = mapper.getClassDescriptor(Descendant.class);
+			classDescriptor = mapper.getClassDescriptorByClass(Descendant.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertEquals("Incorrect path field", classDescriptor
 					.getPathFieldDescriptor().getFieldName(), "path");
@@ -231,7 +252,7 @@
 					"Descendant class  have a node type per hierarchy strategy",
 					classDescriptor.usesNodeTypePerConcreteClassStrategy());
 
-			classDescriptor = mapper.getClassDescriptor(SubDescendant.class);
+			classDescriptor = mapper.getClassDescriptorByClass(SubDescendant.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertEquals("Incorrect path field", classDescriptor
 					.getPathFieldDescriptor().getFieldName(), "path");
@@ -279,7 +300,7 @@
 
 			assertNotNull("Mapper is null", mapper);
 
-			ClassDescriptor classDescriptor = mapper.getClassDescriptor(CmsObjectImpl.class);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(CmsObjectImpl.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertEquals("Incorrect path field", classDescriptor
 					.getPathFieldDescriptor().getFieldName(), "path");
@@ -300,7 +321,7 @@
 			assertEquals("Invalid number of descendants", classDescriptor
 					.getDescendantClassDescriptors().size(), 2);
 
-			classDescriptor = mapper.getClassDescriptor(DocumentImpl.class);
+			classDescriptor = mapper.getClassDescriptorByClass(DocumentImpl.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertEquals("Incorrect path field", classDescriptor
 					.getPathFieldDescriptor().getFieldName(), "path");
@@ -339,7 +360,7 @@
 			Mapper mapper = new DigesterMapperImpl(files).buildMapper();
 
 			assertNotNull("Mapper is null", mapper);
-			ClassDescriptor classDescriptor = mapper.getClassDescriptor(Interface.class);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(Interface.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertTrue("Interface is not an interface", classDescriptor.isInterface());
 			assertTrue("Interface  has not a discriminator", classDescriptor.hasDiscriminator());
@@ -353,7 +374,7 @@
 			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerHierarchyStrategy());
 			assertFalse("Incalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
 			
-			classDescriptor = mapper.getClassDescriptor(AnotherDescendant.class);
+			classDescriptor = mapper.getClassDescriptorByClass(AnotherDescendant.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertFalse("Interface is  an interface", classDescriptor.isInterface());
 			assertTrue("AnotherDescendant  has not a discriminator", classDescriptor.hasDiscriminator());
@@ -379,7 +400,7 @@
 			Mapper mapper = new DigesterMapperImpl(files).buildMapper();
 
 			assertNotNull("Mapper is null", mapper);
-			ClassDescriptor classDescriptor = mapper.getClassDescriptor(CmsObject.class);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(CmsObject.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertTrue("CmsObject is not an interface", classDescriptor.isInterface());
 			assertFalse("Interface  has a discriminator", classDescriptor.hasDiscriminator());
@@ -393,7 +414,7 @@
 			assertTrue("Invalid extend strategy", classDescriptor.usesNodeTypePerConcreteClassStrategy());
 			
 			
-			classDescriptor = mapper.getClassDescriptor(Document.class);
+			classDescriptor = mapper.getClassDescriptorByClass(Document.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertTrue("Document is not  an interface", classDescriptor.isInterface());
 			assertFalse("Document  has a discriminator", classDescriptor.hasDiscriminator());
@@ -404,7 +425,7 @@
 			assertEquals("Invalid number of implementation/descendants", descendants.size(),1);
 		
 
-			classDescriptor = mapper.getClassDescriptor(DocumentImpl.class);
+			classDescriptor = mapper.getClassDescriptorByClass(DocumentImpl.class);
 			assertNotNull("Classdescriptor is null", classDescriptor);
 			assertFalse("DocumentImpl is  an interface", classDescriptor.isInterface());
 			assertFalse("DocumentImpl  has a discriminator", classDescriptor.hasDiscriminator());
@@ -432,7 +453,7 @@
 
 			assertNotNull("Mapper is null", mapper);
 
-			ClassDescriptor classDescriptor = mapper.getClassDescriptor(Main.class);
+			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(Main.class);
 			assertNotNull("ClassDescriptor is null", classDescriptor);
 			assertTrue("Invalid proxy setting for bean field proxyDetail ", classDescriptor.getBeanDescriptor("proxyDetail").isProxy());
 			assertFalse("Invalid proxy setting for bean field detail  ", classDescriptor.getBeanDescriptor("detail").isProxy());

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/AtomicTest.java Wed May 17 14:49:42 2006
@@ -108,7 +108,7 @@
             // Get the object
             // --------------------------------------------------------------------------------
             a = null;
-            a = (Atomic) persistenceManager.getObject(Atomic.class, "/test");
+            a = (Atomic) persistenceManager.getObject( "/test");
             assertNotNull("a is null", a);
             assertNotNull("Boolean object is null", a.getBooleanObject());
             assertTrue("Incorrect boolean object", a.getBooleanObject().booleanValue());

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomicconverter/NullAtomicTest.java Wed May 17 14:49:42 2006
@@ -99,7 +99,7 @@
             // Get the object
             // --------------------------------------------------------------------------------
             a = null;
-            a = (Atomic) persistenceManager.getObject(Atomic.class, "/test");
+            a = (Atomic) persistenceManager.getObject( "/test");
             assertNotNull("a is null", a);
             assertNull("Boolean object is not null", a.getBooleanObject());
             

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/DefaultCollectionConverterImplTest.java Wed May 17 14:49:42 2006
@@ -105,7 +105,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            a = (A) persistenceManager.getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject( "/test");
             assertNotNull("a.collection is null", a.getCollection());
             assertEquals("Incorrect a.collection size", 3, a.getCollection().size());
             assertTrue("Incorrect a.collection", ((C) a.getCollection().iterator().next()).getId().equals("first"));
@@ -132,7 +132,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            a = (A) persistenceManager.getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject( "/test");
             assertNotNull("a is null", a);
             assertNotNull("a.collection is null", a.getCollection());
             assertTrue("Incorrect collection size", a.getCollection().size() == 2);
@@ -189,7 +189,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            a = (A) persistenceManager.getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject( "/test");
             assertNotNull("a.collection is null", a.getCollection());
             assertEquals("Incorrect a.collection size", 3, a.getCollection().size());
             assertEquals("Incorrect a.collection", "first", ((C) a.getCollection().iterator().next()).getId());
@@ -214,7 +214,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            a = (A) persistenceManager.getObject(A.class, "/test");
+            a = (A) persistenceManager.getObject( "/test");
             assertNotNull("a is null", a);
             assertNotNull("a.collection is null", a.getCollection());
             assertEquals("Incorrect collection size", 4, a.getCollection().size());

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/HashMapTest.java Wed May 17 14:49:42 2006
@@ -101,7 +101,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            main = (Main) persistenceManager.getObject(Main.class, "/test");
+            main = (Main) persistenceManager.getObject( "/test");
             assertNotNull("main.getElements() is null", main.getElements());
             assertTrue("Incorrect text", main.getText().equals("Main text"));           
             assertTrue("Incorrect para element", ((Element) main.getElements().get("e1")).getText().equals("Element 1"));

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImplTest.java Wed May 17 14:49:42 2006
@@ -98,7 +98,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            multiValue = (MultiValue) persistenceManager.getObject(MultiValue.class, "/test");
+            multiValue = (MultiValue) persistenceManager.getObject( "/test");
             assertNotNull("Object is null", multiValue);
             assertNull("nullMultiValues field is not null", multiValue.getNullMultiValues());
             assertTrue("Incorrect number of values", multiValue.getMultiValues().size() == 4);            
@@ -122,7 +122,7 @@
             // Get the object
             // --------------------------------------------------------------------------------           
 
-            multiValue = (MultiValue) persistenceManager.getObject(MultiValue.class, "/test");
+            multiValue = (MultiValue) persistenceManager.getObject( "/test");
             assertNotNull("Object is null", multiValue);
             assertNull("nullMultiValues field is not null", multiValue.getNullMultiValues());
             assertTrue("Incorrect number of values", multiValue.getMultiValues().size() == 5);            

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/NTCollectionConverterImplTest.java Wed May 17 14:49:42 2006
@@ -99,7 +99,7 @@
             // --------------------------------------------------------------------------------
             // Get the object
             // --------------------------------------------------------------------------------           
-            page = (Page) persistenceManager.getObject(Page.class, "/test");
+            page = (Page) persistenceManager.getObject( "/test");
             assertNotNull("page.getParagraphs is null", page.getParagraphs());
             assertTrue("Incorrect page title", page.getTitle().equals("Page Title"));
             assertTrue("Incorrect page.getParagraphs size", page.getParagraphs().size() == 3);
@@ -123,7 +123,7 @@
             // Get the object
             // --------------------------------------------------------------------------------           
 
-            page = (Page) persistenceManager.getObject(Page.class, "/test");
+            page = (Page) persistenceManager.getObject( "/test");
             assertNotNull("page.getParagraphs is null", page.getParagraphs());
             assertTrue("Incorrect page title", page.getTitle().equals("Page Title"));
             assertTrue("Incorrect page.getParagraphs size", page.getParagraphs().size() == 4);

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/AllTests.java Wed May 17 14:49:42 2006
@@ -41,6 +41,7 @@
         suite.addTestSuite(PersistenceManagerInheritanceConcreteClassTest.class);
         suite.addTestSuite(PersistenceManagerInheritanceHierarchyTest.class);
         suite.addTestSuite(PersistenceManagerInterfaceConcreteClassTest.class);
+        suite.addTestSuite(PersistenceManagerQueryInheritanceConcreteClassTest.class);
         suite.addTestSuite(PersistenceManagerInterfaceHierarchyTest.class);        
         suite.addTestSuite(PersistenceManagerIteratorQueryTest.class);
         suite.addTestSuite(PersistenceManagerMultiValueQueryTest.class);       

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerBasicVersionningTest.java Wed May 17 14:49:42 2006
@@ -97,8 +97,14 @@
             	 System.out.println("Root version : " + rootVersion.getName());
             	 //this.exportDocument("/home/christophe/export.xml", "/jcr:system/jcr:versionStorage", true, false);
             	             	
+             //Get the lasted version 
+            	 page = (Page) persistenceManager.getObject( "/page");
+            	 assertNotNull("Last version is nulll", page);
+            	 assertTrue("Invalid number of paragraph found in the last  version", page.getParagraphs().size() == 4);
+
+            	 
             	 //Get the object matching to the first version 
-            	 Page page1 = (Page) persistenceManager.getObject(Page.class, "/page", "1.0");
+            Page  page1 = (Page) persistenceManager.getObject( "/page", "1.0");
             	 assertNotNull("version 1.0 object is null", page1);
             	 assertTrue("Invalid number of paragraph found in the root version", page1.getParagraphs().size() == 3);
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceConcreteClassTest.java Wed May 17 14:49:42 2006
@@ -92,7 +92,7 @@
 			// Retrieve a document object
 			//---------------------------------------------------------------------------------------------------------						
 
-			document = (DocumentImpl) persistenceManager.getObject(DocumentImpl.class, "/document1");
+			document = (DocumentImpl) persistenceManager.getObject( "/document1");
 			assertEquals("Document path is invalid", document.getPath(), "/document1");
 			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
 			assertNotNull("document stream is null", document.getDocumentStream());
@@ -109,14 +109,14 @@
 			//---------------------------------------------------------------------------------------------------------
 			// Retrieve the updated descendant object
 			//---------------------------------------------------------------------------------------------------------						
-			document = (DocumentImpl) persistenceManager.getObject(DocumentImpl.class, "/document1");
+			document = (DocumentImpl) persistenceManager.getObject( "/document1");
 			assertEquals("document name is incorrect", document.getName(), "anotherName");
 			assertEquals("Document path is invalid", document.getPath(), "/document1");
 			assertEquals("Content type  is invalid", document.getContentType(), "plain/text");
 			assertNotNull("document stream is null", document.getDocumentStream());
 			assertTrue("Invalid document stream", document.getDocumentStream().getEncoding().equals("utf-8"));
 
-			CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject(CmsObjectImpl.class, "/document1");
+			CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject( "/document1");
 			assertEquals("cmsObject name is incorrect", cmsObject.getName(), "anotherName");
 			assertEquals("cmsObject path is invalid", cmsObject.getPath(), "/document1");
            			
@@ -228,14 +228,14 @@
 		//---------------------------------------------------------------------------------------------------------	
 		// Retrieve folder2 
 		//---------------------------------------------------------------------------------------------------------	
-		FolderImpl folder2 = (FolderImpl) persistenceManager.getObject(FolderImpl.class, "/folder2");
+		FolderImpl folder2 = (FolderImpl) persistenceManager.getObject( "/folder2");
 		assertNotNull("folder 2 is null", folder2);
 		assertEquals("Invalid number of cms object  found in folder2 children", folder2.getChildren().size() ,2);
 		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/document4", DocumentImpl.class));
 		assertTrue("Invalid item in the collection", this.contains(folder2.getChildren(), "/folder2/subfolder", FolderImpl.class));
 		
 		
-		CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject(CmsObjectImpl.class, "/folder2");
+		CmsObjectImpl cmsObject = (CmsObjectImpl) persistenceManager.getObject( "/folder2");
 		assertNotNull("folder 2 is null", cmsObject);
 		assertTrue("Invalid instance for folder 2",  cmsObject instanceof FolderImpl);
 		assertEquals("Invalid number of documents  found in folder2 children",  folder2.getChildren().size(),2);
@@ -327,7 +327,7 @@
 		//---------------------------------------------------------------------------------------------------------	
 		// Retrieve Folder
 		//---------------------------------------------------------------------------------------------------------			
-		folder  = (FolderImpl) persistenceManager.getObject(FolderImpl.class,"/mainfolder");
+		folder  = (FolderImpl) persistenceManager.getObject("/mainfolder");
 		assertNotNull("Folder is null",folder);		
 		Collection children = folder.getChildren();
 		assertEquals("Invalid number of children", children.size(), 200);

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java?rev=407383&r1=407382&r2=407383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerInheritanceHierarchyTest.java Wed May 17 14:49:42 2006
@@ -85,7 +85,7 @@
 			// Retrieve a descendant object
 			//---------------------------------------------------------------------------------------------------------						
 			descendant = null;
-			descendant = (Descendant) persistenceManager.getObject(	Descendant.class, "/test");
+			descendant = (Descendant) persistenceManager.getObject(	 "/test");
 			assertEquals("Descendant path is invalid", descendant.getPath(), "/test");
 			assertEquals("Descendant ancestorField is invalid", descendant.getAncestorField(), "ancestorValue");
 			assertEquals("Descendant descendantField is invalid", descendant	.getDescendantField(), "descendantValue");
@@ -101,14 +101,12 @@
 			// Retrieve the updated descendant object
 			//---------------------------------------------------------------------------------------------------------						
 			descendant = null;
-			descendant = (Descendant) persistenceManager.getObject(	Descendant.class, "/test");
+			descendant = (Descendant) persistenceManager.getObject(	 "/test");
 			assertEquals("Descendant path is invalid", descendant.getPath(), "/test");
 			assertEquals("Descendant ancestorField is invalid", descendant.getAncestorField(), "anotherAncestorValue");
 			assertEquals("Descendant descendantField is invalid", descendant	.getDescendantField(), "descendantValue");
 
-
-
-			Ancestor ancestor = (Ancestor) persistenceManager.getObject(Ancestor.class,"/test");
+			Ancestor ancestor = (Ancestor) persistenceManager.getObject("/test");
 			assertTrue("Invalid object instance", ancestor instanceof Descendant );
 			assertEquals("Ancestor  path is invalid", ancestor.getPath(), "/test");
 			assertEquals("Ancestor ancestorField is invalid", ancestor.getAncestorField(), "anotherAncestorValue");



Mime
View raw message