You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2001/05/16 14:04:58 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/lock Lock.java LockImpl.java
juergen 01/05/16 05:04:58
Modified: src/share/org/apache/slide/lock Lock.java LockImpl.java
Log:
removed the NRD from the API, to be put in NodePermission, see e-mails.
Revision Changes Path
1.9 +64 -77 jakarta-slide/src/share/org/apache/slide/lock/Lock.java
Index: Lock.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/Lock.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Lock.java 2001/05/10 18:34:14 1.8
+++ Lock.java 2001/05/16 12:04:46 1.9
@@ -1,13 +1,13 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/Lock.java,v 1.8 2001/05/10 18:34:14 juergen Exp $
- * $Revision: 1.8 $
- * $Date: 2001/05/10 18:34:14 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/Lock.java,v 1.9 2001/05/16 12:04:46 juergen Exp $
+ * $Revision: 1.9 $
+ * $Date: 2001/05/16 12:04:46 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.lock;
@@ -73,13 +73,12 @@
import org.apache.slide.security.*;
import org.apache.slide.util.Configuration;
import org.apache.slide.authenticate.CredentialsToken;
-import org.apache.slide.content.NodeRevisionDescriptor;
/**
* Lock helper class.
- *
+ *
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
*/
public interface Lock {
@@ -89,201 +88,190 @@
/**
* Put a lock on a subject.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @param token Object containing all the lock information
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
- * @exception ObjectIsAlreadyLockedException Object is already locked
+ * @exception ObjectIsAlreadyLockedException Object is already locked
* with an incompatible lock token
- * @exception AccessDeniedException Insufficient credentials to allow
+ * @exception AccessDeniedException Insufficient credentials to allow
* object locking
*/
- void lock(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token)
- throws ServiceAccessException, ObjectIsAlreadyLockedException,
+ void lock(SlideToken slideToken, NodeLock token)
+ throws ServiceAccessException, ObjectIsAlreadyLockedException,
AccessDeniedException, ObjectNotFoundException;
/**
* Removes a lock.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @param token Object containing all the lock information
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
*/
- void unlock(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token)
+ void unlock(SlideToken slideToken, NodeLock token)
throws ServiceAccessException, LockTokenNotFoundException;
/**
* Removes a set of linked locks.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @param token Object containing all the lock information
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- void unlock(SlideToken slideToken, String objectUri, NodeRevisionDescriptor revisionDescriptor,
+ void unlock(SlideToken slideToken, String objectUri,
String lockId)
- throws ServiceAccessException, LockTokenNotFoundException,
+ throws ServiceAccessException, LockTokenNotFoundException,
ObjectNotFoundException;
/**
* Renew a lock.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
- * @param token Object containing the lock info, as well as the new
+ * @param token Object containing the lock info, as well as the new
* desired expiration date
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
*/
- void renew(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token,
+ void renew(SlideToken slideToken, NodeLock token,
Date newExpirationDate)
throws ServiceAccessException, LockTokenNotFoundException;
/**
* Renew a set of linked locks.
- *
+ *
* @param crendentialsToken Credentials token
- * @param token Object containing the lock info, as well as the new
+ * @param token Object containing the lock info, as well as the new
* desired expiration date
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- void renew(SlideToken slideToken, String objectUri, NodeRevisionDescriptor revisionDescriptor,
+ void renew(SlideToken slideToken, String objectUri,
String lockId, Date newExpirationDate)
- throws ServiceAccessException, LockTokenNotFoundException,
+ throws ServiceAccessException, LockTokenNotFoundException,
ObjectNotFoundException;
/**
* Kills locks.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject on which locks are to be removed
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception AccessDeniedException Insufficient credentials to allow
+ * @exception AccessDeniedException Insufficient credentials to allow
* forced removal of locks
*/
- void kill(SlideToken slideToken, SubjectNode subject, NodeRevisionDescriptor revisionDescriptor)
- throws ServiceAccessException, AccessDeniedException,
+ void kill(SlideToken slideToken, SubjectNode subject)
+ throws ServiceAccessException, AccessDeniedException,
LockTokenNotFoundException, ObjectNotFoundException;
/**
* Enumerate locks on a subject.
- *
+ *
* @param slideToken Credentials token
* @param objectUri Object on which we want to enumerate locks
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced in
+ * @exception ObjectNotFoundException One of the objects referenced in
* the lock token were not found
*/
- Enumeration enumerateLocks(SlideToken slideToken,
- String objectUri, NodeRevisionDescriptor revisionDescriptor)
- throws ServiceAccessException, ObjectNotFoundException,
+ Enumeration enumerateLocks(SlideToken slideToken,
+ String objectUri)
+ throws ServiceAccessException, ObjectNotFoundException,
LockTokenNotFoundException;
/**
* Utility function for lock checking. Mirrors Security.checkCredentials.
- *
+ *
* @param slideToken Credetials token
- * @param object Object on which the action is performed
- * @param revisionDescriptor Node revision descriptor
+ * @param subject Object on which the action is performed
* @param action Action to test
- * @exception ObjectLockedException Can't perform specified action
+ * @exception ObjectLockedException Can't perform specified action
* on object
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- void checkLock(SlideToken slideToken, ObjectNode object, NodeRevisionDescriptor revisionDescriptor,
+ void checkLock(SlideToken slideToken, ObjectNode object,
ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
ObjectLockedException;
/**
* Check locking for a specific action and credential.
- *
+ *
* @param slideToken Credetials token
* @param subject Subject to test
- * @param revisionDescriptor Node revision descriptor
* @param user User to test
* @param action Action to test
- * @exception ObjectLockedException Can't perform specified action
+ * @exception ObjectLockedException Can't perform specified action
* on object
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- void checkLock(SlideToken slideToken, ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
+ void checkLock(SlideToken slideToken, ObjectNode subject,
SubjectNode user, ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
ObjectLockedException;
/**
* Tests if an element is locked.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject to test
- * @param revisionDescriptor Node revision descriptor
* @param user User to test
* @param action Locked for action
* @return boolean True if the subject is locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- boolean isLocked(SlideToken slideToken, ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
+ boolean isLocked(SlideToken slideToken, ObjectNode subject,
SubjectNode user, ActionNode action, boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException;
/**
* Tests if an element is locked.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject to test
- * @param revisionDescriptor Node revision descriptor
* @param user User to test
* @param action Locked for action
- * @param inheritance Set to true if we want to check if any children
+ * @param inheritance Set to true if we want to check if any children
* is locked
* with an incompatible lock
- * @param tryToLock True if the check is intended to check whether
+ * @param tryToLock True if the check is intended to check whether
* or not we can put a new lock
* @return boolean True if the subject is locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced in
+ * @exception ObjectNotFoundException One of the objects referenced in
* the lock token were not found
*/
- boolean isLocked(SlideToken slideToken, ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
+ boolean isLocked(SlideToken slideToken, ObjectNode subject,
SubjectNode user, ActionNode action, boolean inheritance,
boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException;
@@ -291,15 +279,14 @@
/**
* Tests if an element is locked.
- *
+ *
* @param token Lock token to test
- * @param revisionDescriptor Node revision descriptor
* @return boolean True if locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- boolean isLocked(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token,
+ boolean isLocked(SlideToken slideToken, NodeLock token,
boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException;
1.14 +119 -133 jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java
Index: LockImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- LockImpl.java 2001/05/10 18:34:16 1.13
+++ LockImpl.java 2001/05/16 12:04:49 1.14
@@ -1,13 +1,13 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java,v 1.13 2001/05/10 18:34:16 juergen Exp $
- * $Revision: 1.13 $
- * $Date: 2001/05/10 18:34:16 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/LockImpl.java,v 1.14 2001/05/16 12:04:49 juergen Exp $
+ * $Revision: 1.14 $
+ * $Date: 2001/05/16 12:04:49 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.lock;
@@ -73,13 +73,12 @@
import org.apache.slide.security.*;
import org.apache.slide.util.Configuration;
import org.apache.slide.authenticate.CredentialsToken;
-import org.apache.slide.content.NodeRevisionDescriptor;
/**
* Lock helper class.
- *
+ *
* @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public final class LockImpl implements Lock {
@@ -88,12 +87,12 @@
/**
* Constructor.
- *
+ *
* @param namespace Associated namespace
* @param namespaceConfig Namespace configuration
* @param securityHelper Security helper
*/
- public LockImpl(Namespace namespace, NamespaceConfig namespaceConfig,
+ public LockImpl(Namespace namespace, NamespaceConfig namespaceConfig,
Security securityHelper) {
this.namespace = namespace;
this.namespaceConfig = namespaceConfig;
@@ -127,82 +126,79 @@
/**
* Put a lock on a subject.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @param token Object containing all the lock information
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
- * @exception ObjectIsAlreadyLockedException Object is already locked
+ * @exception ObjectIsAlreadyLockedException Object is already locked
* with an incompatible lock token
- * @exception AccessDeniedException Insufficient credentials to allow
+ * @exception AccessDeniedException Insufficient credentials to allow
* object locking
*/
- public void lock(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token)
- throws ServiceAccessException, ObjectIsAlreadyLockedException,
+ public void lock(SlideToken slideToken, NodeLock token)
+ throws ServiceAccessException, ObjectIsAlreadyLockedException,
AccessDeniedException, ObjectNotFoundException {
- boolean canLock = !isLocked(slideToken, revisionDescriptor, token, true);
+ boolean canLock = !isLocked(slideToken, token, true);
// Then we try to lock the subject.
- // If the User doesn't have enough priviledges to accomplish this
- // action, we will get a SecurityException which will in turn be
+ // If the User doesn't have enough priviledges to accomplish this
+ // action, we will get a SecurityException which will in turn be
// thrown by this function.
if (canLock) {
Uri objectUri = namespace.getUri(slideToken, token.getObjectUri());
ObjectNode lockedObject = objectUri.getStore()
.retrieveObject(objectUri);
securityHelper
- .checkCredentials(slideToken, lockedObject, revisionDescriptor,
+ .checkCredentials(slideToken, lockedObject,
namespaceConfig.getLockObjectAction());
Uri lockedUri = namespace.getUri(slideToken, token.getObjectUri());
- lockedUri.getStore().putLock(lockedUri, revisionDescriptor, token);
+ lockedUri.getStore().putLock(lockedUri, token);
} else {
throw new ObjectIsAlreadyLockedException(token.getObjectUri());
}
-
+
}
/**
* Removes a lock.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @param token Object containing all the lock information
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
*/
- public void unlock(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token)
+ public void unlock(SlideToken slideToken, NodeLock token)
throws ServiceAccessException, LockTokenNotFoundException {
Uri lockedUri = namespace.getUri(slideToken, token.getObjectUri());
- lockedUri.getStore().removeLock(lockedUri, revisionDescriptor, token);
+ lockedUri.getStore().removeLock(lockedUri, token);
}
/**
* Removes a set of linked locks.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public void unlock(SlideToken slideToken, String objectUri, NodeRevisionDescriptor revisionDescriptor,
+ public void unlock(SlideToken slideToken, String objectUri,
String lockId)
- throws ServiceAccessException, LockTokenNotFoundException,
+ throws ServiceAccessException, LockTokenNotFoundException,
ObjectNotFoundException {
- Enumeration locksList = enumerateLocks(slideToken, objectUri, revisionDescriptor);
+ Enumeration locksList = enumerateLocks(slideToken, objectUri);
while (locksList.hasMoreElements()) {
NodeLock currentLock = (NodeLock) locksList.nextElement();
if (currentLock.getLockId().equals(lockId)) {
- unlock(slideToken, revisionDescriptor, currentLock);
+ unlock(slideToken, currentLock);
}
}
@@ -211,45 +207,43 @@
/**
* Renew a lock.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
- * @param token Object containing the lock info, as well as the new
+ * @param token Object containing the lock info, as well as the new
* desired expiration date
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in
+ * @exception LockTokenNotFoundException Cannot find the Lock in
* the Lock Store service
*/
- public void renew(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor, NodeLock token,
+ public void renew(SlideToken slideToken, NodeLock token,
Date newExpirationDate)
throws ServiceAccessException, LockTokenNotFoundException {
token.setExpirationDate(newExpirationDate);
Uri lockedUri = namespace.getUri(slideToken, token.getObjectUri());
- lockedUri.getStore().renewLock(lockedUri, revisionDescriptor, token);
+ lockedUri.getStore().renewLock(lockedUri, token);
}
/**
* Renew a set of linked locks.
- *
+ *
* @param crendentialsToken Credentials token
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public void renew(SlideToken slideToken, String objectUri, NodeRevisionDescriptor revisionDescriptor,
+ public void renew(SlideToken slideToken, String objectUri,
String lockId, Date newExpirationDate)
- throws ServiceAccessException, LockTokenNotFoundException,
+ throws ServiceAccessException, LockTokenNotFoundException,
ObjectNotFoundException {
- Enumeration locksList = enumerateLocks(slideToken, objectUri, revisionDescriptor);
+ Enumeration locksList = enumerateLocks(slideToken, objectUri);
while (locksList.hasMoreElements()) {
NodeLock currentLock = (NodeLock) locksList.nextElement();
if (currentLock.getLockId().equals(lockId)) {
- renew(slideToken, revisionDescriptor, currentLock, newExpirationDate);
+ renew(slideToken, currentLock, newExpirationDate);
}
}
@@ -258,34 +252,33 @@
/**
* Kills locks.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject on which locks are to be removed
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced in
+ * @exception ObjectNotFoundException One of the objects referenced in
* the lock token were not found
- * @exception LockTokenNotFoundException Cannot find the Lock in the
+ * @exception LockTokenNotFoundException Cannot find the Lock in the
* Lock Store service
- * @exception AccessDeniedException Insufficient credentials to allow
+ * @exception AccessDeniedException Insufficient credentials to allow
* forced removal of locks
*/
- public void kill(SlideToken slideToken, SubjectNode subject, NodeRevisionDescriptor revisionDescriptor)
- throws ServiceAccessException, AccessDeniedException,
+ public void kill(SlideToken slideToken, SubjectNode subject)
+ throws ServiceAccessException, AccessDeniedException,
LockTokenNotFoundException, ObjectNotFoundException {
- // We retrieve the enumeration of locks which have been put on the
+ // We retrieve the enumeration of locks which have been put on the
// subject.
Uri subjectUri = namespace.getUri(slideToken, subject.getUri());
Enumeration locks = subjectUri.getStore()
- .enumerateLocks(subjectUri, revisionDescriptor);
+ .enumerateLocks(subjectUri);
// Then, try to kill each individual lock.
while (locks.hasMoreElements()) {
securityHelper
- .checkCredentials(slideToken, subject, revisionDescriptor,
+ .checkCredentials(slideToken, subject,
namespaceConfig.getKillLockAction());
subjectUri.getStore()
- .killLock(subjectUri, revisionDescriptor, (NodeLock) locks.nextElement());
+ .killLock(subjectUri, (NodeLock) locks.nextElement());
}
}
@@ -293,17 +286,16 @@
/**
* Enumerate locks on a subject.
- *
+ *
* @param slideToken Credentials token
* @param objectUri Object on which we want to enumerate locks
- * @param revisionDescriptor Node revision descriptor
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public Enumeration enumerateLocks(SlideToken slideToken,
- String objectUri, NodeRevisionDescriptor revisionDescriptor)
- throws ServiceAccessException, ObjectNotFoundException,
+ public Enumeration enumerateLocks(SlideToken slideToken,
+ String objectUri)
+ throws ServiceAccessException, ObjectNotFoundException,
LockTokenNotFoundException {
// We retrieve the LockStore service from the namespace.
Vector locksVector = new Vector();
@@ -314,15 +306,15 @@
while (scopes.hasMoreElements()) {
String currentScope = (String) scopes.nextElement();
Uri currentScopeUri = namespace.getUri(slideToken, currentScope);
- Enumeration currentLocks =
+ Enumeration currentLocks =
currentScopeUri.getStore()
- .enumerateLocks(currentScopeUri, revisionDescriptor);
+ .enumerateLocks(currentScopeUri);
while (currentLocks.hasMoreElements()) {
- NodeLock currentLockToken =
+ NodeLock currentLockToken =
(NodeLock) currentLocks.nextElement();
if (currentLockToken.hasExpired()) {
currentScopeUri.getStore()
- .removeLock(currentScopeUri, revisionDescriptor, currentLockToken);
+ .removeLock(currentScopeUri, currentLockToken);
} else {
locksVector.addElement(currentLockToken);
}
@@ -335,21 +327,19 @@
/**
* Utility function for lock checking. Mirrors Security.checkCredentials.
- *
+ *
* @param token Credetials token
- * @param object Object on which the action is performed
- * @param revisionDescriptor Node revision descriptor
+ * @param subject Object on which the action is performed
* @param action Action to test
- * @exception ObjectLockedException Can't perform specified action
+ * @exception ObjectLockedException Can't perform specified action
* on object
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public void checkLock(SlideToken token,
- ObjectNode object, NodeRevisionDescriptor revisionDescriptor,
- ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ public void checkLock(SlideToken token,
+ ObjectNode object, ActionNode action)
+ throws ServiceAccessException, ObjectNotFoundException,
ObjectLockedException {
if (Configuration.useIntegratedLocking()) {
@@ -363,7 +353,7 @@
+ token.getCredentialsToken().getPublicCredentials());
SubjectNode subject = (SubjectNode) subjectUri
.getStore().retrieveObject(subjectUri);
- checkLock(token, realObject, revisionDescriptor, subject, action);
+ checkLock(token, realObject, subject, action);
}
}
@@ -371,26 +361,25 @@
/**
* Check locking for a specific action and credential.
- *
+ *
* @param slideToken Credetials token
* @param subject Subject to test
- * @param revisionDescriptor Node revision descriptor
* @param user User to test
* @param action Action to test
- * @exception ObjectLockedException Can't perform specified action
+ * @exception ObjectLockedException Can't perform specified action
* on object
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public void checkLock(SlideToken slideToken,
- ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
- SubjectNode user, ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ public void checkLock(SlideToken slideToken,
+ ObjectNode subject, SubjectNode user,
+ ActionNode action)
+ throws ServiceAccessException, ObjectNotFoundException,
ObjectLockedException {
if (Configuration.useIntegratedLocking()) {
- if (isLocked(slideToken, subject, revisionDescriptor, user, action, false)) {
+ if (isLocked(slideToken, subject, user, action, false)) {
throw new ObjectLockedException(subject.getUri());
}
}
@@ -400,68 +389,64 @@
/**
* Tests if an element is locked.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject to test
- * @param revisionDescriptor Node revision descriptor
* @param user User to test
* @param action Locked for action
* @return boolean True if the subject is locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public boolean isLocked(SlideToken slideToken,
- ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
- SubjectNode user,
+ public boolean isLocked(SlideToken slideToken,
+ ObjectNode subject, SubjectNode user,
ActionNode action, boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException {
- NodeLock token = new NodeLock(subject, user, action,
+ NodeLock token = new NodeLock(subject, user, action,
new Date(), false);
- return isLocked(slideToken, revisionDescriptor, token, tryToLock);
+ return isLocked(slideToken, token, tryToLock);
}
/**
* Tests if an element is locked.
- *
+ *
* @param crendentialsToken Credentials token
* @param subject Subject to test
* @param user User to test
* @param action Locked for action
- * @param inheritance Set to true if we want to check if any children
+ * @param inheritance Set to true if we want to check if any children
* is locked with an incompatible lock
- * @param tryToLock True if the check is intended to check whether
+ * @param tryToLock True if the check is intended to check whether
* or not we can put a new lock
* @return boolean True if the subject is locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public boolean isLocked(SlideToken slideToken,
- ObjectNode subject, NodeRevisionDescriptor revisionDescriptor,
- SubjectNode user,
- ActionNode action, boolean inheritance,
+ public boolean isLocked(SlideToken slideToken,
+ ObjectNode subject, SubjectNode user,
+ ActionNode action, boolean inheritance,
boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException {
- NodeLock token = new NodeLock(subject, user, action, new Date(),
+ NodeLock token = new NodeLock(subject, user, action, new Date(),
inheritance);
- return isLocked(slideToken, revisionDescriptor, token, tryToLock);
+ return isLocked(slideToken, token, tryToLock);
}
/**
* Tests if an element is locked.
- *
+ *
* @param token Lock token to test
- * @param revisionDescriptor Node revision descriptor
* @return boolean True if locked
* @exception ServiceAccessException Low level service access exception
- * @exception ObjectNotFoundException One of the objects referenced
+ * @exception ObjectNotFoundException One of the objects referenced
* in the lock token were not found
*/
- public boolean isLocked(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor,
- NodeLock token, boolean tryToLock)
+ public boolean isLocked(SlideToken slideToken, NodeLock token,
+ boolean tryToLock)
throws ServiceAccessException, ObjectNotFoundException {
Uri objectUri = namespace.getUri(slideToken, token.getObjectUri());
@@ -480,34 +465,34 @@
String currentScope = (String) scopes.nextElement();
Uri currentScopeUri = namespace.getUri(slideToken, currentScope);
Enumeration locks = currentScopeUri.getStore()
- .enumerateLocks(currentScopeUri, revisionDescriptor);
+ .enumerateLocks(currentScopeUri);
while (locks.hasMoreElements()) {
NodeLock currentLockToken = (NodeLock) locks.nextElement();
- if (!isCompatible(slideToken, revisionDescriptor, token, currentLockToken,
+ if (!isCompatible(slideToken, token, currentLockToken,
tryToLock)) {
isLocked = true;
}
}
}
- // Then, if the desired scope is inheritable, we parse the
- // locked subject's children to see if any of them has been
+ // Then, if the desired scope is inheritable, we parse the
+ // locked subject's children to see if any of them has been
// locked with an incompatible lock.
if (token.isInheritable()) {
Stack childrenStack = new Stack();
childrenStack.push(initialObject);
while (!isLocked && !childrenStack.empty()) {
ObjectNode currentObject = (ObjectNode) childrenStack.pop();
- Uri currentObjectUri =
+ Uri currentObjectUri =
namespace.getUri(slideToken, currentObject.getUri());
// We test the compatibility of the child
Enumeration locks = currentObjectUri.getStore()
- .enumerateLocks(currentObjectUri, revisionDescriptor);
+ .enumerateLocks(currentObjectUri);
while (locks.hasMoreElements()) {
NodeLock currentLockToken = (NodeLock) locks.nextElement();
- if (!isCompatible(slideToken, revisionDescriptor, token,
+ if (!isCompatible(slideToken, token,
currentLockToken, tryToLock)) {
isLocked = true;
}
@@ -527,7 +512,7 @@
Enumeration children = childrenVector.elements();
while (children.hasMoreElements()) {
- ObjectNode tempObject =
+ ObjectNode tempObject =
(ObjectNode) children.nextElement();
childrenStack.push(tempObject);
}
@@ -543,13 +528,13 @@
/**
- * Return true if a lock token for this lock has been given in the
+ * Return true if a lock token for this lock has been given in the
* credentials token.
- *
+ *
* @param slideToken Current credentials token
* @param token Lock token
*/
- private boolean checkLockToken(SlideToken slideToken,
+ private boolean checkLockToken(SlideToken slideToken,
NodeLock token) {
if (!slideToken.isEnforceLockTokens())
@@ -562,31 +547,32 @@
/**
* Tells whether or not two locks are compatible.
- *
+ *
* @param token1 First token
* @param token2 Second token : object's lock
* @param tryToLock True if we want to check for a lock creation
* @return boolean True if the locks are compatible
*/
- private boolean isCompatible(SlideToken slideToken, NodeRevisionDescriptor revisionDescriptor,
- NodeLock token1, NodeLock token2,
+ private boolean isCompatible(SlideToken slideToken,
+ NodeLock token1, NodeLock token2,
boolean tryToLock) {
boolean compatible = true;
// We first check whether or not the lock is still valid
if (token2.hasExpired()) {
// Since the lock has expired, it is removed
try {
- Uri token2Uri = namespace.getUri(slideToken, token2.getObjectUri());
- token2Uri.getStore().removeLock(token2Uri, revisionDescriptor, token2);
+ Uri token2Uri = namespace.getUri(slideToken,
+ token2.getObjectUri());
+ token2Uri.getStore().removeLock(token2Uri, token2);
} catch (SlideException e) {
e.printStackTrace();
}
} else {
// The lockTypes are not equal
- boolean condition1 = (tryToLock)
+ boolean condition1 = (tryToLock)
&& (token2.getTypeUri().equals(token1.getTypeUri()));
// The user tested is not parent of the token's user
- boolean condition2 =
+ boolean condition2 =
(token1.getSubjectUri().startsWith(token2.getSubjectUri()));
// The two lock types are the same
boolean condition3 = token2.getTypeUri()
@@ -597,8 +583,8 @@
boolean condition5 = checkLockToken(slideToken, token2);
// Are lock tokens enforced ?
boolean condition6 = slideToken.isEnforceLockTokens();
- if ((condition1 && condition4)
- || (condition3 && !condition2 && !condition6)
+ if ((condition1 && condition4)
+ || (condition3 && !condition2 && !condition6)
|| (condition3 && !condition5 && condition6)) {
compatible = false;
}