luetzkendorf 2004/12/29 08:45:51
Modified: src/webdav/server/org/apache/slide/webdav/method
CopyMethod.java PropPatchMethod.java
Log:
Use of NodeProperty.isLiveProperty replaced by
ResourceKind.isSupportedLiveProperty.
"Live", "Protected", "Dead", "Computed" are concepts of the webdav layer and
should used there.
(The NodeProperty.kind is determined by a hack that queries the webdav layer
indirectly.
I would vote for removing this.)
Revision Changes Path
1.72 +1 -1
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.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- CopyMethod.java 21 Dec 2004 16:04:19 -0000 1.71
+++ CopyMethod.java 29 Dec 2004 16:45:51 -0000 1.72
@@ -315,7 +315,7 @@
* @return <code>true</code> if this is a live property to restore.
*/
private boolean isLivePropertyToRestore(String uri, NodeProperty
property) {
- boolean isLivePropertyToRestore = property.isLiveProperty() && (
+ boolean isLivePropertyToRestore = /*property.isLiveProperty() &&*/ (
DeltavConstants.DELTAV_PROPERTY_LIST.contains(property.getName()) ||
AclConstants.ACL_PROPERTY_LIST.contains(property.getName())
||
BindConstants.BIND_PROPERTY_LIST.contains(property.getName()) ||
1.88 +21 -22
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.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- PropPatchMethod.java 26 Oct 2004 20:06:00 -0000 1.87
+++ PropPatchMethod.java 29 Dec 2004 16:45:51 -0000 1.88
@@ -31,6 +31,7 @@
import java.util.StringTokenizer;
import org.apache.slide.common.NamespaceAccessToken;
+import org.apache.slide.common.PropertyName;
import org.apache.slide.common.PropertyParseException;
import org.apache.slide.common.RequestedPropertiesImpl;
import org.apache.slide.common.RequestedProperty;
@@ -435,36 +436,34 @@
* @param property The property object
* @param rd the revision descriptor containing all properties
* @param resourceKind the kind of the resource to patch.
+ * @return <code>true</code> if the property may be modified
*/
- private boolean checkPropertyModification(PropPatchProperty property,
NodeRevisionDescriptor rd, ResourceKind resourceKind) {
+ private boolean checkPropertyModification(PropPatchProperty property,
+ NodeRevisionDescriptor rd, ResourceKind resourceKind) {
- boolean result = false;
ViolatedPrecondition violatedPrecondition =
getPropertySpecificPreconditionViolation(property);
if (violatedPrecondition != null) {
property.setViolatedPrecondition(violatedPrecondition);
+ return false;
}
else {
- NodeProperty originalProperty =
rd.getProperty(property.getName(), property.getNamespace());
- if (originalProperty == null) {
- // computed properties can not be modified
- result =
(!AbstractResourceKind.isComputedProperty(property.getName()));
- }
- else {
- result = !originalProperty.isProtected();
- }
-
- if ( ! result ) {
- property.setErrorMessage("Property " +
property.getQualifiedNameAsElementString() + " is protected");
- }
-
- if ( result && !isSupportedPropertyValue(property, resourceKind)
) {
+ boolean modificationAllowed = false;
+
+ modificationAllowed = !resourceKind.isProtectedProperty(
+ PropertyName.getPropertyName(property.getName(),
property.getNamespace()));
+
+ if (!modificationAllowed) {
+ property.setErrorMessage("Property " +
+ property.getQualifiedNameAsElementString() + " is
protected");
+ } else if (!isSupportedPropertyValue(property, resourceKind)) {
property.setErrorMessage("Value " + property.getValue() + "
is not supported by property " + property.getQualifiedNameAsElementString());
- result = false;
+ modificationAllowed = false;
}
- if (!result) property.setStatusCode(WebdavStatus.SC_CONFLICT);
+ if (!modificationAllowed)
property.setStatusCode(WebdavStatus.SC_CONFLICT);
+
+ return modificationAllowed;
}
- return result;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]