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/26 17:17:25 UTC
svn commit: r1413704 - 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: Mon Nov 26 16:17:22 2012
New Revision: 1413704
URL: http://svn.apache.org/viewvc?rev=1413704&view=rev
Log:
CMIS 1.1: Corrected appendContentStream
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.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-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.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-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.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/browser/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.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/ObjectServiceImpl.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java Mon Nov 26 16:17:22 2012
@@ -513,7 +513,7 @@ public class ObjectServiceImpl extends A
}
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
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=1413704&r1=1413703&r2=1413704&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 Mon Nov 26 16:17:22 2012
@@ -122,7 +122,7 @@ public interface Document extends Fileab
*
* @return the updated document
*/
- Document appendContentStream(ContentStream contentStream);
+ Document appendContentStream(ContentStream contentStream, boolean isLastChunk);
/**
* Appends a content stream to the content stream of the document.
@@ -132,7 +132,7 @@ public interface Document extends Fileab
*
* @return the updated object id
*/
- ObjectId appendContentStream(ContentStream contentStream, boolean refresh);
+ ObjectId appendContentStream(ContentStream contentStream, boolean isLastChunk, boolean refresh);
/**
* Removes the current content stream from the document and refreshes this
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.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/ObjectServiceImpl.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java Mon Nov 26 16:17:22 2012
@@ -678,7 +678,7 @@ public class ObjectServiceImpl extends A
}
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.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/ObjectServiceImpl.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java Mon Nov 26 16:17:22 2012
@@ -365,7 +365,7 @@ public class ObjectServiceImpl extends A
List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
-
+
public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
ExtensionsData extension) {
// we need an object id
@@ -477,6 +477,43 @@ public class ObjectServiceImpl extends A
}
}
+ public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
+ // we need an object id
+ if ((objectId == null) || (objectId.getValue() == null) || (objectId.getValue().length() == 0)) {
+ throw new CmisInvalidArgumentException("Object id must be set!");
+ }
+
+ // build URL
+ UrlBuilder url = getObjectUrl(repositoryId, objectId.getValue());
+
+ // prepare form data
+ final FormDataWriter formData = new FormDataWriter(Constants.CMISACTION_APPEND_CONTENT, contentStream);
+ formData.addParameter(Constants.CONTROL_IS_LAST_CHUNK, isLastChunk);
+ formData.addParameter(Constants.PARAM_CHANGE_TOKEN, (changeToken == null ? null : changeToken.getValue()));
+ formData.addSuccinctFlag(getSuccinct());
+
+ // send and parse
+ HttpUtils.Response resp = post(url, formData.getContentType(), new HttpUtils.Output() {
+ public void write(OutputStream out) throws Exception {
+ formData.write(out);
+ }
+ });
+
+ Map<String, Object> json = parseObject(resp.getStream(), resp.getCharset());
+
+ TypeCache typeCache = new ClientTypeCacheImpl(repositoryId, this);
+
+ ObjectData newObj = JSONConverter.convertObject(json, typeCache);
+
+ objectId.setValue(newObj == null ? null : newObj.getId());
+
+ if (changeToken != null && newObj.getProperties() != null) {
+ Object ct = newObj.getProperties().getProperties().get(PropertyIds.CHANGE_TOKEN);
+ changeToken.setValue(ct == null ? null : ct.toString());
+ }
+ }
+
public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
ExtensionsData extension) {
// we need an object id
@@ -512,9 +549,4 @@ public class ObjectServiceImpl extends A
changeToken.setValue(ct == null ? null : ct.toString());
}
}
-
- public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
- throw new CmisNotSupportedException("Not supported!");
- }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.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/ObjectServiceImpl.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java Mon Nov 26 16:17:22 2012
@@ -233,11 +233,11 @@ public class ObjectServiceImpl extends A
}
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
CmisService service = getService(repositoryId);
try {
- service.appendContentStream(repositoryId, objectId, changeToken, contentStream, extension);
+ service.appendContentStream(repositoryId, objectId, changeToken, contentStream, isLastChunk, extension);
} finally {
service.close();
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.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/webservices/ObjectServiceImpl.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java Mon Nov 26 16:17:22 2012
@@ -427,7 +427,7 @@ public class ObjectServiceImpl extends A
}
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
}
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=1413704&r1=1413703&r2=1413704&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 Mon Nov 26 16:17:22 2012
@@ -432,8 +432,8 @@ public class DocumentImpl extends Abstra
return getSession().createObjectId(newObjectId);
}
- public Document appendContentStream(ContentStream contentStream) {
- ObjectId objectId = appendContentStream(contentStream, true);
+ public Document appendContentStream(ContentStream contentStream, boolean isLastChunk) {
+ ObjectId objectId = appendContentStream(contentStream, isLastChunk, true);
if (objectId == null) {
return null;
}
@@ -445,7 +445,7 @@ public class DocumentImpl extends Abstra
return this;
}
- public ObjectId appendContentStream(ContentStream contentStream, boolean refresh) {
+ public ObjectId appendContentStream(ContentStream contentStream, boolean isLastChunk, boolean refresh) {
String newObjectId = null;
readLock();
@@ -454,7 +454,7 @@ public class DocumentImpl extends Abstra
Holder<String> changeTokenHolder = new Holder<String>((String) getPropertyValue(PropertyIds.CHANGE_TOKEN));
getBinding().getObjectService().appendContentStream(getRepositoryId(), objectIdHolder, changeTokenHolder,
- getObjectFactory().convertContentStream(contentStream), null);
+ getObjectFactory().convertContentStream(contentStream), isLastChunk, null);
newObjectId = objectIdHolder.getValue();
} finally {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ObjectService.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/spi/ObjectService.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/spi/ObjectService.java Mon Nov 26 16:17:22 2012
@@ -489,7 +489,9 @@ public interface ObjectService {
* token (default is <code>null</code>)
* @param contentStream
* the content stream to append
+ * @param isLastChunk
+ * indicates if this content stream is the last chunk
*/
void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension);
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.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/Constants.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java Mon Nov 26 16:17:22 2012
@@ -119,14 +119,19 @@ public final class Constants {
public static final String SELECTOR_CONTENT_CHANGES = "contentChanges";
// browser binding actions
+ public static final String CMISACTION_CREATE_TYPE = "createType";
+ public static final String CMISACTION_UPDATE_TYPE = "updateType";
+ public static final String CMISACTION_DELETE_TYPE = "deleteType";
public static final String CMISACTION_CREATE_DOCUMENT = "createDocument";
public static final String CMISACTION_CREATE_DOCUMENT_FROM_SOURCE = "createDocumentFromSource";
public static final String CMISACTION_CREATE_FOLDER = "createFolder";
public static final String CMISACTION_CREATE_RELATIONSHIP = "createRelationship";
public static final String CMISACTION_CREATE_POLICY = "createPolicy";
public static final String CMISACTION_UPDATE_PROPERTIES = "update";
+ public static final String CMISACTION_BULK_UPDATE = "bulkUpdate";
public static final String CMISACTION_DELETE_CONTENT = "deleteContent";
public static final String CMISACTION_SET_CONTENT = "setContent";
+ public static final String CMISACTION_APPEND_CONTENT = "appendContent";
public static final String CMISACTION_DELETE = "delete";
public static final String CMISACTION_DELETE_TREE = "deleteTree";
public static final String CMISACTION_MOVE = "move";
@@ -154,6 +159,7 @@ public final class Constants {
public static final String CONTROL_REMOVE_ACE_PERMISSION = "removeACEPermission";
public static final String CONTROL_CONTENT_TYPE = "contenttype";
public static final String CONTROL_FILENAME = "filename";
+ public static final String CONTROL_IS_LAST_CHUNK = "isLastChunk";
// parameter
public static final String PARAM_ACL = "includeACL";
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.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/server/AbstractCmisService.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java Mon Nov 26 16:17:22 2012
@@ -641,7 +641,7 @@ public abstract class AbstractCmisServic
* </ul>
*/
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
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=1413704&r1=1413703&r2=1413704&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 Mon Nov 26 16:17:22 2012
@@ -19,8 +19,10 @@
package org.apache.chemistry.opencmis.server.impl.browser;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_ADD_OBJECT_TO_FOLDER;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_APPEND_CONTENT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_APPLY_ACL;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_APPLY_POLICY;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_BULK_UPDATE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CANCEL_CHECK_OUT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CHECK_IN;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CHECK_OUT;
@@ -29,15 +31,18 @@ import static org.apache.chemistry.openc
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CREATE_FOLDER;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CREATE_POLICY;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CREATE_RELATIONSHIP;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_CREATE_TYPE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_DELETE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_DELETE_CONTENT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_DELETE_TREE;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_DELETE_TYPE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_MOVE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_QUERY;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_REMOVE_OBJECT_FROM_FOLDER;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_REMOVE_POLICY;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_SET_CONTENT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_UPDATE_PROPERTIES;
+import static org.apache.chemistry.opencmis.commons.impl.Constants.CMISACTION_UPDATE_TYPE;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_OBJECT_ID;
import static org.apache.chemistry.opencmis.commons.impl.Constants.SELECTOR_ACL;
import static org.apache.chemistry.opencmis.commons.impl.Constants.SELECTOR_ALLOWABLEACTIONS;
@@ -174,12 +179,17 @@ public class CmisBrowserBindingServlet e
"getTypeDescendants");
repositoryDispatcher.addResource(SELECTOR_TYPE_DEFINITION, METHOD_GET, RepositoryService.class,
"getTypeDefinition");
+ repositoryDispatcher
+ .addResource(CMISACTION_CREATE_TYPE, METHOD_POST, RepositoryService.class, "createType");
+ repositoryDispatcher
+ .addResource(CMISACTION_UPDATE_TYPE, METHOD_POST, RepositoryService.class, "updateType");
+ repositoryDispatcher
+ .addResource(CMISACTION_DELETE_TYPE, METHOD_POST, RepositoryService.class, "deleteType");
repositoryDispatcher.addResource(SELECTOR_QUERY, METHOD_GET, DiscoveryService.class, "query");
repositoryDispatcher.addResource(SELECTOR_CHECKEDOUT, METHOD_GET, NavigationService.class,
"getCheckedOutDocs");
repositoryDispatcher.addResource(SELECTOR_CONTENT_CHANGES, METHOD_GET, DiscoveryService.class,
"getContentChanges");
-
repositoryDispatcher.addResource(CMISACTION_QUERY, METHOD_POST, DiscoveryService.class, "query");
repositoryDispatcher.addResource(CMISACTION_CREATE_DOCUMENT, METHOD_POST, ObjectService.class,
"createDocument");
@@ -189,6 +199,8 @@ public class CmisBrowserBindingServlet e
.addResource(CMISACTION_CREATE_POLICY, METHOD_POST, ObjectService.class, "createPolicy");
repositoryDispatcher.addResource(CMISACTION_CREATE_RELATIONSHIP, METHOD_POST, ObjectService.class,
"createRelationship");
+ repositoryDispatcher.addResource(CMISACTION_BULK_UPDATE, METHOD_POST, ObjectService.class,
+ "bulkUpdateProperties");
rootDispatcher.addResource(SELECTOR_OBJECT, METHOD_GET, ObjectService.class, "getObject");
rootDispatcher.addResource(SELECTOR_PROPERTIES, METHOD_GET, ObjectService.class, "getProperties");
@@ -216,6 +228,8 @@ public class CmisBrowserBindingServlet e
rootDispatcher.addResource(CMISACTION_UPDATE_PROPERTIES, METHOD_POST, ObjectService.class,
"updateProperties");
rootDispatcher.addResource(CMISACTION_SET_CONTENT, METHOD_POST, ObjectService.class, "setContentStream");
+ rootDispatcher.addResource(CMISACTION_APPEND_CONTENT, METHOD_POST, ObjectService.class,
+ "appendContentStream");
rootDispatcher.addResource(CMISACTION_DELETE_CONTENT, METHOD_POST, ObjectService.class,
"deleteContentStream");
rootDispatcher.addResource(CMISACTION_DELETE, METHOD_POST, ObjectService.class, "deleteObject");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.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/ObjectService.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java Mon Nov 26 16:17:22 2012
@@ -315,6 +315,14 @@ public final class ObjectService {
}
/**
+ * bulkUpdateProperties.
+ */
+ public static void bulkUpdateProperties(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // TODO
+ }
+
+ /**
* getProperties.
*/
public static void getProperties(CallContext context, CmisService service, String repositoryId,
@@ -595,7 +603,7 @@ public final class ObjectService {
}
/**
- * Set content stream.
+ * setContentStream.
*/
public static void setContentStream(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
@@ -632,6 +640,43 @@ public final class ObjectService {
}
/**
+ * appendContentStream.
+ */
+ public static void appendContentStream(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // get parameters
+ String objectId = (String) context.get(CONTEXT_OBJECT_ID);
+ boolean isLastChunk = getBooleanParameter(request, Constants.CONTROL_IS_LAST_CHUNK, false);
+ String changeToken = getStringParameter(request, Constants.PARAM_CHANGE_TOKEN);
+ boolean succinct = getBooleanParameter(request, Constants.CONTROL_SUCCINCT, false);
+
+ // execute
+ Holder<String> objectIdHolder = new Holder<String>(objectId);
+ Holder<String> changeTokenHolder = (changeToken == null ? null : new Holder<String>(changeToken));
+ service.appendContentStream(repositoryId, objectIdHolder, changeTokenHolder, createContentStream(request),
+ isLastChunk, null);
+
+ String newObjectId = (objectIdHolder.getValue() == null ? objectId : objectIdHolder.getValue());
+
+ ObjectData object = getSimpleObject(service, repositoryId, newObjectId);
+ if (object == null) {
+ throw new CmisRuntimeException("Object is null!");
+ }
+
+ // set headers
+ String location = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT, newObjectId);
+
+ setStatus(request, response, HttpServletResponse.SC_CREATED);
+ response.setHeader("Location", location);
+
+ // return object
+ TypeCache typeCache = new ServerTypeCacheImpl(repositoryId, service);
+ JSONObject jsonObject = JSONConverter.convert(object, typeCache, false, succinct);
+
+ writeJSON(jsonObject, request, response);
+ }
+
+ /**
* moveObject.
*/
public static void moveObject(CallContext context, CmisService service, String repositoryId,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.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/RepositoryService.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java Mon Nov 26 16:17:22 2012
@@ -24,6 +24,7 @@ import static org.apache.chemistry.openc
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_SKIP_COUNT;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TOKEN;
import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_TYPE_ID;
+import static org.apache.chemistry.opencmis.server.impl.browser.BrowserBindingUtils.writeEmpty;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
@@ -176,6 +177,9 @@ public final class RepositoryService {
BrowserBindingUtils.writeJSON(jsonTypeTree, request, response);
}
+ /**
+ * getTypeDefinition.
+ */
public static void getTypeDefinition(CallContext context, CmisService service, String repositoryId,
HttpServletRequest request, HttpServletResponse response) throws Exception {
// get parameters
@@ -188,4 +192,34 @@ public final class RepositoryService {
response.setStatus(HttpServletResponse.SC_OK);
BrowserBindingUtils.writeJSON(jsonType, request, response);
}
+
+ /**
+ * createType.
+ */
+ public static void createType(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // TODO
+ }
+
+ /**
+ * updateType.
+ */
+ public static void updateType(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // TODO
+ }
+
+ /**
+ * deleteType.
+ */
+ public static void deleteType(CallContext context, CmisService service, String repositoryId,
+ HttpServletRequest request, HttpServletResponse response) throws Exception {
+ // get parameters
+ String typeId = getStringParameter(request, PARAM_TYPE_ID);
+
+ service.deleteType(repositoryId, typeId, null);
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ writeEmpty(request, response);
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.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/InMemoryService.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java Mon Nov 26 16:17:22 2012
@@ -317,7 +317,7 @@ public class InMemoryService extends Abs
// CMIS 1.1
@Override
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
fObjSvc.appendContentStream(getCallContext(), repositoryId, objectId, changeToken, contentStream, extension);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Mon Nov 26 16:17:22 2012
@@ -186,7 +186,7 @@ public class ObjectServiceTest extends A
}
try {
- createDocumentNoCatch("/(%#$���", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
+ createDocumentNoCatch("/(%#$���������", fRootFolderId, DOCUMENT_TYPE_ID, VersioningState.NONE, false);
fail("Document creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -218,7 +218,7 @@ public class ObjectServiceTest extends A
}
try {
- createFolderNoCatch("/(%#$���", fRootFolderId, FOLDER_TYPE_ID);
+ createFolderNoCatch("/(%#$���������", fRootFolderId, FOLDER_TYPE_ID);
fail("Folder creation with ilegal name should fail.");
} catch (Exception e) {
assertTrue(e instanceof CmisInvalidArgumentException);
@@ -893,10 +893,10 @@ public class ObjectServiceTest extends A
log.info("starting testGetObjectByPath() with specal chars...");
log.info(" creating object");
- String docID = createDocument("H��nschen", fRootFolderId, false);
+ String docID = createDocument("H������nschen", fRootFolderId, false);
log.info(" getting object by path with special chars");
try {
- ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/H��nschen", "*", false, IncludeRelationships.NONE, null, false,
+ ObjectData res = fObjSvc.getObjectByPath(fRepositoryId, "/H������nschen", "*", false, IncludeRelationships.NONE, null, false,
false, null);
assertNotNull(res);
assertNotNull(res.getId());
@@ -1080,7 +1080,7 @@ public class ObjectServiceTest extends A
Holder<String> idHolder = new Holder<String>(id);
ContentStream contentStream = createContent();
- fObjSvc.appendContentStream(fRepositoryId, idHolder, null, contentStream, null);
+ fObjSvc.appendContentStream(fRepositoryId, idHolder, null, contentStream, false, null);
ContentStream sd = fObjSvc.getContentStream(fRepositoryId, id, null, null, null, null);
verifyContentResult(sd, 64);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java?rev=1413704&r1=1413703&r2=1413704&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java Mon Nov 26 16:17:22 2012
@@ -950,13 +950,13 @@ public class CmisServiceWrapper<T extend
}
public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
- ContentStream contentStream, ExtensionsData extension) {
+ ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
checkRepositoryId(repositoryId);
checkHolderId("Object Id", objectId);
checkContentStream(contentStream);
try {
- service.appendContentStream(repositoryId, objectId, changeToken, contentStream, extension);
+ service.appendContentStream(repositoryId, objectId, changeToken, contentStream, isLastChunk, extension);
} catch (Exception e) {
throw createCmisException(e);
}