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 2011/03/11 16:15:51 UTC

svn commit: r1080596 - in /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub: AbstractAtomPubService.java LinkAccess.java

Author: fmui
Date: Fri Mar 11 15:15:51 2011
New Revision: 1080596

URL: http://svn.apache.org/viewvc?rev=1080596&view=rev
Log:
CMIS-330: Allow access to AtomPub links

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkAccess.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java

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=1080596&r1=1080595&r2=1080596&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 Fri Mar 11 15:15:51 2011
@@ -73,7 +73,7 @@ import org.apache.chemistry.opencmis.com
 /**
  * Base class for all AtomPub clients.
  */
-public class AbstractAtomPubService {
+public class AbstractAtomPubService implements LinkAccess {
 
     protected enum IdentifierType {
         ID, PATH
@@ -154,7 +154,7 @@ public class AbstractAtomPubService {
      * Gets a link from the cache if it is there or loads it into the cache if
      * it is not there.
      */
-    protected String loadLink(String repositoryId, String id, String rel, String type) {
+    public String loadLink(String repositoryId, String id, String rel, String type) {
         String link = getLink(repositoryId, id, rel, type);
         if (link == null) {
             getObjectInternal(repositoryId, IdentifierType.ID, id, ReturnVersion.THIS, null, null, null, null, null,
@@ -166,6 +166,14 @@ public class AbstractAtomPubService {
     }
 
     /**
+     * Gets the content link from the cache if it is there or loads it into the
+     * cache if it is not there.
+     */
+    public String loadContentLink(String repositoryId, String id) {
+        return loadLink(repositoryId, id, AtomPubParser.LINK_REL_CONTENT, null);
+    }
+
+    /**
      * Adds a link to the cache.
      */
     protected void addLink(String repositoryId, String id, String rel, String type, String link) {
@@ -511,7 +519,8 @@ public class AbstractAtomPubService {
      * Performs a PUT on an URL, checks the response code and returns the
      * result.
      */
-    protected HttpUtils.Response put(UrlBuilder url, String contentType, Map<String, String> headers, HttpUtils.Output writer) {
+    protected HttpUtils.Response put(UrlBuilder url, String contentType, Map<String, String> headers,
+            HttpUtils.Output writer) {
         // make the call
         HttpUtils.Response resp = HttpUtils.invokePUT(url, contentType, headers, writer, session);
 

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/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/atompub/LinkAccess.java?rev=1080596&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkAccess.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkAccess.java Fri Mar 11 15:15:51 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
+
+public interface LinkAccess {
+
+    /**
+     * Gets a link from the cache if it is there or loads it into the cache if
+     * it is not there.
+     */
+    String loadLink(String repositoryId, String objectId, String rel, String type);
+
+    /**
+     * Gets the content link from the cache if it is there or loads it into the
+     * cache if it is not there.
+     */
+    String loadContentLink(String repositoryId, String documentId);
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkAccess.java
------------------------------------------------------------------------------
    svn:eol-style = native