jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1343674 - in /jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager: impl/ObjectContentManagerImpl.java objectconverter/impl/ObjectConverterImpl.java
Date Tue, 29 May 2012 11:33:56 GMT
Author: ard
Date: Tue May 29 11:33:56 2012
New Revision: 1343674

URL: http://svn.apache.org/viewvc?rev=1343674&view=rev
Log:
OCM-51 replaced all getItem logic where needed by getNode logic. Removed all javadocs that
did not add any value. Removed unused variables, and unused parameters for private methods

Modified:
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java?rev=1343674&r1=1343673&r2=1343674&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
(original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
Tue May 29 11:33:56 2012
@@ -80,31 +80,17 @@ import org.apache.jackrabbit.ocm.version
  * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
 public class ObjectContentManagerImpl implements ObjectContentManager {
-    /**
-     * Logger.
-     */
+
     private final static Log log = LogFactory.getLog(ObjectContentManagerImpl.class);
 
-    /**
-     * JCR session.
-     */
     protected Session session;
 
     protected Mapper mapper;
 
-    /**
-     * The query manager
-     */
     protected QueryManager queryManager;
 
-    /**
-     * Object Converter
-     */
     protected ObjectConverter objectConverter;
 
-    /**
-     * Request Cache manager
-     */
     protected ObjectCache requestObjectCache;
 
     /**
@@ -257,7 +243,7 @@ public class ObjectContentManagerImpl im
      */
     public Object getObject(String path) {
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 return null;
             }
         } catch (RepositoryException e) {
@@ -271,15 +257,13 @@ public class ObjectContentManagerImpl im
     }
 
     /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObject(java.lang.Class,
-     *      java.lang.String)
+     * @param uuid the <code>uuid</code> of the backing jcr node
+     * @return the Object for <code>uuid</code>
      * @throws org.apache.jackrabbit.ocm.exception.RepositoryException
-     *             if the underlying repository has thrown a
-     *             javax.jcr.RepositoryException
-     * @throws JcrMappingException
-     *             if the mapping for the class is not correct
-     * @throws ObjectContentManagerException
-     *             if the object cannot be retrieved from the path
+     *                                       if the underlying repository has thrown a javax.jcr.RepositoryException
+     * @throws JcrMappingException           if the mapping for the class is not correct
+     * @throws ObjectContentManagerException if the object cannot be retrieved from the path
+     * @throws IllegalArgumentException      when the <code>uuid</code> is <code>null</code>
or not a valid UUID
      */
     public Object getObjectByUuid(String uuid) {
 
@@ -296,13 +280,23 @@ public class ObjectContentManagerImpl im
     }
 
     /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObject(java.lang.Class,
-     *      java.lang.String, java.lang.String)
+     *
+     * @param path the object's absolute jcr path
+     * @param versionName the version that needs to be fetched
+     * @return the Object for <code>path</code> and version <code>versionName</code>
or <code>null</code> if there is no jcr node for the specified
+     * path and versionName
+     * @throws org.apache.jackrabbit.ocm.exception.RepositoryException
+     *             if the underlying repository has thrown a
+     *             javax.jcr.RepositoryException
+     * @throws JcrMappingException
+     *             if the mapping for the class is not correct
+     * @throws ObjectContentManagerException
+     *             if the object cannot be retrieved from the path and versionName
      */
     public Object getObject(String path, String versionName) {
-        String pathVersion = null;
+        String pathVersion;
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 return null;
             }
 
@@ -319,8 +313,10 @@ public class ObjectContentManagerImpl im
     }
 
     /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObject(java.lang.Class,
-     *      java.lang.String)
+     *
+     * @param objectClass  the object mapping class
+     * @param path the object's absolute jcr  path
+     * @return the Object for <code>path</code> pr <code>null</code>
if there is no jcr node at <code>path</code>
      * @throws org.apache.jackrabbit.ocm.exception.RepositoryException
      *             if the underlying repository has thrown a
      *             javax.jcr.RepositoryException
@@ -331,7 +327,7 @@ public class ObjectContentManagerImpl im
      */
     public Object getObject(Class objectClass, String path) {
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 return null;
             }
         } catch (RepositoryException e) {
@@ -344,14 +340,10 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObject(java.lang.Class,
-     *      java.lang.String, java.lang.String)
-     */
     public Object getObject(Class objectClass, String path, String versionName) {
         String pathVersion = null;
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 return null;
             }
 
@@ -367,40 +359,25 @@ public class ObjectContentManagerImpl im
         return object;
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#retrieveAllMappedAttributes(Object)
-     */
     public void retrieveAllMappedAttributes(Object object) {
         objectConverter.retrieveAllMappedAttributes(session, object);
 
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#retrieveMappedAttribute(Object,
-     *      String)
-     */
     public void retrieveMappedAttribute(Object object, String attributeName) {
         objectConverter.retrieveMappedAttribute(session, object, attributeName);
 
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#insert(java.lang.Object)
-     */
     public void insert(Object object) {
         String path = objectConverter.getPath(session, object);
 
         try {
-            if (session.itemExists(path)) {
-                Item item = session.getItem(path);
-                if (item.isNode()) {
-                    if (!((Node) item).getDefinition().allowsSameNameSiblings()) {
-                        throw new ObjectContentManagerException("Path already exists and
it is not supporting the same name sibling : " + path);
-                    }
-                } else {
-                    throw new ObjectContentManagerException("Path already exists and it is
a property : " + path);
+            if (session.nodeExists(path)) {
+                Node node = session.getNode(path);
+                if (!node.getDefinition().allowsSameNameSiblings()) {
+                    throw new ObjectContentManagerException("Path already exists and it is
not supporting the same name sibling : " + path);
                 }
-
             }
         } catch (RepositoryException e) {
             throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible
to insert the object at " + path, e);
@@ -409,13 +386,10 @@ public class ObjectContentManagerImpl im
         objectConverter.insert(session, object);
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#update(java.lang.Object)
-     */
     public void update(Object object) {
         String path = objectConverter.getPath(session, object);
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 throw new ObjectContentManagerException("Path is not existing : " + path);
             } else {
                 checkIfNodeLocked(path);
@@ -427,13 +401,9 @@ public class ObjectContentManagerImpl im
         objectConverter.update(session, object);
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#remove(java.lang.String)
-     */
     public void remove(String path) {
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 throw new ObjectContentManagerException("Path does not exist : " + path);
             } else {
                 checkIfNodeLocked(path);
@@ -447,18 +417,10 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#remove(java.lang.Object)
-     */
     public void remove(Object object) {
         this.remove(objectConverter.getPath(session, object));
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#remove(org.apache.jackrabbit.ocm.query.Query)
-     */
     public void remove(Query query) {
         try {
             String jcrExpression = this.queryManager.buildJCRExpression(query);
@@ -471,6 +433,10 @@ public class ObjectContentManagerImpl im
 
             while (nodeIterator.hasNext()) {
                 Node node = nodeIterator.nextNode();
+                if (node == null) {
+                    // node has been removed possibly by another thread during iterating
through the results
+                    continue;
+                }
                 log.debug("Remove node : " + node.getPath());
 
                 // it is not possible to remove nodes from an NodeIterator
@@ -497,29 +463,21 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#objectExists(java.lang.String)
-     */
     public boolean objectExists(String path) {
         try {
-            // TODO : Check also if it is an object
-            return session.itemExists(path);
+            return session.nodeExists(path);
         } catch (RepositoryException e) {
             throw new org.apache.jackrabbit.ocm.exception.RepositoryException("Impossible
to check if the object exist", e);
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#isPersistent(java.lang.Class)
-     */
     public boolean isPersistent(final Class clazz) {
 
         try {
             ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(clazz);
-            if (classDescriptor == null)
+            if (classDescriptor == null) {
             	return false;
+            }
             return true;
         } catch (IncorrectPersistentClassException e) {
             return false;
@@ -527,10 +485,6 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObject(org.apache.jackrabbit.ocm.query.Query)
-     */
     public Object getObject(Query query) {
         String jcrExpression = this.queryManager.buildJCRExpression(query);
         Collection result = getObjects(jcrExpression, javax.jcr.query.Query.XPATH);
@@ -542,10 +496,7 @@ public class ObjectContentManagerImpl im
         return result.isEmpty() ? null : result.iterator().next();
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObjects(org.apache.jackrabbit.ocm.query.Query)
-     */
+
     public Collection getObjects(Query query) {
         String jcrExpression = this.queryManager.buildJCRExpression(query);
         return getObjects(jcrExpression, javax.jcr.query.Query.XPATH);
@@ -562,7 +513,7 @@ public class ObjectContentManagerImpl im
      */
     public Collection getObjects(Class objectClass, String path) throws ObjectContentManagerException
{
         try {
-            if (!session.itemExists(path)) {
+            if (!session.nodeExists(path)) {
                 return null;
             }
         } catch (RepositoryException e) {
@@ -589,10 +540,6 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObjectIterator(org.apache.jackrabbit.ocm.query.Query)
-     */
     public Iterator getObjectIterator(Query query) {
         String jcrExpression = this.queryManager.buildJCRExpression(query);
         log.debug("Get Object with expression : " + jcrExpression);
@@ -602,11 +549,6 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getObjectIterator(String,
-     *      String)
-     */
     public Iterator getObjectIterator(String query, String language) {
         log.debug("Get Object with expression : " + query);
         NodeIterator nodeIterator = getNodeIterator(query, language);
@@ -652,19 +594,10 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#checkin(java.lang.String)
-     */
     public void checkin(String path) {
         this.checkin(path, null);
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#checkin(java.lang.String,
-     *      java.lang.String[])
-     */
     public void checkin(String path, String[] versionLabels) {
         try {
             Node node = (Node) session.getItem(path);
@@ -698,12 +631,8 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#checkout(java.lang.String)
-     */
     public void checkout(String path) {
-        Node node = null;
+        Node node;
         try {
             node = (Node) session.getItem(path);
             if (!node.isNodeType("mix:versionable")) {
@@ -725,11 +654,6 @@ public class ObjectContentManagerImpl im
 
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#addVersionLabel(java.lang.String,
-     *      java.lang.String, java.lang.String)
-     */
     public void addVersionLabel(String path, String versionName, String versionLabel) {
         try {
             Node node = (Node) session.getItem(path);
@@ -753,11 +677,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getVersion(java.lang.String,
-     *      java.lang.String)
-     */
     public Version getVersion(String path, String versionName) {
         try {
             Node node = (Node) session.getItem(path);
@@ -781,11 +700,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getVersionLabels(java.lang.String,
-     *      java.lang.String)
-     */
     public String[] getVersionLabels(String path, String versionName) {
         try {
             Node node = (Node) session.getItem(path);
@@ -810,12 +724,9 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getAllVersionLabels(java.lang.String)
-     */
     public String[] getAllVersionLabels(String path) {
         try {
-            Node node = (Node) session.getItem(path);
+            Node node = session.getNode(path);
             if (!node.isNodeType("mix:versionable")) {
                 throw new VersionException("The object " + path + "is not versionable");
             }
@@ -834,13 +745,9 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getAllVersions(java.lang.String)
-     */
     public VersionIterator getAllVersions(String path) {
         try {
-            Node node = (Node) session.getItem(path);
+            Node node = session.getNode(path);
             if (!node.isNodeType("mix:versionable")) {
                 throw new VersionException("The object " + path + "is not versionable");
             }
@@ -859,13 +766,9 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getRootVersion(java.lang.String)
-     */
     public Version getRootVersion(String path) {
         try {
-            Node node = (Node) session.getItem(path);
+            Node node = session.getNode(path);
             if (!node.isNodeType("mix:versionable")) {
                 throw new VersionException("The object " + path + "is not versionable");
             }
@@ -884,13 +787,9 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getBaseVersion(java.lang.String)
-     */
     public Version getBaseVersion(String path) {
         try {
-            Node node = (Node) session.getItem(path);
+            Node node = session.getNode(path);
             if (!node.isNodeType("mix:versionable")) {
                 throw new VersionException("The object " + path + "is not versionable");
             }
@@ -907,11 +806,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#lock(java.lang.String,
-     *      java.lang.Object, boolean, boolean)
-     */
     public Lock lock(final String absPath, final boolean isDeep, final boolean isSessionScoped)
throws LockedException {
         try {
 
@@ -919,7 +813,6 @@ public class ObjectContentManagerImpl im
             // and this operation cant be done (exception translation)
             checkIfNodeLocked(absPath);
 
-            Node node = getNode(absPath);
             javax.jcr.lock.Lock lock = getLockManager().lock(absPath, isDeep, isSessionScoped,
0L, session.getUserID());
 
             return new Lock(lock);
@@ -932,11 +825,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#unlock(java.lang.String,
-     *      java.lang.Object, java.lang.String)
-     */
     public void unlock(final String absPath, final String lockToken) throws IllegalUnlockException
{
         String lockOwner = null;
         try {
@@ -966,14 +854,9 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#isLocked(java.lang.String)
-     */
     public boolean isLocked(final String absPath) {
         try {
             final Node node = getNode(absPath);
-
             return node.isLocked();
         } catch (RepositoryException e) {
             // node.isLocked() RepositoryException if an error occurs.
@@ -981,9 +864,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#getQueryManager()
-     */
     public QueryManager getQueryManager() {
         return this.queryManager;
     }
@@ -1001,7 +881,7 @@ public class ObjectContentManagerImpl im
     protected void checkIfNodeLocked(final String absPath) throws RepositoryException, LockedException
{
         Node node = getNode(absPath);
 
-        // Node can hold nock or can be locked with precedencor
+        // Node can hold lock or can be locked with precedencor
         if (node.isLocked()) {
             javax.jcr.lock.Lock lock = getLockManager().getLock(absPath);
             String lockOwner = lock.getLockOwner();
@@ -1045,21 +925,12 @@ public class ObjectContentManagerImpl im
     }
 
     protected Node getNode(final String absPath) throws PathNotFoundException, RepositoryException
{
-        if (!getSession().itemExists(absPath)) {
+        if (!session.nodeExists(absPath)) {
             throw new ObjectContentManagerException("No object stored on path: " + absPath);
         }
-        Item item = getSession().getItem(absPath);
-        if (!item.isNode()) {
-            throw new ObjectContentManagerException("No object stored on path: " + absPath
+ " on absPath is item (leaf)");
-        }
-
-        return (Node) item;
+        return session.getNode(absPath);
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#logout()
-     */
     public void logout() {
         try {
             log.debug("Logout. Persisting current session changes.");
@@ -1077,10 +948,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#save()
-     */
     public void save() {
         try {
             this.session.save();
@@ -1095,9 +962,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     * @return The JCR Session
-     */
     public Session getSession() {
         return this.session;
     }
@@ -1110,11 +974,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#move(java.lang.String,
-     *      java.lang.String)
-     */
     public void move(String srcPath, String destPath) {
         try {
             session.move(srcPath, destPath);
@@ -1143,11 +1002,6 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    /**
-     *
-     * @see org.apache.jackrabbit.ocm.manager.ObjectContentManager#copy(java.lang.String,
-     *      java.lang.String)
-     */
     public void copy(String srcPath, String destPath) {
         Workspace workspace = session.getWorkspace();
         try {

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java?rev=1343674&r1=1343673&r2=1343674&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
(original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
Tue May 29 11:33:56 2012
@@ -83,9 +83,6 @@ public class ObjectConverterImpl impleme
 
 	private ObjectCache requestObjectCache;
 
-	/**
-	 * No-arg constructor.
-	 */
 	public ObjectConverterImpl() {
 	}
 
@@ -142,16 +139,12 @@ public class ObjectConverterImpl impleme
 		this.atomicTypeConverterProvider = converterProvider;
 	}
 
-	/**
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#insert(javax.jcr.Session,
-	 *      java.lang.Object)
-	 */
 	public void insert(Session session, Object object) {
 		String path = this.getPath(session, object);
 		try {
 			String parentPath = NodeUtil.getParentPath(path);
 			String nodeName = NodeUtil.getNodeName(path);
-			Node parentNode = (Node) session.getItem(parentPath);
+			Node parentNode = session.getNode(parentPath);
 			this.insert(session, parentNode, nodeName, object);
 
 		} catch (PathNotFoundException pnfe) {
@@ -162,11 +155,7 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-	/**
-	 *
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#insert(javax.jcr.Session,
-	 *      javax.jcr.Node, java.lang.String, java.lang.Object)
-	 */
+
 	public void insert(Session session, Node parentNode, String nodeName, Object object) {
 		ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());
 
@@ -175,10 +164,9 @@ public class ObjectConverterImpl impleme
 			jcrType = ManagerConstant.NT_UNSTRUCTURED;
 		}
 
-		Node objectNode = null;
+		Node objectNode;
 		try {
 			objectNode = parentNode.addNode(nodeName, jcrType);
-
 		} catch (NoSuchNodeTypeException nsnte) {
 			throw new JcrMappingException("Unknown node type " + jcrType + " for mapped class " +
object.getClass(), nsnte);
 		} catch (RepositoryException re) {
@@ -249,16 +237,12 @@ public class ObjectConverterImpl impleme
 
 	}
 
-	/**
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session,
-	 *      java.lang.Object)
-	 */
 	public void update(Session session, Object object) {
 		String path = this.getPath(session, object);
 		try {
 			String parentPath = NodeUtil.getParentPath(path);
 			String nodeName = NodeUtil.getNodeName(path);
-			Node parentNode = (Node) session.getItem(parentPath);
+			Node parentNode = session.getNode(parentPath);
 			this.update(session, parentNode, nodeName, object);
 		} catch (PathNotFoundException pnfe) {
 			throw new ObjectContentManagerException("Impossible to update the object at '" + path
+ "'", pnfe);
@@ -268,11 +252,6 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-	/**
-	 *
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session,
-	 *      javax.jcr.Node, java.lang.String, java.lang.Object)
-	 */
 	public void update(Session session, String uuId, Object object) {
 		try {
 			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object));
@@ -285,11 +264,6 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-	/**
-	 *
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session,
-	 *      javax.jcr.Node, java.lang.Object)
-	 */
 	public void update(Session session, Node objectNode, Object object) {
 			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object));
 
@@ -302,13 +276,7 @@ public class ObjectConverterImpl impleme
 			updateCollectionFields(session, object, classDescriptor, objectNode);
 			simpleFieldsHelp.refreshUuidPath(session, classDescriptor, objectNode, object);
 	}
-	
 
-	/**
-	 *
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#update(javax.jcr.Session,
-	 *      javax.jcr.Node, java.lang.String, java.lang.Object)
-	 */
 	public void update(Session session, Node parentNode, String nodeName, Object object) {
 		try {
 			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object));
@@ -351,14 +319,10 @@ public class ObjectConverterImpl impleme
 		return parentNode.getNode(nodeName);
 		
 	}
-	
-	/**
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#getObject(javax.jcr.Session,
-	 *      java.lang.Class, java.lang.String)
-	 */
+
 	public Object getObject(Session session, String path) {
 		try {
-			if (!session.itemExists(path)) {
+			if (!session.nodeExists(path)) {
 				return null;
 			}
 
@@ -367,8 +331,8 @@ public class ObjectConverterImpl impleme
 		        return requestObjectCache.getObject(path);
 		    }
 
-			ClassDescriptor classDescriptor = null;
-			Node node = (Node) session.getItem(path);
+			ClassDescriptor classDescriptor;
+			Node node = session.getNode(path);
 			if (node.hasProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY)) {
 				String className = node.getProperty(ManagerConstant.DISCRIMINATOR_CLASS_NAME_PROPERTY).getValue().getString();
 				classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.forName(className));
@@ -393,7 +357,7 @@ public class ObjectConverterImpl impleme
             }
 
 			simpleFieldsHelp.retrieveSimpleFields(session, classDescriptor, node, object);
-			retrieveBeanFields(session, classDescriptor, node, path, object, false);
+			retrieveBeanFields(session, classDescriptor, node, object, false);
 			retrieveCollectionFields(session, classDescriptor, node, object, false);
 
 			return object;
@@ -406,16 +370,10 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-
-
-	/**
-	 * @see org.apache.jackrabbit.ocm.manager.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)) {
+			if (!session.nodeExists(path)) {
 				return null;
 			}
 
@@ -428,7 +386,7 @@ public class ObjectConverterImpl impleme
 
 			checkNodeType(session, classDescriptor);
 
-			Node node = (Node) session.getItem(path);
+			Node node = session.getNode(path);
 			if (!classDescriptor.isInterface()) {
 				node = getActualNode(session,node);
 				checkCompatiblePrimaryNodeTypes(session, node, classDescriptor, true);
@@ -483,7 +441,7 @@ public class ObjectConverterImpl impleme
             }
 
             simpleFieldsHelp.retrieveSimpleFields(session, classDescriptor, node, object);
-			retrieveBeanFields(session, classDescriptor, node, path, object, false);
+			retrieveBeanFields(session, classDescriptor, node, object, false);
 			retrieveCollectionFields(session, classDescriptor, node, object, false);
 
 			return object;
@@ -501,8 +459,8 @@ public class ObjectConverterImpl impleme
 			ClassDescriptor classDescriptor = getClassDescriptor(object.getClass());
 			String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName();
 			path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName);
-			Node node = (Node) session.getItem(path);
-			retrieveBeanFields(session, classDescriptor, node, path, object, true);
+			Node node = session.getNode(path);
+			retrieveBeanFields(session, classDescriptor, node, object, true);
 			retrieveCollectionFields(session, classDescriptor, node, object, true);
 
 		} catch (PathNotFoundException pnfe) {
@@ -520,11 +478,11 @@ public class ObjectConverterImpl impleme
 			classDescriptor = getClassDescriptor(object.getClass());
 			String pathFieldName = classDescriptor.getPathFieldDescriptor().getFieldName();
 			path = (String) ReflectionUtils.getNestedProperty(object, pathFieldName);
-			Node node = (Node) session.getItem(path);
+			Node node = session.getNode(path);
 			BeanDescriptor beanDescriptor = classDescriptor.getBeanDescriptor(attributeName);
 			if (beanDescriptor != null)
 			{
-				this.retrieveBeanField(session, beanDescriptor, node, path, object, true);
+				this.retrieveBeanField(session, beanDescriptor, node, object, true);
 			}
 			// Check if the attribute is a collection
 			else
@@ -662,8 +620,6 @@ public class ObjectConverterImpl impleme
 	}
 
 	/**
-	 * @see org.apache.jackrabbit.ocm.manager.objectconverter.ObjectConverter#getPath(javax.jcr.Session,
-	 *      java.lang.Object)
 	 * @throws JcrMappingException
 	 */
 	public String getPath(Session session, Object object) {
@@ -682,20 +638,17 @@ public class ObjectConverterImpl impleme
 		return (String) ReflectionUtils.getNestedProperty(object, pathField);
 	}
 
-	/**
-	 * Retrieve bean fields
-	 */
-	private void retrieveBeanFields(Session session, ClassDescriptor classDescriptor, Node node,
String path, Object object,
+	private void retrieveBeanFields(Session session, ClassDescriptor classDescriptor, Node node,
Object object,
 			boolean forceToRetrieve) {
 		Iterator beanDescriptorIterator = classDescriptor.getBeanDescriptors().iterator();
 		while (beanDescriptorIterator.hasNext()) {
 			BeanDescriptor beanDescriptor = (BeanDescriptor) beanDescriptorIterator.next();
-			this.retrieveBeanField(session, beanDescriptor, node, path, object, forceToRetrieve);
+			this.retrieveBeanField(session, beanDescriptor, node, object, forceToRetrieve);
 		}
 	}
 
 
-	private void retrieveBeanField(Session session,BeanDescriptor beanDescriptor, Node node,
String path, Object object, boolean forceToRetrieve )
+	private void retrieveBeanField(Session session,BeanDescriptor beanDescriptor, Node node,
Object object, boolean forceToRetrieve )
 	{
 		if (!beanDescriptor.isAutoRetrieve() && !forceToRetrieve)
 		{
@@ -758,11 +711,6 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-
-
-	/**
-	 * Retrieve Collection fields
-	 */
 	private void retrieveCollectionFields(Session session, ClassDescriptor classDescriptor,
Node parentNode, Object object,
 			boolean forceToRetrieve) {
 		Iterator collectionDescriptorIterator = classDescriptor.getCollectionDescriptors().iterator();
@@ -780,7 +728,6 @@ public class ObjectConverterImpl impleme
 
 		CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
 		Class collectionFieldClass = ReflectionUtils.getPropertyType(object, collectionDescriptor.getFieldName());
-		ManageableObjects objects = null;
 		if (collectionDescriptor.isProxy()) {
 			Object proxy = proxyManager.createCollectionProxy(session, collectionConverter, parentNode,
 					collectionDescriptor, collectionFieldClass);
@@ -788,7 +735,7 @@ public class ObjectConverterImpl impleme
 		}
 		else
 		{
-			objects = collectionConverter.getCollection(session, parentNode, collectionDescriptor,
collectionFieldClass);
+            ManageableObjects objects = collectionConverter.getCollection(session, parentNode,
collectionDescriptor, collectionFieldClass);
 			if (objects==null)
 			{
 			  ReflectionUtils.setNestedProperty(object, collectionDescriptor.getFieldName(), null);
@@ -812,9 +759,6 @@ public class ObjectConverterImpl impleme
 
 	}
 
-	/**
-	 * Insert Bean fields
-	 */
 	private void insertBeanFields(Session session, Object object, ClassDescriptor classDescriptor,
Node objectNode) {
 		Iterator beanDescriptorIterator = classDescriptor.getBeanDescriptors().iterator();
 		while (beanDescriptorIterator.hasNext()) {
@@ -824,7 +768,6 @@ public class ObjectConverterImpl impleme
 				continue;
 			}
 
-			String jcrName = beanDescriptor.getJcrName();
 			Object bean = ReflectionUtils.getNestedProperty(object, beanDescriptor.getFieldName());
 			if (bean != null)
 			{
@@ -846,11 +789,8 @@ public class ObjectConverterImpl impleme
 		}
 	}
 
-	/**
-	 * Update Bean fields
-	 */
+
 	private void updateBeanFields(Session session, Object object, ClassDescriptor classDescriptor,
Node objectNode) {
-		String jcrName = null;
 		Iterator beanDescriptorIterator = classDescriptor.getBeanDescriptors().iterator();
 		while (beanDescriptorIterator.hasNext())
 		{
@@ -859,7 +799,6 @@ public class ObjectConverterImpl impleme
 				continue;
 			}
 
-			jcrName = beanDescriptor.getJcrName();
 			Object bean = ReflectionUtils.getNestedProperty(object, beanDescriptor.getFieldName());
 
 			String converterClassName = null;



Mime
View raw message