You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-dev@incubator.apache.org by "Martin Koci (JIRA)" <ji...@apache.org> on 2005/11/09 21:07:04 UTC

[jira] Created: (GRFT-73) Check locked node status in operations

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


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


[jira] Closed: (GRFT-73) Check locked node status in operations

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/GRFT-73?page=all ]
     
Christophe Lombart closed GRFT-73:
----------------------------------

    Resolution: Fixed

Commited and reviewed by Alew a couple of weeks ago

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement

>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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


[jira] Commented: (GRFT-73) Check locked node status in operations

Posted by "Martin Koci (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/GRFT-73?page=comments#action_12357589 ] 

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

LockingException serves as root exception for all errors related to locking. Simple instanceof checking can say "something wrong with locking". For example I have LockingExceptionHandler which translates exceptions to user-friendly messages:

public class LockExceptionHanlder {
     boolean canHandle(Exception e) {
             return e instanceof LockingException;
     }

  // ... translation: ex type to mesage here
}

In future this type can hold common attributes for all locking exception, e.g. userID (who cannot do something with locked node)

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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


[jira] Commented: (GRFT-73) Check locked node status in operations

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/GRFT-73?page=comments#action_12357624 ] 

Christophe Lombart commented on GRFT-73:
----------------------------------------

* Exceptions has been added
* Method added in the persistence manager

Martin, can you check if it ok for you ? Thanks

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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


[jira] Commented: (GRFT-73) Check locked node status in operations

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/GRFT-73?page=comments#action_12357506 ] 

Christophe Lombart commented on GRFT-73:
----------------------------------------

Until now, LockingException is not very usefull. Why not to inherit directly from the PersistenceException ? 

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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


[jira] Commented: (GRFT-73) Check locked node status in operations

Posted by "Martin Koci (JIRA)" <ji...@apache.org>.
    [ 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


[jira] Updated: (GRFT-73) Check locked node status in operations

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/GRFT-73?page=all ]

Christophe Lombart updated GRFT-73:
-----------------------------------

      Component: JCR-Mapping
    Fix Version: 1.0-a1-dev
        Version: 1.0-a1-dev

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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


[jira] Updated: (GRFT-73) Check locked node status in operations

Posted by "Martin Koci (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/GRFT-73?page=all ]

Martin Koci updated GRFT-73:
----------------------------

    Attachment: LockingException.java
                LockedException.java
                CannotUnlockException.java

> 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


[jira] Assigned: (GRFT-73) Check locked node status in operations

Posted by "Christophe Lombart (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/GRFT-73?page=all ]

Christophe Lombart reassigned GRFT-73:
--------------------------------------

    Assign To: Christophe Lombart

> Check locked node status in operations
> --------------------------------------
>
>          Key: GRFT-73
>          URL: http://issues.apache.org/jira/browse/GRFT-73
>      Project: Graffito
>         Type: Improvement
>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>     Priority: Critical
>      Fix For: 1.0-a1-dev
>  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