[ 
http://issues.apache.org/jira/browse/GRFT-73?page=comments#action_12357142 ] 

Martin Koci commented on GRFT-73:
---------------------------------

I propose following:

create exceptions structure:
org.apache.portals.graffito.jcr.exception.PersistenceException
           org.apache.portals.graffito.jcr.exception.LockingException
                         
org.apache.portals.graffito.jcr.exception.LockedException
                         
org.apache.portals.graffito.jcr.exception.CannotUnlockException

Check lock node status in every method with code:

protected void checkIfNodeLocked(String absPath) throws  LockedException {
        Node node = getNode(absPath);
        if (node.isLocked()) {
            final Lock lock = node.getLock();
            final String lockOwner = lock.getLockOwner();
            final String path = lock.getNode().getPath();
            throw new LockedException(lockOwner, path);
        }
 }


> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>     Reporter: Martin Koci
>     Priority: Critical
>  Attachments: CannotUnlockException.java, LockedException.java, 
> LockingException.java
>
> Many operations on Node throws LockException if node is locked. But current 
> code doesnt reflect this behaviour correctly: e.g. checkin:
>               try{
>                       Node node = (Node) session.getItem(path);
>                         ...
>                       javax.jcr.version.Version newVersion = node.checkin(); 
> // throws LockException if node locked
>                       ....
>               }catch (RepositoryException e) { // Catch LockException  too !!
>                       throw new VersionException("Impossible to checkin the 
> object " + path, e);
>               }
> LockException -> VersionException? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to