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 pn...@apache.org on 2003/02/14 15:34:38 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util AclConstants.java ComputedPropertyProvider.java PropertyHelper.java PropertyRetrieverImpl.java VersioningHelper.java
pnever 2003/02/14 06:34:38
Modified: src/conf/webapp web.xml
src/share/org/apache/slide/lock NodeLock.java
src/webdav/server/org/apache/slide/webdav/method
CopyMethod.java LockMethod.java MoveMethod.java
PropFindMethod.java PropPatchMethod.java
ReportMethod.java SearchMethod.java
UpdateMethod.java
src/webdav/server/org/apache/slide/webdav/util
AclConstants.java ComputedPropertyProvider.java
PropertyHelper.java PropertyRetrieverImpl.java
VersioningHelper.java
Log:
Fixed some locking problems:
1) the DAV:owner element specified an a LOCK request was ignored
- added field ownerInfo to NodeLock
- handled setting (LOCK) and retrieving (PROPFIND DAV:lockdiscovery)
2) added element DAV:principal-URL to the DAV:lockdiscovery property
- as proposed on February 08, 2003 by Lisa Dusseault in
w3c-dist-auth-request@w3.org, the DAV:lockdiscovery property should
include an element DAV:principal-URL with the semantics of the
WebDAV/ACL specification. This feature can be switched-off in case of
interoperability problems
(servlet init-param "lockdiscoveryIncludesPrincipalURL").
Revision Changes Path
1.21 +11 -0 jakarta-slide/src/conf/webapp/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/conf/webapp/web.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- web.xml 17 Jan 2003 15:28:52 -0000 1.20
+++ web.xml 14 Feb 2003 14:34:33 -0000 1.21
@@ -144,6 +144,17 @@
parameter "true".
</description>
</init-param>
+ <init-param>
+ <param-name>lockdiscoveryIncludesPrincipalURL</param-name>
+ <param-value>true</param-value>
+ <description>
+ As proposed on February 08, 2003 by Lisa Dusseault in
+ w3c-dist-auth-request@w3.org, the DAV:lockdiscovery property should
+ include an element DAV:principal-URL with the semantics of the
+ WebDAV/ACL specification. This feature can be switched-off in case
+ of interoperability problems.
+ </description>
+ </init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- The mapping for the Slide WebDAV servlet.
1.11 +82 -5 jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java
Index: NodeLock.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/lock/NodeLock.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- NodeLock.java 25 Apr 2002 21:30:14 -0000 1.10
+++ NodeLock.java 14 Feb 2003 14:34:34 -0000 1.11
@@ -122,6 +122,22 @@
inheritance, exclusive);
}
+ /**
+ * Constructor.
+ *
+ * @param locked Locked object
+ * @param user Lock owner
+ * @param lockType Type of the lock
+ * @param expirationDate Date of expiration of the lock
+ * @param inheritance True if lock is inheritable
+ */
+ public NodeLock(ObjectNode locked, SubjectNode user, ActionNode lockType,
+ Date expirationDate, boolean inheritance,
+ boolean exclusive, String ownerInfo) {
+ this(locked.getUri(), user.getUri(), lockType.getUri(), expirationDate,
+ inheritance, exclusive, ownerInfo);
+ }
+
/**
* Constructor.
@@ -151,6 +167,23 @@
public NodeLock(String objectUri, String subjectUri, String typeUri,
Date expirationDate, boolean inheritance,
boolean exclusive) {
+ this(objectUri, subjectUri, typeUri, expirationDate, inheritance, exclusive, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param objectUri Locked object uri
+ * @param subjectUri Lock owner uri
+ * @param typeUri Lock type uri
+ * @param expirationDate Date of expiration of the lock
+ * @param inheritance True if lock is inheritable
+ * @param exclusive True if lock is exclusive
+ * @param ownerInfo contacting info about the lock owner (phone number, email)
+ */
+ public NodeLock(String objectUri, String subjectUri, String typeUri,
+ Date expirationDate, boolean inheritance,
+ boolean exclusive, String ownerInfo) {
this.objectUri = objectUri;
this.subjectUri = subjectUri;
this.typeUri = typeUri;
@@ -162,6 +195,7 @@
this.lockId =
md5Encoder.encode(md5Helper.digest(this.lockId.getBytes()));
this.exclusive = exclusive;
+ this.ownerInfo = ownerInfo;
}
@@ -174,7 +208,7 @@
public NodeLock(NodeLock lock, String typeUri) {
this(lock.getLockId(), lock.getObjectUri(), lock.getSubjectUri(),
typeUri, lock.getExpirationDate(), lock.isInheritable(),
- lock.isExclusive());
+ lock.isExclusive(), lock.getOwnerInfo());
}
@@ -190,6 +224,24 @@
public NodeLock(String lockId, String objectUri, String subjectUri,
String typeUri, Date expirationDate, boolean inheritance,
boolean exclusive) {
+ this(lockId, objectUri, subjectUri, typeUri, expirationDate, inheritance,
+ exclusive, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param objectUri Locked object uri
+ * @param subjectUri Lock owner uri
+ * @param typeUri Lock type uri
+ * @param expirationDate Date of expiration of the lock
+ * @param inheritance True if lock is inheritable
+ * @param exclusive True if lock is exclusive
+ * @param ownerInfo contacting info about the lock owner (phone number, email)
+ */
+ public NodeLock(String lockId, String objectUri, String subjectUri,
+ String typeUri, Date expirationDate, boolean inheritance,
+ boolean exclusive, String ownerInfo) {
this.objectUri = objectUri;
this.subjectUri = subjectUri;
this.typeUri = typeUri;
@@ -197,6 +249,7 @@
this.inheritance = inheritance;
this.lockId = lockId;
this.exclusive = exclusive;
+ this.ownerInfo = ownerInfo;
}
@@ -244,6 +297,10 @@
*/
protected String lockId;
+ /**
+ * Contacting information about the lock owner
+ */
+ protected String ownerInfo;
/**
* MD5 message digest provider.
@@ -424,6 +481,26 @@
*/
public String getLockId() {
return lockId;
+ }
+
+ /**
+ * Set the contacting info for the lock owner (phone, email, etc.)
+ *
+ * @param ownerInfo a String
+ *
+ */
+ public void setOwnerInfo(String ownerInfo) {
+ this.ownerInfo = ownerInfo;
+ }
+
+ /**
+ * Get the contacting info for the lock owner (phone, email, etc.)
+ *
+ * @return a String
+ *
+ */
+ public String getOwnerInfo() {
+ return ownerInfo;
}
1.52 +4 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
Index: CopyMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- CopyMethod.java 31 Oct 2002 14:50:20 -0000 1.51
+++ CopyMethod.java 14 Feb 2003 14:34:34 -0000 1.52
@@ -466,7 +466,7 @@
private void resetDeltavProperties(NodeRevisionDescriptor revisionDescriptor) {
// use initial values for DeltaV properties
- PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
+ PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, getConfig());
ResourceKind resourceKind = VersionableImpl.getInstance();
Iterator initialPropertyIterator =
propertyHelper.createInitialProperties(resourceKind).iterator();
1.43 +6 -6 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java
Index: LockMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- LockMethod.java 12 Aug 2002 12:55:02 -0000 1.42
+++ LockMethod.java 14 Feb 2003 14:34:34 -0000 1.43
@@ -132,7 +132,7 @@
/**
* The default owner if not explicitely specified by the request.
*/
- private static final String DEFAULT_LOCK_OWNER = "SlideDefaultLockOwner";
+ public static final String DEFAULT_LOCK_OWNER = "";
// ----------------------------------------------------- Instance Variables
@@ -220,7 +220,7 @@
protected void parseRequest()
throws WebdavException {
- propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, getConfig());
readRequestContent();
serverURL = HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort();
@@ -499,7 +499,7 @@
lockToken =
new NodeLock(toLockSubject, credentialsSubject,
namespaceConfig.getCreateObjectAction(),
- lockDate, inheritance, exclusive);
+ lockDate, inheritance, exclusive, lockInfo_lockOwner);
lock.lock(slideToken, lockToken);
try {
1.56 +4 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
Index: MoveMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- MoveMethod.java 24 Oct 2002 08:30:06 -0000 1.55
+++ MoveMethod.java 14 Feb 2003 14:34:34 -0000 1.56
@@ -179,7 +179,7 @@
req,
resp,
config);
- propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token);
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, getConfig());
// Prevent dirty reads
slideToken.setForceStoreEnlistment(true);
1.88 +4 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java
Index: PropFindMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- PropFindMethod.java 30 Oct 2002 08:22:34 -0000 1.87
+++ PropFindMethod.java 14 Feb 2003 14:34:34 -0000 1.88
@@ -567,7 +567,7 @@
case FIND_ALL_PROP :
case FIND_BY_PROPERTY :
try {
- PropertyRetriever propertyRetriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetriever propertyRetriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
List propstatList= propertyRetriever.getPropertiesOfObject(requestedProperties, revisionDescriptors, revisionDescriptor, req.getContextPath(), serverURL, allpropIncludesDeltav);
Iterator iterator = propstatList.iterator();
while (iterator.hasNext()) {
1.64 +4 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
Index: PropPatchMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- PropPatchMethod.java 31 Oct 2002 14:50:20 -0000 1.63
+++ PropPatchMethod.java 14 Feb 2003 14:34:34 -0000 1.64
@@ -168,7 +168,7 @@
versioningHelper =
VersioningHelper.getVersioningHelper( slideToken, token, req, resp, config );
propertyHelper =
- PropertyHelper.getPropertyHelper( slideToken, token );
+ PropertyHelper.getPropertyHelper( slideToken, token, getConfig() );
readRequestContent();
1.46 +11 -11 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java
Index: ReportMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- ReportMethod.java 12 Aug 2002 12:55:02 -0000 1.45
+++ ReportMethod.java 14 Feb 2003 14:34:35 -0000 1.46
@@ -724,7 +724,7 @@
*/
private void writeVersionTreeReport(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, SlideToken slideToken, String requestUri, Element parentElement) throws ObjectLockedException, ServiceAccessException, LinkedObjectNotFoundException, AccessDeniedException, ObjectNotFoundException, RevisionDescriptorNotFoundException, LockTokenNotFoundException, JDOMException {
- PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
NodeRevisionNumber revisionNumber = revisionDescriptor.getRevisionNumber();
// this is a versioned resource
@@ -778,7 +778,7 @@
requestUri));
response.addContent(href);
- PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
try {
List propstatList = retriever.getPropertiesOfObject(requestedProperties, slideUri, revisionNumber, req.getContextPath(), serverURL, true);
@@ -817,7 +817,7 @@
requestUri));
response.addContent(href);
- PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
try {
List propstatList = retriever.getPropertiesOfObject(requestedProperties, requestedResource, req.getContextPath(), serverURL, true);
@@ -875,7 +875,7 @@
NodeRevisionDescriptors revisionDescriptors = null;
NodeRevisionDescriptor revisionDescriptor = null;
NodeRevisionNumber revisionNumber = null;
- PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
String serverURL = HTTP_PROTOCOL + req.getServerName()+ ":" + req.getServerPort();
List propstatList = null;
Element aclprops = null;
@@ -1313,7 +1313,7 @@
List propList = null;
String serverURL = "http://" + req.getServerName()+ ":" + req.getServerPort();
- PropertyRetriever retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetriever retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
org.jdom.Element responseElement = new org.jdom.Element (E_RESPONSE, NamespaceCache.DEFAULT_NAMESPACE);
parentElement.addContent (responseElement);
@@ -1349,7 +1349,7 @@
protected List retrieveProperties (String currentIntUrl, RequestedProperties reqProperties) throws WebdavException, SlideException, JDOMException{
List propList = null;
String serverURL = "http://" + req.getServerName()+ ":" + req.getServerPort();
- PropertyRetriever retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetriever retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
try {
propList = retriever.getPropertiesOfObject (reqProperties,
currentIntUrl,
@@ -1433,7 +1433,7 @@
ResourceKind resourceKind = AbstractResourceKind.determineResourceKind(token,
revisionDescriptors,
revisionDescriptor);
- PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken);
+ PropertyRetrieverImpl retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
Element response = getResponseElement(requestUri,
1.30 +5 -5 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java
Index: SearchMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/SearchMethod.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- SearchMethod.java 9 Oct 2002 14:15:25 -0000 1.29
+++ SearchMethod.java 14 Feb 2003 14:34:35 -0000 1.30
@@ -162,7 +162,7 @@
protected void parseRequest() throws WebdavException {
searchHelper = token.getSearchHelper();
- retriever = new PropertyRetrieverImpl(token, slideToken);
+ retriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
String slidePath = null;
allpropIncludesDeltav = getBooleanInitParameter( "allpropIncludesDeltav" );
@@ -179,7 +179,7 @@
searchQuery = searchHelper.createSearchQuery
(grammarNamespace, queryElement, slideToken, maxDepth,
- new ComputedPropertyProvider(token, slideToken, req.getContextPath (), serverURL),
+ new ComputedPropertyProvider(token, slideToken, req.getContextPath (), serverURL, getConfig()),
req.getRequestURI ());
requestedProperties = searchQuery.requestedProperties ();
1.14 +4 -4 jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java
Index: UpdateMethod.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- UpdateMethod.java 12 Aug 2002 12:55:02 -0000 1.13
+++ UpdateMethod.java 14 Feb 2003 14:34:35 -0000 1.14
@@ -173,7 +173,7 @@
slideToken, token, req, resp, getConfig() );
readRequestContent();
serverUri = req.getServerName() + ":" + req.getServerPort();
- propertyRetriever = new PropertyRetrieverImpl(token, slideToken);
+ propertyRetriever = new PropertyRetrieverImpl(token, slideToken, getConfig());
resourcePath = requestUri;
if (resourcePath == null) {
1.14 +34 -33 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/AclConstants.java
Index: AclConstants.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/AclConstants.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AclConstants.java 23 Jul 2002 12:38:11 -0000 1.13
+++ AclConstants.java 14 Feb 2003 14:34:36 -0000 1.14
@@ -115,46 +115,47 @@
static String R_PRINCIPAL_SEARCH_PROPERTY_SET = "principal-search-property-set";
/** XML Elements */
+ static String E_ACE = "ace";
+ static String E_ACE_COMBINATION = "ace-combination";
+ static String E_ACL = "acl";
+ static String E_ALL = "all";
+ static String E_ALL_GRANT_BEFORE_DENY = "all-grant-before-any-deny";
+ static String E_CASELESS_SUBSTRING = "caseless-substring";
+ static String E_CREATE_OBJECT = "create-object";
+ static String E_CREATE_REVISION_CONTENT = "create-revision-content";
+ static String E_CREATE_REVISION_METADATA = "create-revision-metadata";
+ static String E_DENY = "deny";
+ static String E_DESCRIPTION = "description";
+ static String E_GRANT = "grant";
+ static String E_GRANT_PERMISSION = "grant-premission";
+ static String E_INHERITED = "inherited";
+ static String E_LOCK_OBJECT = "lock-object";
+ static String E_MODIFY_REVISION_CONTENT = "modify-revision-content";
+ static String E_MODIFY_REVISION_METADATA = "modify-revision-metadata";
+ static String E_NON_SEARCHABLE_PROPERTY = "non-searchable-property";
+ static String E_PRINCIPAL_COLLECTION_SET = "principal-collection-set";
static String E_PRINCIPAL_PROPERTY = "principal-property";
- static String E_SELF = "self";
static String E_PRINCIPAL_SEARCH_PROPERTY = "principal-search-property";
- static String E_DESCRIPTION = "description";
- static String E_PROPERTY_SEARCH = "property-search";
- static String E_CASELESS_SUBSTRING = "caseless-substring";
- static String E_SUBSTRING = "substring";
- static String E_ALL = "all";
- static String E_SUPPORTED_PRIVILEGE = "supported-privilege";
+ static String E_PRINCIPAL_URL = "principal-URL";
static String E_PRIVILEGE = "privilege";
+ static String E_PROPERTY_SEARCH = "property-search";
+ static String E_PROTECTED = "protected";
static String E_READ = "read";
static String E_READ_ACL = "read-acl";
- static String E_WRITE_ACL = "write-acl";
- static String E_ACL = "acl";
- static String E_ACE = "ace";
- static String E_DENY = "deny";
- static String E_GRANT = "grant";
- static String E_READ_OBJECT = "read-object";
static String E_READ_LOCKS = "read-locks";
- static String E_READ_REVISION_METADATA = "read-revision-metadata";
- static String E_CREATE_REVISION_METADATA = "create-revision-metadata";
- static String E_MODIFY_REVISION_METADATA = "modify-revision-metadata";
- static String E_REMOVE_REVISION_METADATA = "remove-revision-metadata";
+ static String E_READ_OBJECT = "read-object";
static String E_READ_REVISION_CONTENT = "read-revision-content";
- static String E_CREATE_REVISION_CONTENT = "create-revision-content";
- static String E_MODIFY_REVISION_CONTENT = "modify-revision-content";
- static String E_REMOVE_REVISION_CONTENT = "remove-revision-content";
- static String E_CREATE_OBJECT = "create-object";
+ static String E_READ_REVISION_METADATA = "read-revision-metadata";
static String E_REMOVE_OBJECT = "remove-object";
- static String E_LOCK_OBJECT = "lock-object";
- static String E_GRANT_PERMISSION = "grant-premission";
- static String E_REVOKE_PERMISSION = "revoke-premission";
- static String E_PROTECTED = "protected";
- static String E_INHERITED = "inherited";
- static String E_ACE_COMBINATION = "ace-combination";
- static String E_ALL_GRANT_BEFORE_DENY = "all-grant-before-any-deny";
+ static String E_REMOVE_REVISION_CONTENT = "remove-revision-content";
+ static String E_REMOVE_REVISION_METADATA = "remove-revision-metadata";
static String E_REQUIRED_PRINCIPAL = "required-principal";
- static String E_PRINCIPAL_COLLECTION_SET = "principal-collection-set";
- static String E_NON_SEARCHABLE_PROPERTY = "non-searchable-property";
+ static String E_REVOKE_PERMISSION = "revoke-premission";
+ static String E_SELF = "self";
+ static String E_SUBSTRING = "substring";
+ static String E_SUPPORTED_PRIVILEGE = "supported-privilege";
static String E_UNAUTHENTICATED = "unauthenticated";
+ static String E_WRITE_ACL = "write-acl";
/** XML Attributes */
1.3 +17 -17 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/ComputedPropertyProvider.java
Index: ComputedPropertyProvider.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/ComputedPropertyProvider.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ComputedPropertyProvider.java 21 Jun 2002 08:09:11 -0000 1.2
+++ ComputedPropertyProvider.java 14 Feb 2003 14:34:37 -0000 1.3
@@ -63,28 +63,23 @@
package org.apache.slide.webdav.util;
// import list
-import org.apache.slide.common.SlideToken;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
import org.apache.slide.common.NamespaceAccessToken;
-import org.apache.slide.common.SlideException;
-import org.apache.slide.common.NestedSlideException;
import org.apache.slide.common.PropertyName;
-
+import org.apache.slide.common.SlideException;
+import org.apache.slide.common.SlideToken;
import org.apache.slide.content.Content;
import org.apache.slide.content.NodeProperty;
import org.apache.slide.content.NodeProperty.NamespaceCache;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
-
import org.apache.slide.search.PropertyProvider;
-
+import org.apache.slide.webdav.WebdavServletConfig;
import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
import org.apache.slide.webdav.util.resourcekind.ResourceKind;
-
-import java.util.Iterator;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-
import org.jdom.JDOMException;
/**
@@ -150,8 +145,13 @@
* @param contextPath the context path of the request.
* @param serverURL the server URL of the request.
*/
+ public ComputedPropertyProvider(NamespaceAccessToken nsaToken, SlideToken slideToken, String contextPath, String serverURL, WebdavServletConfig sConf) {
+ this(nsaToken, slideToken, PropertyHelper.getPropertyHelper(slideToken, nsaToken, sConf), contextPath, serverURL);
+ }
+
+ /** @deprecated */
public ComputedPropertyProvider(NamespaceAccessToken nsaToken, SlideToken slideToken, String contextPath, String serverURL) {
- this(nsaToken, slideToken, new PropertyHelper(slideToken, nsaToken), contextPath, serverURL);
+ this(nsaToken, slideToken, PropertyHelper.getPropertyHelper(slideToken, nsaToken, null), contextPath, serverURL);
}
/**
1.42 +56 -6 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java
Index: PropertyHelper.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyHelper.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- PropertyHelper.java 23 Oct 2002 06:55:42 -0000 1.41
+++ PropertyHelper.java 14 Feb 2003 14:34:37 -0000 1.42
@@ -105,6 +105,8 @@
import org.apache.slide.structure.ObjectNotFoundException;
import org.apache.slide.structure.Structure;
import org.apache.slide.structure.SubjectNode;
+import org.apache.slide.webdav.WebdavServletConfig;
+import org.apache.slide.webdav.method.LockMethod;
import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
import org.apache.slide.webdav.util.resourcekind.Activity;
import org.apache.slide.webdav.util.resourcekind.CheckedInVersionControlled;
@@ -115,10 +117,12 @@
import org.apache.slide.webdav.util.resourcekind.VersionHistory;
import org.apache.slide.webdav.util.resourcekind.Workspace;
import org.jdom.Attribute;
+import org.jdom.CDATA;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Namespace;
+import org.jdom.input.SAXBuilder;
/**
@@ -138,6 +142,11 @@
public final static String DEFAULT_CHECKIN_FORK =
Domain.getParameter( I_CHECKIN_FORK, I_CHECKIN_FORK_DEFAULT );
+ public final static String LOCKDISCOVERY_INCL_PRINCIPAL =
+ "lockdiscoveryIncludesPrincipalURL";
+
+ private boolean lockdiscoveryIncludesPrincipalURL = true;
+
/**
* The Element returned by {@link #getCheckoutSetQueryElement
* getCheckoutSetQueryElement()}.
@@ -162,22 +171,37 @@
*/
protected Element workspaceCheckoutSetQueryHrefElement = null;
+ private WebdavServletConfig sConf = null;
+
/**
* Factory method.
+ * @deprecated
*/
public static PropertyHelper
getPropertyHelper( SlideToken sToken, NamespaceAccessToken nsaToken) {
- return new PropertyHelper( sToken, nsaToken );
+ return new PropertyHelper( sToken, nsaToken, null );
+ }
+
+ /**
+ * Factory method.
+ */
+ public static PropertyHelper
+ getPropertyHelper( SlideToken sToken, NamespaceAccessToken nsaToken, WebdavServletConfig sConf ) {
+ return new PropertyHelper( sToken, nsaToken, sConf );
}
/**
* Protected contructor
*/
- protected PropertyHelper( SlideToken sToken, NamespaceAccessToken nsaToken ) {
+ protected PropertyHelper( SlideToken sToken, NamespaceAccessToken nsaToken, WebdavServletConfig sConf ) {
super( sToken, nsaToken );
+ this.sConf = sConf;
+ if( sConf != null )
+ lockdiscoveryIncludesPrincipalURL =
+ !("false".equalsIgnoreCase(sConf.getInitParameter(LOCKDISCOVERY_INCL_PRINCIPAL)));
}
/**
@@ -1247,7 +1271,20 @@
* contain. The webdav RFC leaves us completely free to
* put whatever we want inside the owner element.
*/
- owner.setText(getAbsoluteURL(serverURL, contextPath, objectLockToken.getSubjectUri()));
+ if( objectLockToken.getOwnerInfo() != null &&
+ !objectLockToken.getOwnerInfo().equals(LockMethod.DEFAULT_LOCK_OWNER) ) {
+
+ // try to parse
+ try {
+ Document d =
+ new SAXBuilder().build( new StringReader(objectLockToken.getOwnerInfo()) );
+ owner.addContent(d.getRootElement());
+ }
+ catch( Throwable e ) {
+ owner.addContent(new CDATA(objectLockToken.getOwnerInfo()));
+ }
+ }
+
Element timeout = new Element(E_TIMEOUT, NamespaceCache.DEFAULT_NAMESPACE);
activelock.addContent(timeout);
timeout.setText("Second-"
@@ -1259,6 +1296,17 @@
Element href = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
locktoken.addContent(href);
href.setText("opaquelocktoken:" + objectLockToken.getLockId());
+
+ // As proposed on February 08, 2003 by Lisa Dusseault in w3c-dist-auth-request@w3.org
+ // >>>>>>>>>> start principal-URL >>>>>>>>>>>>
+ if( lockdiscoveryIncludesPrincipalURL ) {
+ Element principalUrl = new Element( E_PRINCIPAL_URL, NamespaceCache.DEFAULT_NAMESPACE);
+ activelock.addContent(principalUrl);
+ Element puhref = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
+ principalUrl.addContent(puhref);
+ puhref.setText(getAbsoluteURL(serverURL, contextPath, objectLockToken.getSubjectUri()));
+ }
+ // <<<<<<<<<< end principal-URL <<<<<<<<<<<<<<
}
return activelock;
}
@@ -2148,4 +2196,6 @@
}
}
+
+
1.26 +35 -54 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java
Index: PropertyRetrieverImpl.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- PropertyRetrieverImpl.java 23 Sep 2002 13:28:54 -0000 1.25
+++ PropertyRetrieverImpl.java 14 Feb 2003 14:34:37 -0000 1.26
@@ -63,65 +63,35 @@
package org.apache.slide.webdav.util;
// import list
-import org.apache.util.WebdavStatus;
-
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import org.apache.slide.common.NamespaceAccessToken;
-import org.apache.slide.common.SlideToken;
-import org.apache.slide.common.RequestedProperty;
+import org.apache.slide.common.PropertyName;
import org.apache.slide.common.RequestedProperties;
-import org.apache.slide.common.ServiceAccessException;
-import org.apache.slide.common.NamespaceConfig;
+import org.apache.slide.common.RequestedProperty;
import org.apache.slide.common.SlideException;
-import org.apache.slide.common.PropertyName;
-
-import org.apache.slide.security.Security;
-import org.apache.slide.security.AccessDeniedException;
-import org.apache.slide.security.NodePermission;
-
-import org.apache.slide.structure.Structure;
-import org.apache.slide.structure.ObjectNode;
-import org.apache.slide.structure.LinkedObjectNotFoundException;
-import org.apache.slide.structure.ObjectNotFoundException;
-import org.apache.slide.structure.ObjectAlreadyExistsException;
-
-import org.apache.slide.search.RequestedResource;
-
-import org.apache.slide.lock.Lock;
-import org.apache.slide.lock.LockTokenNotFoundException;
-import org.apache.slide.lock.ObjectLockedException;
-import org.apache.slide.lock.NodeLock;
-
+import org.apache.slide.common.SlideToken;
import org.apache.slide.content.Content;
-import org.apache.slide.content.RevisionDescriptorNotFoundException;
+import org.apache.slide.content.NodeProperty;
+import org.apache.slide.content.NodeProperty.NamespaceCache;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
import org.apache.slide.content.NodeRevisionNumber;
-import org.apache.slide.content.NodeProperty;
-import org.apache.slide.content.NodeProperty.NamespaceCache;
-
-import org.apache.slide.macro.Macro;
-import org.apache.slide.macro.ConflictException;
-import org.apache.slide.macro.ForbiddenException;
-
-import org.apache.slide.webdav.util.resourcekind.ResourceKind;
-import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
-
-import java.util.Vector;
-import java.util.Iterator;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-
-import org.jdom.Document;
+import org.apache.slide.content.RevisionDescriptorNotFoundException;
+import org.apache.slide.lock.Lock;
+import org.apache.slide.search.RequestedResource;
+import org.apache.slide.security.AccessDeniedException;
+import org.apache.slide.security.Security;
+import org.apache.slide.structure.Structure;
+import org.apache.slide.webdav.WebdavServletConfig;
+import org.apache.util.WebdavStatus;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.Namespace;
-import org.jdom.input.SAXBuilder;
-
/**
* This class is used to retrieve the properties of a resource as a
@@ -169,7 +139,7 @@
* @param token the NamespaceAccessToken used to access the helpers.
* @param slideToken the SlideToken used to retrieve the NodeRevisionDescriptor(s).
*/
- public PropertyRetrieverImpl(NamespaceAccessToken token, SlideToken slideToken) {
+ public PropertyRetrieverImpl(NamespaceAccessToken token, SlideToken slideToken, WebdavServletConfig sConf) {
super(slideToken, token);
this.structure = token.getStructureHelper();
@@ -177,7 +147,18 @@
this.security = token.getSecurityHelper();
this.lock = token.getLockHelper();
- propertyHelper = new PropertyHelper(slideToken, token);
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, sConf);
+ }
+
+ /** deprecated */
+ public PropertyRetrieverImpl(NamespaceAccessToken token, SlideToken slideToken) {
+ super(slideToken, token);
+ this.structure = token.getStructureHelper();
+ this.content = token.getContentHelper();
+ this.security = token.getSecurityHelper();
+ this.lock = token.getLockHelper();
+
+ propertyHelper = PropertyHelper.getPropertyHelper(slideToken, token, null);
}
/**
1.84 +5 -5 jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java
Index: VersioningHelper.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- VersioningHelper.java 27 Nov 2002 13:15:48 -0000 1.83
+++ VersioningHelper.java 14 Feb 2003 14:34:37 -0000 1.84
@@ -189,7 +189,7 @@
this.structure = nsaToken.getStructureHelper();
this.macro = nsaToken.getMacroHelper();
this.lock = nsaToken.getLockHelper();
- this.pHelp = PropertyHelper.getPropertyHelper( sToken,nsaToken );
+ this.pHelp = PropertyHelper.getPropertyHelper( sToken, nsaToken, sConf );
ActionNode actionNode = nsaToken.getNamespaceConfig().getModifyRevisionMetadataAction();
if (actionNode != null) {
modifyMetadataUri = actionNode.getUri();
@@ -981,7 +981,7 @@
}
// check if the version is already checked out
- PropertyHelper propertyHelper = new PropertyHelper(sToken, nsaToken);
+ PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(sToken, nsaToken, sConf);
NodeProperty checkoutSetProp = propertyHelper.getProperty(P_CHECKOUT_SET, cinNrds, cinNrd, req.getContextPath(), null);
if( checkoutSetProp != null && checkoutSetProp.getValue() != null ) {
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org