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 2012/11/28 10:55:15 UTC

svn commit: r1414619 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/j...

Author: fmui
Date: Wed Nov 28 09:55:06 2012
New Revision: 1414619

URL: http://svn.apache.org/viewvc?rev=1414619&view=rev
Log:
CMIS 1.1: added and made use of CmisVersion enum

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.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/SessionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/RepositoryInfo.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/CallContext.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.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/local/AbstractLocalService.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java Wed Nov 28 09:55:06 2012
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
 import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
@@ -110,6 +111,10 @@ public abstract class AbstractLocalServi
             return contextMap.get(key);
         }
 
+        public CmisVersion getCmisVersion() {
+            return CmisVersion.CMIS_1_1;
+        }
+
         public String getRepositoryId() {
             return (String) get(REPOSITORY_ID);
         }

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=1414619&r1=1414618&r2=1414619&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 Wed Nov 28 09:55:06 2012
@@ -41,6 +41,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Ace;
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
@@ -433,6 +434,10 @@ public class DocumentImpl extends Abstra
     }
 
     public Document appendContentStream(ContentStream contentStream, boolean isLastChunk) {
+        if (getSession().getRepositoryInfo().getCmisVersion() == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
+        }
+
         ObjectId objectId = appendContentStream(contentStream, isLastChunk, true);
         if (objectId == null) {
             return null;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.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/SessionImpl.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Wed Nov 28 09:55:06 2012
@@ -63,6 +63,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
@@ -546,14 +547,28 @@ public class SessionImpl implements Sess
     }
 
     public ObjectType createType(ObjectType type) {
-        throw new CmisNotSupportedException("Not implemented, yet");
+        if (repositoryInfo.getCmisVersion() == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
+        }
+
+        return objectFactory.convertTypeDefinition(getBinding().getRepositoryService().createType(getRepositoryId(),
+                type, null));
     }
 
     public ObjectType updateType(ObjectType type) {
-        throw new CmisNotSupportedException("Not implemented, yet");
+        if (repositoryInfo.getCmisVersion() == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
+        }
+
+        return objectFactory.convertTypeDefinition(getBinding().getRepositoryService().updateType(getRepositoryId(),
+                type, null));
     }
 
     public void deleteType(String typeId) {
+        if (repositoryInfo.getCmisVersion() == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
+        }
+
         getBinding().getRepositoryService().deleteType(getRepositoryId(), typeId, null);
     }
 
@@ -916,6 +931,10 @@ public class SessionImpl implements Sess
     public BulkUpdateObjectIdAndChangeToken bulkUpdateProperties(
             BulkUpdateObjectIdAndChangeToken objectIdsAndChangeToken, Map<String, ?> properties,
             List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds) {
+        if (repositoryInfo.getCmisVersion() == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("This method is not supported for CMIS 1.0 repositories.");
+        }
+
         throw new CmisNotSupportedException("Not implemented, yet");
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/RepositoryInfo.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/RepositoryInfo.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/RepositoryInfo.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/data/RepositoryInfo.java Wed Nov 28 09:55:06 2012
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import java.util.List;
 
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 
 public interface RepositoryInfo extends Serializable, ExtensionsData {
 
@@ -46,6 +47,8 @@ public interface RepositoryInfo extends 
     String getLatestChangeLogToken();
 
     String getCmisVersionSupported();
+    
+    CmisVersion getCmisVersion();
 
     String getThinClientUri();
 

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java?rev=1414619&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java Wed Nov 28 09:55:06 2012
@@ -0,0 +1,43 @@
+/*
+ * 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.commons.enums;
+
+public enum CmisVersion {
+
+    CMIS_1_0("1.0"), CMIS_1_1("1.1");
+    private final String value;
+
+    CmisVersion(String v) {
+        value = v;
+    }
+
+    public String value() {
+        return value;
+    }
+
+    public static CmisVersion fromValue(String v) {
+        for (CmisVersion c : CmisVersion.values()) {
+            if (c.value.equals(v)) {
+                return c;
+            }
+        }
+        throw new IllegalArgumentException(v);
+    }
+
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/enums/CmisVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/CallContext.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/CallContext.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/CallContext.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/CallContext.java Wed Nov 28 09:55:06 2012
@@ -21,6 +21,8 @@ package org.apache.chemistry.opencmis.co
 import java.io.File;
 import java.math.BigInteger;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+
 /**
  * An object implementing this interface holds context data of the current call.
  */
@@ -31,6 +33,8 @@ public interface CallContext {
     String BINDING_BROWSER = "browser";
     String BINDING_LOCAL = "local";
 
+    String CMIS_VERSION = "cmisVersion";
+
     String REPOSITORY_ID = "repositoryId";
     String USERNAME = "username";
     String PASSWORD = "password";
@@ -72,6 +76,11 @@ public interface CallContext {
     Object get(String key);
 
     /**
+     * Returns the CMIS version.
+     */
+    CmisVersion getCmisVersion();
+
+    /**
      * Returns the repository id.
      */
     String getRepositoryId();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/RepositoryInfoImpl.java Wed Nov 28 09:55:06 2012
@@ -25,6 +25,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 
 /**
  * Repository info data implementation.
@@ -110,6 +111,26 @@ public class RepositoryInfoImpl extends 
         this.versionSupported = versionSupported;
     }
 
+    public CmisVersion getCmisVersion() {
+        if (versionSupported == null) {
+            return CmisVersion.CMIS_1_0;
+        }
+
+        try {
+            return CmisVersion.valueOf(versionSupported);
+        } catch (IllegalArgumentException e) {
+            return CmisVersion.CMIS_1_0;
+        }
+    }
+
+    public void setCmisVersion(CmisVersion cmisVersion) {
+        if (cmisVersion == null) {
+            versionSupported = null;
+        } else {
+            versionSupported = cmisVersion.value();
+        }
+    }
+
     public RepositoryCapabilities getCapabilities() {
         return capabilities;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CallContextImpl.java Wed Nov 28 09:55:06 2012
@@ -23,6 +23,7 @@ import java.math.BigInteger;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 
 /**
@@ -52,6 +53,10 @@ public class CallContextImpl implements 
         return parameter.get(key);
     }
 
+    public CmisVersion getCmisVersion() {
+        return (CmisVersion) get(CMIS_VERSION);
+    }
+
     public String getRepositoryId() {
         return (String) get(REPOSITORY_ID);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java Wed Nov 28 09:55:06 2012
@@ -72,6 +72,8 @@ public final class AtomPubUtils {
     public static final String RESOURCE_CHANGES = "changes";
     public static final String RESOURCE_CONTENT = "content";
 
+    public static final String REPOSITORY_PLACEHOLDER = "{repositoryId}";
+
     public static final BigInteger PAGE_SIZE = BigInteger.valueOf(100);
 
     public static final String TYPE_AUTHOR = "unknown";
@@ -88,9 +90,15 @@ public final class AtomPubUtils {
     public static UrlBuilder compileBaseUrl(HttpServletRequest request, String repositoryId) {
         String baseUrl = (String) request.getAttribute(Dispatcher.BASE_URL_ATTRIBUTE);
         if (baseUrl != null) {
-            return new UrlBuilder(baseUrl);
+            int repIdPos = baseUrl.indexOf(REPOSITORY_PLACEHOLDER);
+            if (repIdPos < 0) {
+                return new UrlBuilder(baseUrl);
+            } else {
+                return new UrlBuilder(baseUrl.substring(0, repIdPos) + repositoryId
+                        + baseUrl.substring(repIdPos + REPOSITORY_PLACEHOLDER.length()));
+            }
         }
-        
+
         UrlBuilder url = new UrlBuilder(request.getScheme(), request.getServerName(), request.getServerPort(), null);
 
         url.addPath(request.getContextPath());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Wed Nov 28 09:55:06 2012
@@ -53,6 +53,7 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
@@ -183,7 +184,7 @@ public class CmisAtomPubServlet extends 
         CallContext context = null;
         try {
             context = HttpUtils.createContext(qsRequest, response, getServletContext(), CallContext.BINDING_ATOMPUB,
-                    callContextHandler, tempDir, memoryThreshold, maxContentSize, encrypt);
+                    CmisVersion.CMIS_1_0, callContextHandler, tempDir, memoryThreshold, maxContentSize, encrypt);
             dispatch(context, qsRequest, response);
         } catch (Exception e) {
             if (e instanceof CmisPermissionDeniedException) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java Wed Nov 28 09:55:06 2012
@@ -92,6 +92,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
@@ -280,7 +281,7 @@ public class CmisBrowserBindingServlet e
             }
 
             context = HttpUtils.createContext(request, response, getServletContext(), CallContext.BINDING_BROWSER,
-                    callContextHandler, tempDir, memoryThreshold, maxContentSize, encrypt);
+                    CmisVersion.CMIS_1_1, callContextHandler, tempDir, memoryThreshold, maxContentSize, encrypt);
             dispatch(context, request, response);
         } catch (Exception e) {
             if (e instanceof CmisPermissionDeniedException) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Wed Nov 28 09:55:06 2012
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRes
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
@@ -90,6 +91,8 @@ public abstract class AbstractService {
     protected CallContext createContext(WebServiceContext wsContext, CmisServiceFactory factory, String repositoryId) {
         CallContextImpl context = new CallContextImpl(CallContext.BINDING_WEBSERVICES, repositoryId, false);
 
+        context.put(CallContext.CMIS_VERSION, CmisVersion.CMIS_1_0);
+
         MessageContext mc = wsContext.getMessageContext();
         Map<String, String> callContextMap = (Map<String, String>) mc.get(CALL_CONTEXT_MAP);
         if (callContextMap != null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java Wed Nov 28 09:55:06 2012
@@ -31,6 +31,7 @@ import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
@@ -48,8 +49,9 @@ public class HttpUtils {
      * Creates a {@link CallContext} object from a servlet request.
      */
     public static CallContext createContext(HttpServletRequest request, HttpServletResponse response,
-            ServletContext servletContext, String binding, CallContextHandler callContextHandler, File tempDir,
-            int memoryThreshold, long maxContentSize, boolean encrypt) {
+            ServletContext servletContext, String binding, CmisVersion cmisVersion,
+            CallContextHandler callContextHandler, File tempDir, int memoryThreshold, long maxContentSize,
+            boolean encrypt) {
         String[] pathFragments = splitPath(request);
 
         String repositoryId = null;
@@ -75,6 +77,9 @@ public class HttpUtils {
         context.put(CallContext.HTTP_SERVLET_REQUEST, request);
         context.put(CallContext.HTTP_SERVLET_RESPONSE, response);
 
+        // CMIS version
+        context.put(CallContext.CMIS_VERSION, cmisVersion);
+        
         // content
         context.put(CallContext.TEMP_DIR, tempDir);
         context.put(CallContext.MEMORY_THRESHOLD, memoryThreshold);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DummyCallContext.java Wed Nov 28 09:55:06 2012
@@ -25,6 +25,7 @@ import java.math.BigInteger;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 
 public class DummyCallContext implements CallContext {
@@ -53,6 +54,10 @@ public class DummyCallContext implements
     public String getBinding() {
         return BINDING_ATOMPUB;
     }
+    
+    public CmisVersion getCmisVersion() {
+        return CmisVersion.CMIS_1_1;
+    }
 
     public String getRepositoryId() {
         return (String) get(REPOSITORY_ID);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java Wed Nov 28 09:55:06 2012
@@ -40,6 +40,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.impl.Converter;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
@@ -304,6 +305,10 @@ public class InMemoryServiceFactoryImpl 
                 return false;
             }
 
+            public CmisVersion getCmisVersion() {
+                return CmisVersion.CMIS_1_1;
+            }
+
             public String getRepositoryId() {
                 return null;
             }

Added: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java?rev=1414619&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java Wed Nov 28 09:55:06 2012
@@ -0,0 +1,88 @@
+/*
+ * 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.workbench.actions;
+
+import java.io.IOException;
+
+import javax.swing.JCheckBox;
+import javax.swing.JTextField;
+
+import org.apache.chemistry.opencmis.client.api.Document;
+import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+import org.apache.chemistry.opencmis.workbench.model.ClientModel;
+import org.apache.chemistry.opencmis.workbench.swing.ActionPanel;
+
+public class AppendContentStreamPanel extends ActionPanel {
+
+    private static final long serialVersionUID = 1L;
+
+    private JTextField filenameField;
+    private JCheckBox isLastChunkBox;
+
+    public AppendContentStreamPanel(ClientModel model) {
+        super("Append Content Stream", "Append Content Stream", model);
+    }
+
+    @Override
+    protected void createActionComponents() {
+        filenameField = new JTextField(30);
+        addActionComponent(createFilenamePanel(filenameField));
+
+        isLastChunkBox = new JCheckBox("is last chunk", false);
+        addActionComponent(isLastChunkBox);
+    }
+
+    @Override
+    public boolean isAllowed() {
+        if (getCmisVersion() == CmisVersion.CMIS_1_0) {
+            return false;
+        }
+
+        if ((getObject() == null) || !(getObject() instanceof Document)) {
+            return false;
+        }
+
+        if ((getObject().getAllowableActions() == null)
+                || (getObject().getAllowableActions().getAllowableActions() == null)) {
+            return true;
+        }
+
+        return getObject().getAllowableActions().getAllowableActions().contains(Action.CAN_SET_CONTENT_STREAM);
+    }
+
+    @Override
+    public boolean doAction() throws Exception {
+        ContentStream content = getClientModel().createContentStream(filenameField.getText());
+
+        try {
+            ((Document) getObject()).appendContentStream(content, isLastChunkBox.isSelected());
+        } finally {
+            if (content != null && content.getStream() != null) {
+                try {
+                    content.getStream().close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+        }
+        return true;
+    }
+}
\ No newline at end of file

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/actions/AppendContentStreamPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ActionsPanel.java Wed Nov 28 09:55:06 2012
@@ -25,6 +25,7 @@ import javax.swing.JPanel;
 import org.apache.chemistry.opencmis.client.api.CmisObject;
 import org.apache.chemistry.opencmis.workbench.actions.AclUpdatePanel;
 import org.apache.chemistry.opencmis.workbench.actions.AddObjectToFolderPanel;
+import org.apache.chemistry.opencmis.workbench.actions.AppendContentStreamPanel;
 import org.apache.chemistry.opencmis.workbench.actions.ApplyPolicyPanel;
 import org.apache.chemistry.opencmis.workbench.actions.CancelCheckOutPanel;
 import org.apache.chemistry.opencmis.workbench.actions.CheckInPanel;
@@ -57,6 +58,7 @@ public class ActionsPanel extends JPanel
     private CancelCheckOutPanel cancelCheckOutPanel;
     private CheckInPanel checkInPanel;
     private SetContentStreamPanel setContentStreamPanel;
+    private AppendContentStreamPanel appendContentStreamPanel;
     private DeleteContentStreamPanel deleteContentStreamPanel;
     private AddObjectToFolderPanel addObjectToFolderPanel;
     private RemoveObjectFromFolderPanel removeObjectFromFolderPanel;
@@ -103,6 +105,9 @@ public class ActionsPanel extends JPanel
         setContentStreamPanel.setObject(object);
         setContentStreamPanel.setVisible(setContentStreamPanel.isAllowed());
 
+        appendContentStreamPanel.setObject(object);
+        appendContentStreamPanel.setVisible(appendContentStreamPanel.isAllowed());
+
         deleteContentStreamPanel.setObject(object);
         deleteContentStreamPanel.setVisible(deleteContentStreamPanel.isAllowed());
 
@@ -153,6 +158,9 @@ public class ActionsPanel extends JPanel
         setContentStreamPanel = new SetContentStreamPanel(model);
         add(setContentStreamPanel);
 
+        appendContentStreamPanel = new AppendContentStreamPanel(model);
+        add(appendContentStreamPanel);
+
         deleteContentStreamPanel = new DeleteContentStreamPanel(model);
         add(deleteContentStreamPanel);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java?rev=1414619&r1=1414618&r2=1414619&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/ActionPanel.java Wed Nov 28 09:55:06 2012
@@ -37,6 +37,7 @@ import javax.swing.JTextField;
 import javax.swing.UIManager;
 
 import org.apache.chemistry.opencmis.client.api.CmisObject;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.workbench.ClientHelper;
 import org.apache.chemistry.opencmis.workbench.model.ClientModel;
 
@@ -67,6 +68,14 @@ public abstract class ActionPanel extend
         return object;
     }
 
+    public CmisVersion getCmisVersion() {
+        try {
+            return model.getRepositoryInfo().getCmisVersion();
+        } catch (Exception e) {
+            return CmisVersion.CMIS_1_0;
+        }
+    }
+
     protected void createGUI(String title, String buttonLabel) {
         BorderLayout borderLayout = new BorderLayout();
         borderLayout.setVgap(3);