Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 38119 invoked from network); 13 May 2007 20:49:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 May 2007 20:49:41 -0000 Received: (qmail 72291 invoked by uid 500); 13 May 2007 20:49:47 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 72249 invoked by uid 500); 13 May 2007 20:49:47 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 72236 invoked by uid 99); 13 May 2007 20:49:47 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 May 2007 13:49:47 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 May 2007 13:49:40 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 39F7A1A9838; Sun, 13 May 2007 13:49:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r537657 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence: PersistenceManager.java impl/PersistenceManagerImpl.java Date: Sun, 13 May 2007 20:49:20 -0000 To: commits@jackrabbit.apache.org From: clombart@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070513204920.39F7A1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: clombart Date: Sun May 13 13:49:19 2007 New Revision: 537657 URL: http://svn.apache.org/viewvc?view=rev&rev=537657 Log: Apply patch provided by Ruchi Goel for JCR-910. Unit tests are missing Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java?view=diff&rev=537657&r1=537656&r2=537657 ============================================================================== --- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java (original) +++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java Sun May 13 13:49:19 2007 @@ -346,5 +346,25 @@ * @param keepChanges */ public void refresh(boolean keepChanges); + + /** + * Move an object + * + * @param srcPath path of the object to move + * @param destPath destination path + * + * @throws PersistenceException + */ + public void move(String srcPath, String destPath) throws PersistenceException; + + /** + * Copy an object + * + * @param srcPath path of the object to copy + * @param destPath destination path + * + * @throws PersistenceException + */ + public void copy(String srcPath, String destPath) throws PersistenceException; } Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java?view=diff&rev=537657&r1=537656&r2=537657 ============================================================================== --- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java (original) +++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java Sun May 13 13:49:19 2007 @@ -31,6 +31,7 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.UnsupportedRepositoryOperationException; +import javax.jcr.Workspace; import javax.jcr.lock.Lock; import javax.jcr.lock.LockException; import javax.jcr.nodetype.NoSuchNodeTypeException; @@ -1110,10 +1111,84 @@ catch(RepositoryException e) { throw new PersistenceException("Cannot refresh current session ", e); } - - } - + /** + * + * @see org.apache.jackrabbit.ocm.persistence.PersistenceManager#move(java.lang.String, java.lang.String) + */ + public void move(String srcPath, String destPath){ + Workspace workspace = session.getWorkspace(); + try { + + workspace.move(srcPath,destPath); + + }catch(javax.jcr.nodetype.ConstraintViolationException cve){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + " Violation of a nodetype or attempt to move under a property detected", cve); + + }catch(javax.jcr.version.VersionException ve){ + throw new VersionException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + " Parent node of source or destination is versionable and checked in ", ve); + + }catch(javax.jcr.AccessDeniedException ade){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + " Session does not have access permissions", ade); + + }catch(javax.jcr.PathNotFoundException pnf){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + " Node at source or destination does not exist ", pnf); + + }catch(javax.jcr.ItemExistsException ie){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + " It might already exist at destination path.", ie); + + }catch(javax.jcr.lock.LockException le){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." + "Violation of a lock detected", le); + + }catch(javax.jcr.RepositoryException re){ + throw new PersistenceException( + "Cannot move the object from " + srcPath + " to " + destPath + "." , re); + } + } + /** + * + * @see org.apache.jackrabbit.ocm.persistence.PersistenceManager#copy(java.lang.String, java.lang.String) + */ + public void copy(String srcPath, String destPath){ + Workspace workspace = session.getWorkspace(); + try{ + workspace.copy(srcPath,destPath); + + }catch(javax.jcr.nodetype.ConstraintViolationException cve){ + throw new PersistenceException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Violation of a nodetype or attempt to copy under property detected ", cve); + + }catch(javax.jcr.version.VersionException ve){ + throw new VersionException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Parent node of source or destination is versionable and checked in ", ve); + + }catch(javax.jcr.AccessDeniedException ade){ + throw new PersistenceException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + " Session does not have access permissions", ade); + + }catch(javax.jcr.PathNotFoundException pnf){ + throw new PersistenceException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Node at source or destination does not exist ", pnf); + + }catch(javax.jcr.ItemExistsException ie){ + throw new PersistenceException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + "It might already exist at destination path.", ie); + + }catch(javax.jcr.lock.LockException le){ + throw new PersistenceException( + "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Violation of a lock detected", le); + + }catch(javax.jcr.RepositoryException re){ + throw new PersistenceException( + "Cannot copy the node from " + srcPath + " to " + destPath + "." , re); + } + } }