juergen 02/04/29 05:10:07
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Method retrieveLabeledRevision() now expects a VHR Uri (instead of a VCR Uri).
(ralf)
Revision Changes Path
1.37 +33 -20
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.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- VersioningHelper.java 26 Apr 2002 13:56:13 -0000 1.36
+++ VersioningHelper.java 29 Apr 2002 12:10:07 -0000 1.37
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.36 2002/04/26 13:56:13 juergen Exp $
- * $Revision: 1.36 $
- * $Date: 2002/04/26 13:56:13 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.37 2002/04/29 12:10:07 juergen Exp $
+ * $Revision: 1.37 $
+ * $Date: 2002/04/29 12:10:07 $
*
* ====================================================================
*
@@ -250,18 +250,21 @@
}
/**
- * If the <code>resourcePath</code> identifies a VCR, the associated revision
+ * If the <code>resourcePath</code> identifies a VHR, the associated revision
* with the given <code>label</code> is returned. If the
<code>resourcePath</code>
- * does not identify a VCR or if no revision with the given <code>label</code>
- * is found, <code>null</code> is returned.
+ * does not identify a VHR , <code>null</code> is returned.
*
* @param resourcePath the path of the resource for which to retrieve
* the NRD.
* @param label the label of the revision to return.
*
* @return the associated revision with the given <code>label</code>.
+ *
+ * @throws SlideException
+ * @throws LabeledRevisionNotFoundException if no revision with the
specified
+ * label was found.
*/
- public NodeRevisionDescriptor retrieveLabeledRevision(String resourcePath,
String label) throws SlideException {
+ public NodeRevisionDescriptor retrieveLabeledRevision(String resourcePath,
String label) throws SlideException, LabeledRevisionNotFoundException {
return retrieveLabeledRevision(nsaToken, sToken, content, resourcePath,
label);
}
@@ -1559,37 +1562,43 @@
else {
rNrd = content.retrieve( sToken, rNrds );
if (label != null) {
- rNrd = retrieveLabeledRevision(nsaToken, sToken, content,
resourcePath, label);
+ // retrieve labeled revision
+ String vrUri = getUriOfAssociatedVR(nsaToken, sToken, content,
resourcePath);
+ if (vrUri == null) {
+ throw new LabeledRevisionNotFoundException(resourcePath, label);
+ }
+ UriHandler vrUriHandler = UriHandler.getUriHandler(nsaToken, vrUri);
+ String historyUri = vrUriHandler.getAssociatedHistoryUri();
+ rNrd = retrieveLabeledRevision(nsaToken, sToken, content,
historyUri, label);
}
}
-
return rNrd;
}
/**
- * If the <code>resourcePath</code> identifies a VCR, the associated revision
+ * If the <code>resourcePath</code> identifies a VHR, the associated revision
* with the given <code>label</code> is returned. If the
<code>resourcePath</code>
- * does not identify a VCR or if no revision with the given <code>label</code>
- * is found, <code>null</code> is returned.
+ * does not identify a VHR , <code>null</code> is returned.
*
* @param nsaToken the NamespaceAccessToken to use.
* @param sToken the SlideToken to use.
* @param content the Content helper to use.
- * @param resourcePath the path of the resource for which to retrieve
+ * @param historyUri the path of the resource for which to retrieve
* the NRD.
* @param label the label of the revision to return.
*
* @return the associated revision with the given <code>label</code>.
+ *
+ * @throws SlideException
+ * @throws LabeledRevisionNotFoundException if no revision with the
specified
+ * label was found.
*/
- public static NodeRevisionDescriptor
retrieveLabeledRevision(NamespaceAccessToken nsaToken, SlideToken sToken, Content
content, String resourcePath, String label) throws SlideException {
+ public static NodeRevisionDescriptor
retrieveLabeledRevision(NamespaceAccessToken nsaToken, SlideToken sToken, Content
content, String historyUri, String label) throws SlideException,
LabeledRevisionNotFoundException {
NodeRevisionDescriptor labeledRevision = null;
- String vrUri = getUriOfAssociatedVR(nsaToken, sToken, content,
resourcePath);
- if (vrUri != null) {
-
- UriHandler vrUriHandler = UriHandler.getUriHandler(nsaToken, vrUri);
- String historyUri = vrUriHandler.getAssociatedHistoryUri();
+ UriHandler historyUriHandler = UriHandler.getUriHandler(nsaToken,
historyUri);
+ if (historyUriHandler.isHistoryUri()) {
NodeRevisionDescriptors historyNrds =
retrieveRevisionDescriptors(nsaToken, sToken, content, historyUri);
NodeRevisionDescriptor historyNrd = content.retrieve(sToken,
historyNrds, new NodeRevisionNumber(0, 0));
NodeProperty versionSet = historyNrd.getProperty(P_VERSION_SET);
@@ -1599,6 +1608,8 @@
NodeProperty labelNameSetProperty = null;
String labelNameSetString = null;
Iterator versionSetIterator = versionSetValue.iterator();
+ String vrUri = null;
+ UriHandler vrUriHandler = null;
boolean found = false;
while ( !found && versionSetIterator.hasNext() ) {
vrUri = ((Element)versionSetIterator.next()).getText();
@@ -1620,7 +1631,9 @@
if (found) {
labeledRevision = vrNrd;
}
-
+ else {
+ throw new LabeledRevisionNotFoundException(historyUri, label);
+ }
}
catch (JDOMException e) {}
catch (IllegalArgumentException e) {}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>