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 2004/06/16 15:00:28 UTC
cvs commit: jakarta-slide/proposals/wvcm/src/javax/wvcm PropertyNameList.java
pnever 2004/06/16 06:00:28
Modified: proposals/wvcm/src/org/apache/wvcm/store/webdav
ResourceWebdavAccessor.java
proposals/wvcm/src/org/apache/wvcm/store/webdav/response
ResourceProxyFactory.java
proposals/wvcm/src/org/apache/wvcm/store/webdav/request
ReportRequest.java
proposals/wvcm/src/javax/wvcm PropertyNameList.java
Log:
NOT YET STANDARD extension
Added constant EMPTY_DO_NOT_DETERMINE_RESOURCETYPE of type
PropertyNameList to allow quicker doReadContent() requests.
If doReadContent() is called with wantedProperties = EMPTY_DO_NOT_DETERMINE_RESOURCETYPE,
an extra doReadProperties() is save which normally is needed to read the
default proprties required for resourcetype determination.
Revision Changes Path
1.13 +19 -10 jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/ResourceWebdavAccessor.java
Index: ResourceWebdavAccessor.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/ResourceWebdavAccessor.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ResourceWebdavAccessor.java 8 Dec 2003 17:14:22 -0000 1.12
+++ ResourceWebdavAccessor.java 16 Jun 2004 13:00:28 -0000 1.13
@@ -68,9 +68,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import javax.wvcm.AccessControlElement.Privilege;
import javax.wvcm.LockToken;
-import javax.wvcm.Principal;
import javax.wvcm.PropertyNameList;
import javax.wvcm.PropertyNameList.AttributeName;
import javax.wvcm.PropertyNameList.PropertyName;
@@ -115,6 +113,7 @@
import org.apache.wvcm.store.webdav.response.NoProptatMultistatusResponse.ResourceStatus;
import org.apache.wvcm.store.webdav.response.ProppatchMultistatusResponse;
import org.apache.wvcm.store.webdav.response.ProppatchMultistatusResponse.Propstat;
+import org.apache.wvcm.store.webdav.response.ResourceProxyFactory;
import org.apache.wvcm.util.PropertyNameLists;
@@ -217,9 +216,19 @@
method.releaseConnection();
}
- Resource result = doReadProperties( wantedPropertyList );
- if( PropertyNameLists.contains(wantedPropertyList, PropertyName.CONTENT_CHARACTER_SET.getString()) )
- result.setContentCharacterSet( contentCharset );
+ Resource result;
+ if (wantedPropertyList == PropertyNameList.EMPTY_DO_NOT_DETERMINE_RESOURCETYPE) {
+ // PERFORMANCE:
+ // This is to save the extra roundtrip (doReadProperties) to the server.
+ // The exact resourcetype is not determined. Instead, a new resource proxy
+ // of the same resourcetype as the request resource is returned
+ return new ResourceProxyFactory(resource, providerImpl, null).create(resource.location(), resource.getClass(), null);
+ }
+ else {
+ result = doReadProperties( wantedPropertyList );
+ if( PropertyNameLists.contains(wantedPropertyList, PropertyName.CONTENT_CHARACTER_SET.getString()) )
+ result.setContentCharacterSet( contentCharset );
+ }
return result;
}
@@ -486,7 +495,7 @@
method.releaseConnection();
}
}
-
+
protected Exception[] getNestedExceptions(List rsL) {
Exception[] nestedExceptions = new Exception[rsL.size()];
for (int i = 0; i < rsL.size(); i++) {
1.3 +48 -7 jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/response/ResourceProxyFactory.java
Index: ResourceProxyFactory.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/response/ResourceProxyFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResourceProxyFactory.java 9 Apr 2004 09:44:09 -0000 1.2
+++ ResourceProxyFactory.java 16 Jun 2004 13:00:28 -0000 1.3
@@ -111,6 +111,14 @@
private Provider provider;
private PropertyNameList wantedPropertyList;
+ /**
+ * Constructor
+ *
+ * @param requestResource a Resource
+ * @param provider a Provider
+ * @param wantedPropertyList a PropertyNameList
+ *
+ */
public ResourceProxyFactory(Resource requestResource, Provider provider, PropertyNameList wantedPropertyList) {
this.requestResource = requestResource;
this.provider = provider;
@@ -131,7 +139,7 @@
public Resource create( Element responseElm, Class resourceType ) throws WvcmException {
Map propertiesContainer = new HashMap();
Map webdavProperties = new HashMap();
-
+
// build the resource if not there
if (requestResource == null) {
LocationImpl loc = getLocation(responseElm);
@@ -231,11 +239,38 @@
return result;
}
+ /**
+ * Method create
+ *
+ * @param propertiesContainer a Map
+ * @param resourceType a Class
+ *
+ * @return a Resource
+ *
+ * @throws WvcmException
+ *
+ */
+ public Resource create(Location location, Class resourceType, Map propertiesContainer) throws WvcmException {
+ ResourceImpl result = (ResourceImpl)((LocationImpl)location).resource( resourceType );
+ if (propertiesContainer != null) {
+ result.setPropertyContainer( propertiesContainer );
+ }
+ return result;
+ }
+
+ /**
+ * Method isSubtypeOfPrincipalImpl
+ *
+ * @param cls a Class
+ *
+ * @return a boolean
+ *
+ */
private boolean isSubtypeOfPrincipalImpl( Class cls ) {
if (cls == PrincipalImpl.class)
return true;
else if (cls == null || cls == Object.class)
- return false;
+ return false;
else
return isSubtypeOfPrincipalImpl( cls.getSuperclass() );
}
@@ -245,7 +280,7 @@
*/
public Resource createAllAttributes(Element responseElm) throws WvcmException {
Map propertiesContainer = new HashMap();
-
+
// build the resource if not there
if (requestResource == null) {
LocationImpl loc = getLocation(responseElm);
@@ -275,6 +310,12 @@
return result;
}
+ /**
+ * Method setActiveIfOwner
+ *
+ * @param lockToken a LockToken
+ *
+ */
private void setActiveIfOwner(LockToken lockToken) {
ProviderImpl p = (ProviderImpl)provider;
String realm = (String)p.initParameter("realm");
1.2 +4 -5 jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/request/ReportRequest.java
Index: ReportRequest.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/src/org/apache/wvcm/store/webdav/request/ReportRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReportRequest.java 8 Dec 2003 17:14:21 -0000 1.1
+++ ReportRequest.java 16 Jun 2004 13:00:28 -0000 1.2
@@ -104,7 +104,6 @@
*/
public ExpandPropertyReportRequest( PropertyNameList pnameList ) {
Element exppropElm = new Element( "expand-property", dnsp );
-// createDefaultPropertyElements(exppropElm, pnameList);
createPropertyElements( exppropElm, pnameList );
setReqBodyDoc( new Document(exppropElm) );
}
1.9 +8 -0 jakarta-slide/proposals/wvcm/src/javax/wvcm/PropertyNameList.java
Index: PropertyNameList.java
===================================================================
RCS file: /home/cvs/jakarta-slide/proposals/wvcm/src/javax/wvcm/PropertyNameList.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PropertyNameList.java 8 Dec 2003 17:14:24 -0000 1.8
+++ PropertyNameList.java 16 Jun 2004 13:00:28 -0000 1.9
@@ -32,6 +32,8 @@
*/
public final class PropertyNameList {
+ public static PropertyNameList EMPTY_DO_NOT_DETERMINE_RESOURCETYPE = new PropertyNameList();
+
/**
* The name of a property of a persistent resource.
*/
@@ -370,6 +372,12 @@
// The array of property names for this PropertyNameList.
private PropertyName[] _propertyNames;
+
+ /**
+ * Private dummy constructor
+ */
+ private PropertyNameList() {
+ };
/**
* @param propertyNames An array of property names.
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org