juergen 02/04/30 01:45:41
Modified: src/webdav/server/org/apache/slide/webdav/util
VersioningHelper.java
Log:
Removed retrieveLatestRevisionDescriptor() signature that takes a label as
additional parameter.
Added method getLabeledResourceUri() as a replacement.
(ralf)
Revision Changes Path
1.40 +60 -51
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.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- VersioningHelper.java 29 Apr 2002 16:51:08 -0000 1.39
+++ VersioningHelper.java 30 Apr 2002 08:45:41 -0000 1.40
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.39 2002/04/29 16:51:08 pnever Exp $
- * $Revision: 1.39 $
- * $Date: 2002/04/29 16:51:08 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
1.40 2002/04/30 08:45:41 juergen Exp $
+ * $Revision: 1.40 $
+ * $Date: 2002/04/30 08:45:41 $
*
* ====================================================================
*
@@ -230,23 +230,27 @@
}
/**
- * Retrieve the latest DeltaV-compliant NRD instance for the specified
- * resource path and associated to the specified NRDS instance.
+ * Returns slide Uri determinating the NodeRevisionDescriptors and
+ * NodeRevisionDescriptor associated with the given <code>resourcePath</code>.
+ * If the given <code>label</code> is not <code>null</code>, and the
+ * <code>resourcePath</code> identifies a VCR, the revision with that label
+ * of the associated history is returned.
*
* @param resourcePath the path of the resource for which to retrieve
- * the NRD.
- * @param rNrds the NodeRevisionDescriptors of the resource.
- * @param label if the <code>label</code> is not null and the
- * <code>resourcePath</code> identifies a VCR,
- * the associated revision with that label is
returned.
+ * the SlideResource.
+ * @param label the label of the revision to return. May be
+ * <code>null</code>.
+ *
+ * @return slide Uri determinating the NodeRevisionDescriptors and
+ * NodeRevisionDescriptor associated with the given
+ * <code>resourcePath</code>.
*
- * @return the latest DeltaV-compliant NRD instance for the specified
- * resource path and associated to the specified NRDS instance.
+ * @throws SlideException
+ * @throws LabeledRevisionNotFoundException if no revision with the
specified
+ * label was found.
*/
- public NodeRevisionDescriptor
- retrieveLatestRevisionDescriptor( String resourcePath,
NodeRevisionDescriptors rNrds, String label) throws SlideException {
-
- return retrieveLatestRevisionDescriptor(nsaToken, sToken, content,
resourcePath, rNrds, label);
+ public String getLabeledResourceUri(String resourcePath, String label) throws
SlideException, LabeledRevisionNotFoundException {
+ return getLabeledResourceUri(nsaToken, sToken, content, resourcePath,
label);
}
/**
@@ -621,7 +625,6 @@
}
if( rRk instanceof CheckedInVersionControlled ) {
-
// get checked-in VR
NodeProperty cinProp = rNrd.getProperty( P_CHECKED_IN );
String cinHref = getElementValue((String)cinProp.getValue());
@@ -1617,32 +1620,6 @@
Content
content,
String
resourcePath,
NodeRevisionDescriptors rNrds) throws SlideException {
- return retrieveLatestRevisionDescriptor(nsaToken, sToken, content,
resourcePath, rNrds, null);
- }
-
- /**
- * Retrieve the latest DeltaV-compliant NRD instance for the specified
- * resource path and associated to the specified NRDS instance.
- *
- * @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
- * the NRD.
- * @param rNrds the NodeRevisionDescriptors of the resource.
- * @param label if the <code>label</code> is not null and the
- * <code>resourcePath</code> identifies a VCR,
- * the associated revision with that label is
returned.
- *
- * @return the latest DeltaV-compliant NRD instance for the specified
- * resource path and associated to the specified NRDS instance.
- */
- public static NodeRevisionDescriptor
retrieveLatestRevisionDescriptor(NamespaceAccessToken nsaToken,
-
SlideToken sToken,
- Content
content,
- String
resourcePath,
-
NodeRevisionDescriptors rNrds,
- String
label) throws SlideException {
NodeRevisionDescriptor rNrd = null;
UriHandler rUh = UriHandler.getUriHandler( nsaToken, resourcePath );
@@ -1657,19 +1634,51 @@
}
else {
rNrd = content.retrieve( sToken, rNrds );
- if (label != null) {
- // retrieve labeled revision
- String vrUri = getUriOfAssociatedVR(nsaToken, sToken, content,
resourcePath);
- if (vrUri == null) {
- throw new LabeledRevisionNotFoundException(resourcePath, label);
}
+ return rNrd;
+ }
+
+ /**
+ * Returns slide Uri determinating the NodeRevisionDescriptors and
+ * NodeRevisionDescriptor associated with the given <code>resourcePath</code>.
+ * If the given <code>label</code> is not <code>null</code>, and the
+ * <code>resourcePath</code> identifies a VCR, the revision with that label
+ * of the associated history 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
+ * the SlideResource.
+ * @param label the label of the revision to return. May be
+ * <code>null</code>.
+ *
+ * @return slide Uri determinating the NodeRevisionDescriptors and
+ * NodeRevisionDescriptor associated with the given
+ * <code>resourcePath</code>.
+ *
+ * @throws SlideException
+ * @throws LabeledRevisionNotFoundException if no revision with the
specified
+ * label was found.
+ */
+ public static String getLabeledResourceUri(NamespaceAccessToken nsaToken,
SlideToken sToken, Content content, String resourcePath, String label) throws
SlideException, LabeledRevisionNotFoundException {
+
+ NodeRevisionDescriptors revisionDescriptors =
+ retrieveRevisionDescriptors(nsaToken, sToken, content, resourcePath);
+ NodeRevisionDescriptor revisionDescriptor =
+ retrieveLatestRevisionDescriptor(nsaToken, sToken, content,
resourcePath, revisionDescriptors);
+ ResourceKind resourceKind =
AbstractResourceKind.determineResourceKind(revisionDescriptor);
+
+ if ( (resourceKind instanceof VersionControlled) && (label != null) ) {
+ String vrUri = getUriOfAssociatedVR(nsaToken, sToken, content,
revisionDescriptors.getUri());
UriHandler vrUriHandler = UriHandler.getUriHandler(nsaToken, vrUri);
String historyUri = vrUriHandler.getAssociatedHistoryUri();
- rNrd = retrieveLabeledRevision(nsaToken, sToken, content,
historyUri, label);
+ revisionDescriptors = retrieveRevisionDescriptors(nsaToken, sToken,
content, historyUri);
+ revisionDescriptor = retrieveLabeledRevision(nsaToken, sToken, content,
historyUri, label);
}
+ return getUri(nsaToken, sToken, content, revisionDescriptors,
revisionDescriptor);
}
- return rNrd;
- }
+
/**
* If the <code>resourcePath</code> identifies a VHR, the associated revision
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>