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 wa...@apache.org on 2002/08/20 13:51:20 UTC
cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/util PropertyHelper.java VersioningHelper.java
wam 2002/08/20 04:51:20
Modified: src/webdav/server/org/apache/slide/webdav/method
MoveMethod.java
src/webdav/server/org/apache/slide/webdav/util
PropertyHelper.java VersioningHelper.java
Log:
use relative URIs for scope/href when creating SEARCH
Revision Changes Path
1.50 +7 -5 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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- MoveMethod.java 12 Aug 2002 12:55:02 -0000 1.49
+++ MoveMethod.java 20 Aug 2002 11:51:19 -0000 1.50
@@ -442,7 +442,9 @@
SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
basicSearch,
new SlideTokenWrapper(slideToken, false),
- Integer.MAX_VALUE);
+ Integer.MAX_VALUE,
+ req.getContextPath());
+
SearchQueryResult queryResult = searchHelper.search(new SlideTokenWrapper(slideToken, false), searchQuery);
Iterator queryResultIterator = queryResult.iterator();
@@ -505,7 +507,7 @@
Element href = new Element(E_HREF,
NamespaceCache.DEFAULT_NAMESPACE);
scope.addContent(href);
- href.setText("/");
+ href.setText("");
Element where = new Element(DaslConstants.E_WHERE,
NamespaceCache.DEFAULT_NAMESPACE);
1.32 +62 -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.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- PropertyHelper.java 7 Aug 2002 10:55:12 -0000 1.31
+++ PropertyHelper.java 20 Aug 2002 11:51:19 -0000 1.32
@@ -950,6 +950,7 @@
nsaToken.getContentHelper(),
revisionDescriptors,
revisionDescriptor);
+
Element basicSearch = getCheckoutSetQueryElement(resourcePath);
String grammarNamespace = basicSearch.getNamespaceURI();
@@ -957,7 +958,9 @@
SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
basicSearch,
new SlideTokenWrapper(sToken, false),
- Integer.MAX_VALUE);
+ Integer.MAX_VALUE,
+ contextPath);
+
SearchQueryResult queryResult = searchHelper.search(new SlideTokenWrapper(sToken,false), searchQuery);
Iterator queryResultIterator = queryResult.iterator();
RequestedResource requestedResource = null;
@@ -1001,7 +1004,11 @@
from.addContent(scope);
Element href = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
scope.addContent(href);
- href.setText("/");
+ href.setText("");
+ Iterator excludeIterator = getCheckoutSetExcludeList().iterator();
+ while (excludeIterator.hasNext()) {
+ scope.addContent((Element)excludeIterator.next());
+ }
Element where = new Element(DaslConstants.E_WHERE, NamespaceCache.DEFAULT_NAMESPACE);
checkoutSetQueryElement.addContent(where);
@@ -1017,6 +1024,35 @@
}
/**
+ ** Returns a List of <code><exclude></code> elements containing the
+ ** paths (e.g. the users path and the history paths) to exclude from the
+ ** search for checked-out resources in order to improve performance.
+ **
+ ** @pre true
+ ** @post true
+ **
+ ** @return a List of <code><exclude></code> elements.
+ **/
+ protected List getCheckoutSetExcludeList() {
+
+ List excludeList = new ArrayList();
+
+ String usersPath = truncateLeadingSlash(nsaToken.getNamespaceConfig().getUsersPath());
+ Element excludeElement = new Element(DaslConstants.E_EXCLUDE, NamespaceCache.SLIDE_NAMESPACE);
+ excludeElement.setText(usersPath);
+ excludeList.add(excludeElement);
+
+ Iterator historyPathIterator = HistoryPathHandler.getHistoryPathHandler().getResolvedHistoryPaths().iterator();
+ while (historyPathIterator.hasNext()) {
+ excludeElement = new Element(DaslConstants.E_EXCLUDE, NamespaceCache.SLIDE_NAMESPACE);
+ excludeElement.setText(truncateLeadingSlash(historyPathIterator.next().toString()));
+ excludeList.add(excludeElement);
+ }
+
+ return excludeList;
+ }
+
+ /**
* Returns an XMLValue containing <code><href></code> elements
* with the URI of the VCRs in the workspace identified the given
* NodeRevisionDescriptor(s) that have a <code><checked-out></code>.
@@ -1048,7 +1084,8 @@
SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
basicSearch,
new SlideTokenWrapper(sToken, false),
- Integer.MAX_VALUE);
+ Integer.MAX_VALUE,
+ contextPath);
SearchQueryResult queryResult = searchHelper.search(new SlideTokenWrapper(sToken,false), searchQuery);
Iterator queryResultIterator = queryResult.iterator();
RequestedResource requestedResource = null;
@@ -1929,6 +1966,7 @@
* @param serverURL the URL of the server
* @param contextPath the context path.
* @param uri the (slide-) URI of the resource.
+ *
* @return the concatenated URL.
*/
public static String getAbsoluteURL(String serverURL, String contextPath, String uri) {
@@ -2077,6 +2115,24 @@
}
}
+ /**
+ * Any leading <code>/</code> in the given <code>uri</code> will be removed.
+ *
+ * @param uri the Uri to remove leading slashes from.
+ *
+ * @return the Uri without leading slashes.
+ */
+ public static String truncateLeadingSlash(String uri) {
+
+ if (uri == null) {
+ return uri;
+ }
+
+ while (uri.startsWith("/")) {
+ uri = uri.substring(1);
+ }
+ return uri;
+ }
}
1.74 +13 -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.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- VersioningHelper.java 14 Aug 2002 10:56:05 -0000 1.73
+++ VersioningHelper.java 20 Aug 2002 11:51:19 -0000 1.74
@@ -508,6 +508,11 @@
*/
protected SearchQueryResult searchResourcesWithGivenHistory(String historyPath, String scope, int maxDepth) throws ServiceAccessException, BadQueryException {
+ // make it a relative scope
+ if (scope.startsWith("/")) {
+ scope = scope.substring (1);
+ }
+
Element basicSearch = getResourcesWithVersionHistoryQueryElement(scope,
historyPath);
String grammarNamespace = basicSearch.getNamespaceURI();
@@ -515,7 +520,9 @@
SearchQuery searchQuery = searchHelper.createSearchQuery(grammarNamespace,
basicSearch,
sToken,
- maxDepth);
+ maxDepth,
+ req.getRequestURI());
+
SearchQueryResult queryResult = searchHelper.search(sToken, searchQuery);
return queryResult;
}
@@ -952,7 +959,7 @@
// check if the version is already checked out
PropertyHelper propertyHelper = new PropertyHelper(sToken, nsaToken);
- XMLValue checkoutSetValue = propertyHelper.computeCheckoutSet(cinNrds, cinNrd);
+ XMLValue checkoutSetValue = propertyHelper.computeCheckoutSet(cinNrds, cinNrd, req.getContextPath(), null);
if (checkoutSetValue.iterator().hasNext()) {
// check precondition C_CHECKOUT_OF_CHECKED_OUT_VERSION_IS_FORBIDDEN
@@ -1943,6 +1950,7 @@
return uri.toString();
}
}
+
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>