You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2015/03/05 18:21:10 UTC
svn commit: r1664426 - in /chemistry/opencmis/trunk:
chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/...
Author: fmui
Date: Thu Mar 5 17:21:10 2015
New Revision: 1664426
URL: http://svn.apache.org/r1664426
Log:
CMIS-897: added getContentUrl() methods to Document and Rendition interfaces
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Thu Mar 5 17:21:10 2015
@@ -221,6 +221,14 @@ public abstract class AbstractAtomPubSer
}
/**
+ * Gets a rendition content link from the cache if it is there or loads it
+ * into the cache if it is not there.
+ */
+ public String loadRenditionContentLink(String repositoryId, String id, String streamId) {
+ return loadLink(repositoryId, id, Constants.REL_ALTERNATE, streamId);
+ }
+
+ /**
* Adds a link to the cache.
*/
protected void addLink(String repositoryId, String id, String rel, String type, String link) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Document.java Thu Mar 5 17:21:10 2015
@@ -105,6 +105,35 @@ public interface Document extends Fileab
ContentStream getContentStream(String streamId, BigInteger offset, BigInteger length);
/**
+ * Returns the content URL of the document if the binding supports content
+ * URLs.
+ *
+ * Depending on the repository and the binding, the server might not return
+ * the content but an error message. Authentication data is not attached.
+ * That is, a user may have to re-authenticate to get the content.
+ *
+ * @return the content URL of the document or {@code null} if the binding
+ * does not support content URLs
+ */
+ public String getContentUrl();
+
+ /**
+ * Returns the content URL of the document or a rendition if the binding
+ * supports content URLs.
+ *
+ * Depending on the repository and the binding, the server might not return
+ * the content but an error message. Authentication data is not attached.
+ * That is, a user may have to re-authenticate to get the content.
+ *
+ * @param streamId
+ * the ID of the rendition or {@code null} for the document
+ *
+ * @return the content URL of the document or rendition or {@code null} if
+ * the binding does not support content URLs
+ */
+ public String getContentUrl(String streamId);
+
+ /**
* Sets a new content stream for the document and refreshes this object
* afterwards. If the repository created a new version, this new document is
* returned. Otherwise the current document is returned.
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Rendition.java Thu Mar 5 17:21:10 2015
@@ -77,4 +77,17 @@ public interface Rendition extends Rendi
* rendition has no content
*/
ContentStream getContentStream();
+
+ /**
+ * Returns the content URL of the rendition if the binding supports content
+ * URLs.
+ *
+ * Depending on the repository and the binding, the server might not return
+ * the content but an error message. Authentication data is not attached.
+ * That is, a user may have to re-authenticate to get the content.
+ *
+ * @return the content URL of the rendition or {@code null} if the binding
+ * does not support content URLs
+ */
+ String getContentUrl();
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LinkAccess.java Thu Mar 5 17:21:10 2015
@@ -35,4 +35,10 @@ public interface LinkAccess {
* cache if it is not there.
*/
String loadContentLink(String repositoryId, String documentId);
+
+ /**
+ * Gets a rendition content link from the cache if it is there or loads it
+ * into the cache if it is not there.
+ */
+ String loadRenditionContentLink(String repositoryId, String documentId, String streamId);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Thu Mar 5 17:21:10 2015
@@ -223,6 +223,14 @@ public abstract class AbstractAtomPubSer
}
/**
+ * Gets a rendition content link from the cache if it is there or loads it
+ * into the cache if it is not there.
+ */
+ public String loadRenditionContentLink(String repositoryId, String id, String streamId) {
+ return loadLink(repositoryId, id, Constants.REL_ALTERNATE, streamId);
+ }
+
+ /**
* Adds a link to the cache.
*/
protected void addLink(String repositoryId, String id, String rel, String type, String link) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java Thu Mar 5 17:21:10 2015
@@ -510,4 +510,14 @@ public abstract class AbstractBrowserBin
UrlBuilder result = getRepositoryUrlCache().getObjectUrl(repositoryId, documentId, Constants.SELECTOR_CONTENT);
return result == null ? null : result.toString();
}
+
+ public String loadRenditionContentLink(String repositoryId, String documentId, String streamId) {
+ UrlBuilder result = getRepositoryUrlCache().getObjectUrl(repositoryId, documentId, Constants.SELECTOR_CONTENT);
+ if (result != null) {
+ result.addParameter(Constants.PARAM_STREAM_ID, streamId);
+ return result.toString();
+ }
+
+ return null;
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/DocumentImpl.java Thu Mar 5 17:21:10 2015
@@ -18,7 +18,7 @@
*/
package org.apache.chemistry.opencmis.client.runtime;
-import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
import java.io.IOException;
import java.io.InputStream;
@@ -38,6 +38,7 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.client.api.OperationContext;
import org.apache.chemistry.opencmis.client.api.Policy;
import org.apache.chemistry.opencmis.client.api.Property;
+import org.apache.chemistry.opencmis.client.bindings.spi.LinkAccess;
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.Ace;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
@@ -375,6 +376,24 @@ public class DocumentImpl extends Abstra
contentStream.getStream(), contentStream instanceof PartialContentStream);
}
+ public String getContentUrl() {
+ return getContentUrl(null);
+ }
+
+ public String getContentUrl(String streamId) {
+ if (getBinding().getObjectService() instanceof LinkAccess) {
+ LinkAccess linkAccess = (LinkAccess) getBinding().getObjectService();
+
+ if (streamId == null) {
+ return linkAccess.loadContentLink(getRepositoryId(), getId());
+ } else {
+ return linkAccess.loadRenditionContentLink(getRepositoryId(), getId(), streamId);
+ }
+ }
+
+ return null;
+ }
+
public Document setContentStream(ContentStream contentStream, boolean overwrite) {
ObjectId objectId = setContentStream(contentStream, overwrite, true);
if (objectId == null) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java?rev=1664426&r1=1664425&r2=1664426&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/RenditionImpl.java Thu Mar 5 17:21:10 2015
@@ -25,6 +25,7 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.client.api.OperationContext;
import org.apache.chemistry.opencmis.client.api.Rendition;
import org.apache.chemistry.opencmis.client.api.Session;
+import org.apache.chemistry.opencmis.client.bindings.spi.LinkAccess;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
@@ -110,4 +111,12 @@ public class RenditionImpl extends Rendi
contentStream.getStream());
}
+ public String getContentUrl() {
+ if (session.getBinding().getObjectService() instanceof LinkAccess) {
+ LinkAccess linkAccess = (LinkAccess) session.getBinding().getObjectService();
+ return linkAccess.loadRenditionContentLink(session.getRepositoryInfo().getId(), objectId, getStreamId());
+ }
+
+ return null;
+ }
}