Author: fmui
Date: Wed Nov 14 12:22:29 2012
New Revision: 1409178
URL: http://svn.apache.org/viewvc?rev=1409178&view=rev
Log:
CMIS-604: allow the JAX-WS framework to close the stream after
getContentStream() is complete
Modified:
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-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
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=1409178&r1=1409177&r2=1409178&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
Wed Nov 14 12:22:29 2012
@@ -77,7 +77,7 @@ public class ObjectServiceImpl extends A
javax.xml.ws.Holder<String> objectId = new
javax.xml.ws.Holder<String>();
javax.xml.ws.Holder<CmisExtensionType> portExtension =
convertExtensionHolder(extension);
- port.createDocument(repositoryId, convert(properties), folderId,
convert(contentStream),
+ port.createDocument(repositoryId, convert(properties), folderId,
convert(contentStream, false),
convert(EnumVersioningState.class, versioningState),
policies, convert(addACEs),
convert(removeACEs), portExtension, objectId);
@@ -209,7 +209,7 @@ public class ObjectServiceImpl extends A
portProvider.endCall(port);
}
}
-
+
public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(String
repositoryId,
List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken,
Properties properties,
List<String> addSecondaryTypeIds, List<String>
removeSecondaryTypeIds, ExtensionsData extension) {
@@ -388,8 +388,8 @@ public class ObjectServiceImpl extends A
javax.xml.ws.Holder<String> portChangeToken =
convertHolder(changeToken);
javax.xml.ws.Holder<CmisExtensionType> portExtension =
convertExtensionHolder(extension);
- port.setContentStream(repositoryId, portObjectId, overwriteFlag,
portChangeToken, convert(contentStream),
- portExtension);
+ port.setContentStream(repositoryId, portObjectId, overwriteFlag,
portChangeToken,
+ convert(contentStream, false), portExtension);
setHolderValue(portObjectId, objectId);
setHolderValue(portChangeToken, changeToken);
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.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/VersioningServiceImpl.java?rev=1409178&r1=1409177&r2=1409178&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
Wed Nov 14 12:22:29 2012
@@ -108,7 +108,7 @@ public class VersioningServiceImpl exten
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
javax.xml.ws.Holder<CmisExtensionType> portExtension =
convertExtensionHolder(extension);
- port.checkIn(repositoryId, portObjectId, major,
convert(properties), convert(contentStream),
+ port.checkIn(repositoryId, portObjectId, major,
convert(properties), convert(contentStream, false),
checkinComment, policies, convert(addACEs),
convert(removeACEs), portExtension);
setHolderValue(portObjectId, objectId);
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.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/Converter.java?rev=1409178&r1=1409177&r2=1409178&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Converter.java
Wed Nov 14 12:22:29 2012
@@ -2370,7 +2370,7 @@ public final class Converter {
/**
* Converts a content stream object.
*/
- public static CmisContentStreamType convert(final ContentStream
contentStream) {
+ public static CmisContentStreamType convert(final ContentStream
contentStream, final boolean allowClose) {
if (contentStream == null) {
return null;
}
@@ -2402,12 +2402,16 @@ public final class Converter {
}
public InputStream getInputStream() throws IOException {
- return new FilterInputStream(stream) {
- @Override
- public void close() throws IOException {
- // prevent closing
- }
- };
+ if (allowClose) {
+ return stream;
+ } else {
+ return new FilterInputStream(stream) {
+ @Override
+ public void close() throws IOException {
+ // prevent closing
+ }
+ };
+ }
}
public String getContentType() {
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/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/webservices/ObjectService.java?rev=1409178&r1=1409177&r2=1409178&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
Wed Nov 14 12:22:29 2012
@@ -266,8 +266,9 @@ public class ObjectService extends Abstr
try {
service = getService(wsContext, repositoryId);
- return convert(service.getContentStream(repositoryId, objectId,
streamId, offset, length,
- convert(extension)));
+ return convert(
+ service.getContentStream(repositoryId, objectId, streamId,
offset, length, convert(extension)),
+ true);
} catch (Exception e) {
throw convertException(e);
} finally {