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 2013/04/22 14:19:24 UTC
svn commit: r1470473 [1/2] - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/j...
Author: fmui
Date: Mon Apr 22 12:19:24 2013
New Revision: 1470473
URL: http://svn.apache.org/r1470473
Log:
CMIS 1.1: more Web Services code
Added:
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectServicePort10.java (with props)
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryServicePort10.java (with props)
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.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-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunPortProvider.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-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/WebSpherePortProvider.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService10.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService10.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/WebServices11TckIT.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/BulkUpdatePropertiesTest.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.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/CmisBindingFactory.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.java Mon Apr 22 12:19:24 2013
@@ -18,6 +18,7 @@
*/
package org.apache.chemistry.opencmis.client.bindings;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -153,6 +154,9 @@ public class CmisBindingFactory {
checkSessionParameters(sessionParameters, false);
sessionParameters.put(SessionParameter.BINDING_SPI_CLASS, BINDING_SPI_WEBSERVICES);
+ if (!sessionParameters.containsKey(SessionParameter.HTTP_INVOKER_CLASS)) {
+ sessionParameters.put(SessionParameter.HTTP_INVOKER_CLASS, DEFAULT_HTTP_INVOKER);
+ }
if (authenticationProvider == null) {
if (!sessionParameters.containsKey(SessionParameter.AUTHENTICATION_PROVIDER_CLASS)) {
sessionParameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, STANDARD_AUTHENTICATION_PROVIDER);
@@ -166,15 +170,24 @@ public class CmisBindingFactory {
}
addDefaultParameters(sessionParameters);
- check(sessionParameters, SessionParameter.WEBSERVICES_ACL_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_DISCOVERY_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_MULTIFILING_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_NAVIGATION_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_OBJECT_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_POLICY_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_REPOSITORY_SERVICE);
- check(sessionParameters, SessionParameter.WEBSERVICES_VERSIONING_SERVICE);
+ check(sessionParameters, SessionParameter.WEBSERVICES_ACL_SERVICE,
+ SessionParameter.WEBSERVICES_ACL_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_DISCOVERY_SERVICE,
+ SessionParameter.WEBSERVICES_DISCOVERY_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_MULTIFILING_SERVICE,
+ SessionParameter.WEBSERVICES_MULTIFILING_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_NAVIGATION_SERVICE,
+ SessionParameter.WEBSERVICES_NAVIGATION_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_OBJECT_SERVICE,
+ SessionParameter.WEBSERVICES_OBJECT_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_POLICY_SERVICE,
+ SessionParameter.WEBSERVICES_POLICY_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE,
+ SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_REPOSITORY_SERVICE,
+ SessionParameter.WEBSERVICES_REPOSITORY_SERVICE_ENDPOINT);
+ check(sessionParameters, SessionParameter.WEBSERVICES_VERSIONING_SERVICE,
+ SessionParameter.WEBSERVICES_VERSIONING_SERVICE_ENDPOINT);
return new CmisBindingImpl(sessionParameters, authenticationProvider);
}
@@ -256,9 +269,18 @@ public class CmisBindingFactory {
* Checks if the given parameter is present. If not, throw an
* <code>IllegalArgumentException</code>.
*/
- private static void check(Map<String, String> sessionParameters, String parameter) {
- if (!sessionParameters.containsKey(parameter)) {
- throw new IllegalArgumentException("Parameter '" + parameter + "' is missing!");
+ private static void check(Map<String, String> sessionParameters, String... parameters) {
+ for (String parameter : parameters) {
+ if (sessionParameters.containsKey(parameter)) {
+ return;
+ }
+ }
+
+ if (parameters.length == 1) {
+ throw new IllegalArgumentException("Parameter '" + parameters[0] + "' is missing!");
+ } else {
+ throw new IllegalArgumentException("One of the following parameters must be set: "
+ + Arrays.asList(parameters).toString());
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.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/AbstractPortProvider.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java Mon Apr 22 12:19:24 2013
@@ -18,7 +18,10 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+import java.io.IOException;
import java.lang.reflect.Constructor;
+import java.math.BigInteger;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
@@ -26,6 +29,9 @@ import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceFeature;
@@ -35,12 +41,16 @@ import javax.xml.ws.http.HTTPException;
import org.apache.chemistry.opencmis.client.bindings.impl.ClientVersion;
import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
+import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpInvoker;
+import org.apache.chemistry.opencmis.client.bindings.spi.http.Response;
import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisProxyAuthenticationException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
+import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLService;
import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryService;
@@ -59,11 +69,14 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryServicePort;
import org.apache.chemistry.opencmis.commons.impl.jaxb.VersioningService;
import org.apache.chemistry.opencmis.commons.impl.jaxb.VersioningServicePort;
-import org.apache.chemistry.opencmis.commons.impl.webservices.ObjectServicePort10;
-import org.apache.chemistry.opencmis.commons.impl.webservices.RepositoryServicePort10;
import org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
public abstract class AbstractPortProvider {
@@ -72,56 +85,53 @@ public abstract class AbstractPortProvid
protected static final int CHUNK_SIZE = (64 * 1024) - 1;
protected enum CmisWebSerivcesService {
- REPOSITORY_SERVICE("RepositoryService", false, RepositoryService.class, RepositoryServicePort10.class,
- RepositoryServicePort.class, SessionParameter.WEBSERVICES_REPOSITORY_SERVICE,
+ REPOSITORY_SERVICE("RepositoryService", false, RepositoryService.class, RepositoryServicePort.class,
+ SessionParameter.WEBSERVICES_REPOSITORY_SERVICE,
SessionParameter.WEBSERVICES_REPOSITORY_SERVICE_ENDPOINT),
NAVIGATION_SERVICE("NavigationService", false, NavigationService.class, NavigationServicePort.class,
- NavigationServicePort.class, SessionParameter.WEBSERVICES_NAVIGATION_SERVICE,
+ SessionParameter.WEBSERVICES_NAVIGATION_SERVICE,
SessionParameter.WEBSERVICES_NAVIGATION_SERVICE_ENDPOINT),
- OBJECT_SERVICE("ObjectService", true, ObjectService.class, ObjectServicePort10.class, ObjectServicePort.class,
+ OBJECT_SERVICE("ObjectService", true, ObjectService.class, ObjectServicePort.class,
SessionParameter.WEBSERVICES_OBJECT_SERVICE, SessionParameter.WEBSERVICES_OBJECT_SERVICE_ENDPOINT),
VERSIONING_SERVICE("VersioningService", true, VersioningService.class, VersioningServicePort.class,
- VersioningServicePort.class, SessionParameter.WEBSERVICES_VERSIONING_SERVICE,
+ SessionParameter.WEBSERVICES_VERSIONING_SERVICE,
SessionParameter.WEBSERVICES_VERSIONING_SERVICE_ENDPOINT),
DISCOVERY_SERVICE("DiscoveryService", false, DiscoveryService.class, DiscoveryServicePort.class,
- DiscoveryServicePort.class, SessionParameter.WEBSERVICES_DISCOVERY_SERVICE,
- SessionParameter.WEBSERVICES_DISCOVERY_SERVICE_ENDPOINT),
+ SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, SessionParameter.WEBSERVICES_DISCOVERY_SERVICE_ENDPOINT),
MULTIFILING_SERVICE("MultiFilingService", false, MultiFilingService.class, MultiFilingServicePort.class,
- MultiFilingServicePort.class, SessionParameter.WEBSERVICES_MULTIFILING_SERVICE,
+ SessionParameter.WEBSERVICES_MULTIFILING_SERVICE,
SessionParameter.WEBSERVICES_MULTIFILING_SERVICE_ENDPOINT),
RELATIONSHIP_SERVICE("RelationshipService", false, RelationshipService.class, RelationshipServicePort.class,
- RelationshipServicePort.class, SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE,
+ SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE,
SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE_ENDPOINT),
- POLICY_SERVICE("PolicyService", false, PolicyService.class, PolicyServicePort.class, PolicyServicePort.class,
+ POLICY_SERVICE("PolicyService", false, PolicyService.class, PolicyServicePort.class,
SessionParameter.WEBSERVICES_POLICY_SERVICE, SessionParameter.WEBSERVICES_POLICY_SERVICE_ENDPOINT),
- ACL_SERVICE("ACLService", false, ACLService.class, ACLServicePort.class, ACLServicePort.class,
+ ACL_SERVICE("ACLService", false, ACLService.class, ACLServicePort.class,
SessionParameter.WEBSERVICES_ACL_SERVICE, SessionParameter.WEBSERVICES_ACL_SERVICE_ENDPOINT);
private String name;
private QName qname;
private boolean handlesContent;
private Class<? extends Service> serviceClass;
- private Class<?> port10Class;
- private Class<?> port11Class;
+ private Class<?> portClass;
private String wsdlKey;
private String endpointKey;
CmisWebSerivcesService(String localname, boolean handlesContent, Class<? extends Service> serviceClass,
- Class<?> port10Class, Class<?> port11Class, String wsdlKey, String endpointKey) {
+ Class<?> port11Class, String wsdlKey, String endpointKey) {
this.name = localname;
this.qname = new QName("http://docs.oasis-open.org/ns/cmis/ws/200908/", localname);
this.handlesContent = handlesContent;
this.serviceClass = serviceClass;
- this.port10Class = port10Class;
- this.port11Class = port11Class;
+ this.portClass = port11Class;
this.wsdlKey = wsdlKey;
this.endpointKey = endpointKey;
}
@@ -142,12 +152,8 @@ public abstract class AbstractPortProvid
return serviceClass;
}
- public Class<?> getPort10Class() {
- return port10Class;
- }
-
- public Class<?> getPort11Class() {
- return port11Class;
+ public Class<?> getPortClass() {
+ return portClass;
}
public String getWsdlKey() {
@@ -213,64 +219,91 @@ public abstract class AbstractPortProvid
/**
* Return the Repository Service port object.
*/
- public RepositoryServicePort getRepositoryServicePort() {
- return (RepositoryServicePort) getPortObject(CmisWebSerivcesService.REPOSITORY_SERVICE);
+ public RepositoryServicePort getRepositoryServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.REPOSITORY_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (RepositoryServicePort) portObject;
}
/**
* Return the Navigation Service port object.
*/
- public NavigationServicePort getNavigationServicePort() {
- return (NavigationServicePort) getPortObject(CmisWebSerivcesService.NAVIGATION_SERVICE);
+ public NavigationServicePort getNavigationServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.NAVIGATION_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (NavigationServicePort) portObject;
}
/**
* Return the Object Service port object.
*/
- public ObjectServicePort getObjectServicePort() {
- return (ObjectServicePort) getPortObject(CmisWebSerivcesService.OBJECT_SERVICE);
+ public ObjectServicePort getObjectServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.OBJECT_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (ObjectServicePort) portObject;
}
/**
* Return the Versioning Service port object.
*/
- public VersioningServicePort getVersioningServicePort() {
- return (VersioningServicePort) getPortObject(CmisWebSerivcesService.VERSIONING_SERVICE);
+ public VersioningServicePort getVersioningServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.VERSIONING_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (VersioningServicePort) portObject;
}
/**
* Return the Discovery Service port object.
*/
- public DiscoveryServicePort getDiscoveryServicePort() {
- return (DiscoveryServicePort) getPortObject(CmisWebSerivcesService.DISCOVERY_SERVICE);
+ public DiscoveryServicePort getDiscoveryServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.DISCOVERY_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (DiscoveryServicePort) portObject;
}
/**
* Return the MultiFiling Service port object.
*/
- public MultiFilingServicePort getMultiFilingServicePort() {
- return (MultiFilingServicePort) getPortObject(CmisWebSerivcesService.MULTIFILING_SERVICE);
+ public MultiFilingServicePort getMultiFilingServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.MULTIFILING_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (MultiFilingServicePort) portObject;
}
/**
* Return the Relationship Service port object.
*/
- public RelationshipServicePort getRelationshipServicePort() {
- return (RelationshipServicePort) getPortObject(CmisWebSerivcesService.RELATIONSHIP_SERVICE);
+ public RelationshipServicePort getRelationshipServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.RELATIONSHIP_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (RelationshipServicePort) portObject;
}
/**
* Return the Policy Service port object.
*/
- public PolicyServicePort getPolicyServicePort() {
- return (PolicyServicePort) getPortObject(CmisWebSerivcesService.POLICY_SERVICE);
+ public PolicyServicePort getPolicyServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.POLICY_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (PolicyServicePort) portObject;
}
/**
* Return the ACL Service port object.
*/
- public ACLServicePort getACLServicePort() {
- return (ACLServicePort) getPortObject(CmisWebSerivcesService.ACL_SERVICE);
+ public ACLServicePort getACLServicePort(CmisVersion cmisVersion, String soapAction) {
+ BindingProvider portObject = getPortObject(CmisWebSerivcesService.ACL_SERVICE);
+ setSoapAction(portObject, soapAction, cmisVersion);
+
+ return (ACLServicePort) portObject;
}
public void endCall(Object portObject) {
@@ -278,11 +311,13 @@ public abstract class AbstractPortProvid
if (authProvider != null && portObject instanceof BindingProvider) {
BindingProvider bp = (BindingProvider) portObject;
String url = (String) bp.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
- @SuppressWarnings("unchecked")
- Map<String, List<String>> headers = (Map<String, List<String>>) bp.getResponseContext().get(
- MessageContext.HTTP_RESPONSE_HEADERS);
- Integer statusCode = (Integer) bp.getResponseContext().get(MessageContext.HTTP_RESPONSE_CODE);
- authProvider.putResponseHeaders(url, statusCode == null ? -1 : statusCode, headers);
+ if (bp.getResponseContext() != null) {
+ @SuppressWarnings("unchecked")
+ Map<String, List<String>> headers = (Map<String, List<String>>) bp.getResponseContext().get(
+ MessageContext.HTTP_RESPONSE_HEADERS);
+ Integer statusCode = (Integer) bp.getResponseContext().get(MessageContext.HTTP_RESPONSE_CODE);
+ authProvider.putResponseHeaders(url, statusCode == null ? -1 : statusCode, headers);
+ }
}
}
@@ -351,12 +386,11 @@ public abstract class AbstractPortProvid
try {
// get URLs
- URL wsdlUrl = null;
URL endpointUrl = null;
String wsdlUrlStr = (String) session.get(service.getWsdlKey());
if (wsdlUrlStr != null) {
- wsdlUrl = new URL(wsdlUrlStr);
+ endpointUrl = getEndpointUrlFromWsdl(wsdlUrlStr, service);
} else {
String endpointUrlStr = (String) session.get(service.getEndpointKey());
if (endpointUrlStr != null) {
@@ -364,7 +398,7 @@ public abstract class AbstractPortProvid
}
}
- if (wsdlUrl == null && endpointUrl == null) {
+ if (endpointUrl == null) {
throw new CmisRuntimeException("Neither a WSDL URL nor an endpoint URL is specified for the service "
+ service.getServiceName() + "!");
}
@@ -372,7 +406,7 @@ public abstract class AbstractPortProvid
// build the requested service object
Constructor<? extends Service> serviceConstructor = service.getServiceClass().getConstructor(
new Class<?>[] { URL.class, QName.class });
- Service serviceObject = serviceConstructor.newInstance(new Object[] { wsdlUrl, service.getQName() });
+ Service serviceObject = serviceConstructor.newInstance(new Object[] { null, service.getQName() });
return new CmisServiceHolder(service, serviceObject, endpointUrl);
} catch (CmisBaseException ce) {
@@ -395,6 +429,83 @@ public abstract class AbstractPortProvid
}
/**
+ * Reads the URL and extracts the endpoint URL of the given service.
+ */
+ private URL getEndpointUrlFromWsdl(String wsdlUrl, CmisWebSerivcesService service) {
+ HttpInvoker hi = CmisBindingsHelper.getHttpInvoker(session);
+ Response wsdlResponse = hi.invokeGET(new UrlBuilder(wsdlUrl), session);
+
+ if (wsdlResponse.getResponseCode() != 200) {
+ throw new CmisConnectionException("Cannot access WSDL: " + wsdlUrl, BigInteger.ZERO,
+ wsdlResponse.getErrorContent());
+ }
+
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(false);
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(wsdlResponse.getStream());
+
+ NodeList serivceList = doc.getElementsByTagName("service");
+ for (int i = 0; i < serivceList.getLength(); i++) {
+ Element serviceNode = (Element) serivceList.item(i);
+
+ Attr attr = serviceNode.getAttributeNode("name");
+ if (attr == null) {
+ continue;
+ }
+
+ if (!service.getQName().getLocalPart().equals(attr.getValue())) {
+ continue;
+ }
+
+ NodeList portList = ((Element) serviceNode).getElementsByTagName("port");
+ if (portList.getLength() < 1) {
+ throw new CmisRuntimeException("This service has no ports: " + service.getServiceName());
+ }
+
+ Element port = (Element) portList.item(0);
+
+ NodeList addressList = port.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/soap/", "address");
+ if (addressList.getLength() < 1) {
+ throw new CmisRuntimeException("This service has no endpoint address: " + service.getServiceName());
+ }
+
+ Element address = (Element) addressList.item(0);
+
+ attr = address.getAttributeNode("location");
+ if (attr == null) {
+ throw new CmisRuntimeException("This service has no endpoint address: " + service.getServiceName());
+ }
+
+ try {
+ return new URL(attr.getValue());
+ } catch (MalformedURLException e) {
+ throw new CmisRuntimeException("This service provides an invalid endpoint address: "
+ + service.getServiceName());
+ }
+ }
+
+ throw new CmisRuntimeException("This service does not provide an endpoint address: "
+ + service.getServiceName());
+ } catch (ParserConfigurationException pe) {
+ throw new CmisRuntimeException("Cannot parse this WSDL: " + wsdlUrl, pe);
+ } catch (SAXException se) {
+ throw new CmisRuntimeException("Cannot parse this WSDL: " + wsdlUrl, se);
+ } catch (IOException ioe) {
+ throw new CmisRuntimeException("Cannot read this WSDL: " + wsdlUrl, ioe);
+ } finally {
+ try {
+ wsdlResponse.getStream().close();
+ } catch (IOException ioe) {
+ // ignore, there is nothing we can do
+ }
+ }
+ }
+
+ /**
* Sets the default HTTP headers on a {@link BindingProvider} object.
*/
protected void setHTTPHeaders(BindingProvider portObject, Map<String, List<String>> httpHeaders) {
@@ -435,11 +546,23 @@ public abstract class AbstractPortProvid
}
/**
+ * Sets the SOAP Action header.
+ */
+ protected void setSoapAction(BindingProvider portObject, String soapAction, CmisVersion cmisVersion) {
+ if (cmisVersion == CmisVersion.CMIS_1_0) {
+ portObject.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.FALSE);
+ } else {
+ portObject.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
+ portObject.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, soapAction);
+ }
+ }
+
+ /**
* Creates a simple port object from a CmisServiceHolder object.
*/
protected BindingProvider createPortObjectFromServiceHolder(CmisServiceHolder serviceHolder,
WebServiceFeature... features) {
- return (BindingProvider) serviceHolder.getServiceObject().getPort(serviceHolder.getService().getPort10Class(),
+ return (BindingProvider) serviceHolder.getServiceObject().getPort(serviceHolder.getService().getPortClass(),
features);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.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/AclServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AclServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -53,7 +53,7 @@ public class AclServiceImpl extends Abst
public Acl applyAcl(String repositoryId, String objectId, Acl addACEs, Acl removeACEs,
AclPropagation aclPropagation, ExtensionsData extension) {
- ACLServicePort port = portProvider.getACLServicePort();
+ ACLServicePort port = portProvider.getACLServicePort(getCmisVersion(repositoryId), "applyACL");
try {
return convert(port.applyACL(repositoryId, objectId, convert(addACEs), convert(removeACEs),
@@ -68,7 +68,7 @@ public class AclServiceImpl extends Abst
}
public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
- ACLServicePort port = portProvider.getACLServicePort();
+ ACLServicePort port = portProvider.getACLServicePort(getCmisVersion(repositoryId), "getACL");
try {
return convert(port.getACL(repositoryId, objectId, onlyBasicPermissions, convert(extension)));
@@ -82,28 +82,18 @@ public class AclServiceImpl extends Abst
}
public Acl setAcl(String repositoryId, String objectId, Acl aces) {
- ACLServicePort port = portProvider.getACLServicePort();
+ Acl currentAcl = getAcl(repositoryId, objectId, false, null);
- try {
- Acl currentAcl = convert(port.getACL(repositoryId, objectId, false, null));
-
- List<Ace> removeAces = new ArrayList<Ace>();
- if (currentAcl.getAces() != null) {
- for (Ace ace : currentAcl.getAces()) {
- if (ace.isDirect()) {
- removeAces.add(ace);
- }
+ List<Ace> removeAces = new ArrayList<Ace>();
+ if (currentAcl.getAces() != null) {
+ for (Ace ace : currentAcl.getAces()) {
+ if (ace.isDirect()) {
+ removeAces.add(ace);
}
}
-
- return convert(port.applyACL(repositoryId, objectId, convert(aces), convert(new AccessControlListImpl(
- removeAces)), convert(EnumACLPropagation.class, AclPropagation.OBJECTONLY), null));
- } catch (CmisException e) {
- throw convertException(e);
- } catch (Exception e) {
- throw new CmisRuntimeException("Error: " + e.getMessage(), e);
- } finally {
- portProvider.endCall(port);
}
+
+ return applyAcl(repositoryId, objectId, aces, new AccessControlListImpl(removeAces), AclPropagation.OBJECTONLY,
+ null);
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.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/DiscoveryServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/DiscoveryServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -53,7 +53,8 @@ public class DiscoveryServiceImpl extend
public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
String filter, Boolean includePolicyIds, Boolean includeACL, BigInteger maxItems, ExtensionsData extension) {
- DiscoveryServicePort port = portProvider.getDiscoveryServicePort();
+ DiscoveryServicePort port = portProvider.getDiscoveryServicePort(getCmisVersion(repositoryId),
+ "getContentChanges");
try {
javax.xml.ws.Holder<String> portChangeLokToken = convertHolder(changeLogToken);
@@ -77,7 +78,7 @@ public class DiscoveryServiceImpl extend
public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- DiscoveryServicePort port = portProvider.getDiscoveryServicePort();
+ DiscoveryServicePort port = portProvider.getDiscoveryServicePort(getCmisVersion(repositoryId), "query");
try {
return convert(port.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.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/MultiFilingServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -48,7 +48,8 @@ public class MultiFilingServiceImpl exte
public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
ExtensionsData extension) {
- MultiFilingServicePort port = portProvider.getMultiFilingServicePort();
+ MultiFilingServicePort port = portProvider.getMultiFilingServicePort(getCmisVersion(repositoryId),
+ "addObjectToFolder");
try {
Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
@@ -66,7 +67,8 @@ public class MultiFilingServiceImpl exte
}
public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
- MultiFilingServicePort port = portProvider.getMultiFilingServicePort();
+ MultiFilingServicePort port = portProvider.getMultiFilingServicePort(getCmisVersion(repositoryId),
+ "removeObjectFromFolder");
try {
Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.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/NavigationServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -58,7 +58,7 @@ public class NavigationServiceImpl exten
public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId), "getChildren");
try {
return convert(port.getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
@@ -76,7 +76,8 @@ public class NavigationServiceImpl exten
public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId),
+ "getDescendants");
try {
List<CmisObjectInFolderContainerType> containerList = port.getDescendants(repositoryId, folderId, depth,
@@ -105,7 +106,8 @@ public class NavigationServiceImpl exten
}
public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId),
+ "getFolderParent");
try {
return convert(port.getFolderParent(repositoryId, folderId, filter, convert(extension)));
@@ -121,7 +123,8 @@ public class NavigationServiceImpl exten
public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId),
+ "getFolderTree");
try {
List<CmisObjectInFolderContainerType> containerList = port.getFolderTree(repositoryId, folderId, depth,
@@ -152,7 +155,8 @@ public class NavigationServiceImpl exten
public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
Boolean includeRelativePathSegment, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId),
+ "getObjectParents");
try {
List<CmisObjectParentsType> parentsList = port.getObjectParents(repositoryId, objectId, filter,
@@ -183,7 +187,8 @@ public class NavigationServiceImpl exten
public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- NavigationServicePort port = portProvider.getNavigationServicePort();
+ NavigationServicePort port = portProvider.getNavigationServicePort(getCmisVersion(repositoryId),
+ "getCheckedOutDocs");
try {
return convert(port.getCheckedOutDocs(repositoryId, folderId, filter, orderBy, includeAllowableActions,
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=1470473&r1=1470472&r2=1470473&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 Apr 22 12:19:24 2013
@@ -46,6 +46,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectIdAndChangeTokenType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRenditionType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumUnfileObject;
@@ -72,7 +73,7 @@ public class ObjectServiceImpl extends A
public String createDocument(String repositoryId, Properties properties, String folderId,
ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addACEs,
Acl removeACEs, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "createDocument");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -97,7 +98,8 @@ public class ObjectServiceImpl extends A
public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
String folderId, VersioningState versioningState, List<String> policies, Acl addACEs, Acl removeACEs,
ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId),
+ "createDocumentFromSource");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -121,7 +123,7 @@ public class ObjectServiceImpl extends A
public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
Acl addACEs, Acl removeACEs, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "createFolder");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -144,7 +146,7 @@ public class ObjectServiceImpl extends A
public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
Acl addACEs, Acl removeACEs, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "createPolicy");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -171,7 +173,7 @@ public class ObjectServiceImpl extends A
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(CmisVersion.CMIS_1_1, "createItem");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -194,7 +196,7 @@ public class ObjectServiceImpl extends A
public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addACEs,
Acl removeACEs, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "createRelationship");
try {
javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
@@ -217,7 +219,7 @@ public class ObjectServiceImpl extends A
public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
Properties properties, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "updateProperties");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -245,11 +247,35 @@ public class ObjectServiceImpl extends A
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- throw new CmisNotSupportedException("Not supported!");
+ ObjectServicePort port = portProvider.getObjectServicePort(CmisVersion.CMIS_1_1, "bulkUpdateProperties");
+
+ try {
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+ javax.xml.ws.Holder<CmisObjectIdAndChangeTokenType> bulkUpdateResponse = new javax.xml.ws.Holder<CmisObjectIdAndChangeTokenType>();
+
+ port.bulkUpdateProperties(repositoryId,
+ convert(objectIdAndChangeToken, properties, addSecondaryTypeIds, removeSecondaryTypeIds),
+ portExtension, bulkUpdateResponse);
+
+ setExtensionValues(portExtension, extension);
+
+ List<BulkUpdateObjectIdAndChangeToken> result = null;
+ if (bulkUpdateResponse.value != null) {
+ // TODO: fix
+ }
+
+ return result;
+ } catch (CmisException e) {
+ throw convertException(e);
+ } catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ } finally {
+ portProvider.endCall(port);
+ }
}
public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "deleteObject");
try {
javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
@@ -268,7 +294,7 @@ public class ObjectServiceImpl extends A
public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "deleteTree");
try {
return convert(port.deleteTree(repositoryId, folderId, allVersions,
@@ -283,7 +309,7 @@ public class ObjectServiceImpl extends A
}
public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getAllowableActions");
try {
return convert(port.getAllowableActions(repositoryId, objectId, convert(extension)));
@@ -298,7 +324,7 @@ public class ObjectServiceImpl extends A
public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
BigInteger length, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getContentStream");
try {
return convert(port.getContentStream(repositoryId, objectId, streamId, offset, length, convert(extension)));
@@ -314,7 +340,7 @@ public class ObjectServiceImpl extends A
public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
Boolean includeACL, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getObject");
try {
return convert(port.getObject(repositoryId, objectId, filter, includeAllowableActions,
@@ -332,7 +358,7 @@ public class ObjectServiceImpl extends A
public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
Boolean includeACL, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getObjectByPath");
try {
return convert(port.getObjectByPath(repositoryId, path, filter, includeAllowableActions,
@@ -348,7 +374,7 @@ public class ObjectServiceImpl extends A
}
public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getProperties");
try {
return convert(port.getProperties(repositoryId, objectId, filter, convert(extension)));
@@ -363,7 +389,7 @@ public class ObjectServiceImpl extends A
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "getRenditions");
try {
List<CmisRenditionType> renditionList = port.getRenditions(repositoryId, objectId, renditionFilter,
@@ -392,7 +418,7 @@ public class ObjectServiceImpl extends A
public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "moveObject");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -413,7 +439,7 @@ public class ObjectServiceImpl extends A
public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "setContentStream");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -437,7 +463,7 @@ public class ObjectServiceImpl extends A
public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
ExtensionsData extension) {
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(getCmisVersion(repositoryId), "deleteContentStream");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -464,7 +490,7 @@ public class ObjectServiceImpl extends A
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- ObjectServicePort port = portProvider.getObjectServicePort();
+ ObjectServicePort port = portProvider.getObjectServicePort(CmisVersion.CMIS_1_1, "appendContentStream");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.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/PolicyServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -25,6 +25,8 @@ import static org.apache.chemistry.openc
import java.util.ArrayList;
import java.util.List;
+import javax.xml.ws.Holder;
+
import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.data.ObjectData;
@@ -35,8 +37,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.jaxb.PolicyServicePort;
import org.apache.chemistry.opencmis.commons.spi.PolicyService;
-import javax.xml.ws.Holder;
-
/**
* Policy Service Web Services client.
*/
@@ -53,7 +53,7 @@ public class PolicyServiceImpl extends A
}
public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- PolicyServicePort port = portProvider.getPolicyServicePort();
+ PolicyServicePort port = portProvider.getPolicyServicePort(getCmisVersion(repositoryId), "applyPolicy");
try {
Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
@@ -71,7 +71,7 @@ public class PolicyServiceImpl extends A
}
public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
- PolicyServicePort port = portProvider.getPolicyServicePort();
+ PolicyServicePort port = portProvider.getPolicyServicePort(getCmisVersion(repositoryId), "removePolicy");
try {
Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
@@ -90,7 +90,7 @@ public class PolicyServiceImpl extends A
public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
ExtensionsData extension) {
- PolicyServicePort port = portProvider.getPolicyServicePort();
+ PolicyServicePort port = portProvider.getPolicyServicePort(getCmisVersion(repositoryId), "getAppliedPolicies");
try {
List<CmisObjectType> policyList = port.getAppliedPolicies(repositoryId, objectId, filter,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.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/RelationshipServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -50,7 +50,8 @@ public class RelationshipServiceImpl ext
public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- RelationshipServicePort port = portProvider.getRelationshipServicePort();
+ RelationshipServicePort port = portProvider.getRelationshipServicePort(getCmisVersion(repositoryId),
+ "getObjectRelationships");
try {
return convert(port.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.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/RepositoryServiceImpl.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java Mon Apr 22 12:19:24 2013
@@ -60,7 +60,7 @@ public class RepositoryServiceImpl exten
}
public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(CmisVersion.CMIS_1_1, "getRepositories");
List<RepositoryInfo> infos = null;
try {
@@ -88,7 +88,7 @@ public class RepositoryServiceImpl exten
}
public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(CmisVersion.CMIS_1_1, "getRepositoryInfo");
try {
return convert(port.getRepositoryInfo(repositoryId, convert(extension)));
@@ -102,7 +102,8 @@ public class RepositoryServiceImpl exten
}
public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(getCmisVersion(repositoryId),
+ "getTypeDefinition");
try {
return convert(port.getTypeDefinition(repositoryId, typeId, convert(extension)));
@@ -117,7 +118,8 @@ public class RepositoryServiceImpl exten
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(getCmisVersion(repositoryId),
+ "getTypeChildren");
try {
return convert(port.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount,
@@ -133,7 +135,8 @@ public class RepositoryServiceImpl exten
public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
Boolean includePropertyDefinitions, ExtensionsData extension) {
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(getCmisVersion(repositoryId),
+ "getTypeDescendants");
try {
return convertTypeContainerList(port.getTypeDescendants(repositoryId, typeId, depth,
@@ -152,7 +155,7 @@ public class RepositoryServiceImpl exten
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(CmisVersion.CMIS_1_1, "createType");
try {
javax.xml.ws.Holder<CmisTypeDefinitionType> typeDef = new javax.xml.ws.Holder<CmisTypeDefinitionType>(
@@ -175,7 +178,7 @@ public class RepositoryServiceImpl exten
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(CmisVersion.CMIS_1_1, "updateType");
try {
javax.xml.ws.Holder<CmisTypeDefinitionType> typeDef = new javax.xml.ws.Holder<CmisTypeDefinitionType>(
@@ -198,7 +201,7 @@ public class RepositoryServiceImpl exten
throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
}
- RepositoryServicePort port = portProvider.getRepositoryServicePort();
+ RepositoryServicePort port = portProvider.getRepositoryServicePort(CmisVersion.CMIS_1_1, "deleteType");
try {
javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunPortProvider.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/SunPortProvider.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SunPortProvider.java Mon Apr 22 12:19:24 2013
@@ -91,11 +91,13 @@ public class SunPortProvider extends Abs
: serviceHolder.getServiceObject().getWSDLDocumentLocation().toString());
httpHeaders = authProvider.getHTTPHeaders(url);
+ // SSL Factory
SSLSocketFactory sf = authProvider.getSSLSocketFactory();
if (sf != null) {
portObject.getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, sf);
}
+ // Hostname Verifier
HostnameVerifier hv = authProvider.getHostnameVerifier();
if (hv != null) {
portObject.getRequestContext().put(JAXWSProperties.HOSTNAME_VERIFIER, hv);
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=1470473&r1=1470472&r2=1470473&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 Mon Apr 22 12:19:24 2013
@@ -60,7 +60,7 @@ public class VersioningServiceImpl exten
public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
Holder<Boolean> contentCopied) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId), "checkOut");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -82,7 +82,8 @@ public class VersioningServiceImpl exten
}
public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId),
+ "cancelCheckOut");
try {
javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
@@ -102,7 +103,7 @@ public class VersioningServiceImpl exten
public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
ContentStream contentStream, String checkinComment, List<String> policies, Acl addACEs, Acl removeACEs,
ExtensionsData extension) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId), "checkIn");
try {
javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
@@ -124,7 +125,8 @@ public class VersioningServiceImpl exten
public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
Boolean includeAllowableActions, ExtensionsData extension) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId),
+ "getAllVersions");
try {
List<CmisObjectType> versionList = port.getAllVersions(repositoryId, versionSeriesId, filter,
@@ -154,7 +156,8 @@ public class VersioningServiceImpl exten
public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
String renditionFilter, Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId),
+ "getObjectOfLatestVersion");
try {
return convert(port.getObjectOfLatestVersion(repositoryId, versionSeriesId, major, filter,
@@ -171,7 +174,8 @@ public class VersioningServiceImpl exten
public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
Boolean major, String filter, ExtensionsData extension) {
- VersioningServicePort port = portProvider.getVersioningServicePort();
+ VersioningServicePort port = portProvider.getVersioningServicePort(getCmisVersion(repositoryId),
+ "getPropertiesOfLatestVersion");
try {
return convert(port.getPropertiesOfLatestVersion(repositoryId, versionSeriesId, major, filter,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/WebSpherePortProvider.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/WebSpherePortProvider.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/WebSpherePortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/WebSpherePortProvider.java Mon Apr 22 12:19:24 2013
@@ -84,6 +84,10 @@ public class WebSpherePortProvider exten
String url = (serviceHolder.getEndpointUrl() != null ? serviceHolder.getEndpointUrl().toString()
: serviceHolder.getServiceObject().getWSDLDocumentLocation().toString());
httpHeaders = authProvider.getHTTPHeaders(url);
+
+ // TODO: set SSL Factory
+
+ // TODO: set Hostname Verifier
}
// set HTTP headers
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.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/WSConverter.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java Mon Apr 22 12:19:24 2013
@@ -49,6 +49,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.Acl;
import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
import org.apache.chemistry.opencmis.commons.data.AllowableActions;
+import org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
import org.apache.chemistry.opencmis.commons.data.CmisExtensionElement;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
import org.apache.chemistry.opencmis.commons.data.CreatablePropertyTypes;
@@ -125,6 +126,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.AllowableActionsImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChangeEventInfoDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl;
@@ -178,6 +180,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlPrincipalType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAllowableActionsType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisBulkUpdateType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisChangeEventType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisChoiceBoolean;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisChoiceDateTime;
@@ -194,6 +197,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisListOfIdsType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisNewTypeSettableAttributes;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectIdAndChangeTokenType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectInFolderContainerType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectInFolderListType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectInFolderType;
@@ -2648,6 +2652,75 @@ public final class WSConverter {
}
// -------------------------------------------------------------------------
+ // --- Bulk update ---
+ // -------------------------------------------------------------------------
+
+ /**
+ * Converts bulk update data.
+ */
+ public static CmisBulkUpdateType convert(List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeTokens,
+ Properties properties, List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds) {
+ if (objectIdAndChangeTokens == null) {
+ return null;
+ }
+
+ CmisBulkUpdateType result = new CmisBulkUpdateType();
+
+ for (BulkUpdateObjectIdAndChangeToken idAndToken : objectIdAndChangeTokens) {
+ result.getObjectIdAndChangeToken().add(convert(idAndToken));
+ }
+ result.setProperties(convert(properties));
+ if (addSecondaryTypeIds != null) {
+ result.getAddSecondaryTypeIds().addAll(addSecondaryTypeIds);
+ }
+ if (removeSecondaryTypeIds != null) {
+ result.getRemoveSecondaryTypeIds().addAll(removeSecondaryTypeIds);
+ }
+
+ return result;
+ }
+
+ /**
+ * Converts bulk update object id and change token.
+ */
+ public static CmisObjectIdAndChangeTokenType convert(BulkUpdateObjectIdAndChangeToken objectIdAndChangeToken) {
+ if (objectIdAndChangeToken == null) {
+ return null;
+ }
+
+ CmisObjectIdAndChangeTokenType result = new CmisObjectIdAndChangeTokenType();
+
+ result.setId(objectIdAndChangeToken.getId());
+ result.setNewId(objectIdAndChangeToken.getNewId());
+ result.setChangeToken(objectIdAndChangeToken.getChangeToken());
+
+ // handle extensions
+ convertExtension(objectIdAndChangeToken, result);
+
+ return result;
+ }
+
+ /**
+ * Converts bulk update object id and change token.
+ */
+ public static BulkUpdateObjectIdAndChangeToken convert(CmisObjectIdAndChangeTokenType objectIdAndChangeToken) {
+ if (objectIdAndChangeToken == null) {
+ return null;
+ }
+
+ BulkUpdateObjectIdAndChangeTokenImpl result = new BulkUpdateObjectIdAndChangeTokenImpl();
+
+ result.setId(objectIdAndChangeToken.getId());
+ result.setNewId(objectIdAndChangeToken.getNewId());
+ result.setChangeToken(objectIdAndChangeToken.getChangeToken());
+
+ // handle extensions
+ convertExtension(objectIdAndChangeToken, result);
+
+ return result;
+ }
+
+ // -------------------------------------------------------------------------
// --- Extensions and holders ---
// -------------------------------------------------------------------------
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=1470473&r1=1470472&r2=1470473&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 Mon Apr 22 12:19:24 2013
@@ -34,7 +34,9 @@ import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.soap.MTOM;
+import org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.data.Properties;
import org.apache.chemistry.opencmis.commons.data.RenditionData;
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
@@ -46,14 +48,12 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisFaultType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectIdAndChangeTokenType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisPropertiesType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRenditionType;
import org.apache.chemistry.opencmis.commons.impl.jaxb.DeleteTreeResponse.FailedToDelete;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumServiceException;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumUnfileObject;
import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumVersioningState;
import org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectServicePort;
@@ -196,14 +196,27 @@ public class ObjectService extends Abstr
}
public void createItem(String repositoryId, CmisPropertiesType properties, String folderId,
- CmisAccessControlListType addACEs, CmisAccessControlListType removeACEs,
+ CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
- CmisFaultType fault = new CmisFaultType();
- fault.setMessage("Not supported!");
- fault.setCode(BigInteger.ZERO);
- fault.setType(EnumServiceException.NOT_SUPPORTED);
+ CmisService service = null;
+ try {
+ service = getService(wsContext, repositoryId);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createItem(repositoryId, convert(properties), folderId, null, convert(addAces, null),
+ convert(removeAces, null), extData);
- throw new CmisException(fault.getMessage(), fault);
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ } catch (Exception e) {
+ throw convertException(e);
+ } finally {
+ closeService(service);
+ }
}
public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
@@ -418,12 +431,25 @@ public class ObjectService extends Abstr
public void appendContentStream(String repositoryId, Holder<String> objectId, Boolean isLastChunk,
Holder<String> changeToken, CmisContentStreamType contentStream, Holder<CmisExtensionType> extension)
throws CmisException {
- CmisFaultType fault = new CmisFaultType();
- fault.setMessage("Not supported!");
- fault.setCode(BigInteger.ZERO);
- fault.setType(EnumServiceException.NOT_SUPPORTED);
+ CmisService service = null;
+ try {
+ service = getService(wsContext, repositoryId);
- throw new CmisException(fault.getMessage(), fault);
+ org.apache.chemistry.opencmis.commons.spi.Holder<String> objectIdHolder = convertHolder(objectId);
+ org.apache.chemistry.opencmis.commons.spi.Holder<String> changeTokenHolder = convertHolder(changeToken);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.appendContentStream(repositoryId, objectIdHolder, changeTokenHolder, convert(contentStream),
+ isLastChunk, extData);
+
+ setHolderValue(objectIdHolder, objectId);
+ setHolderValue(changeTokenHolder, changeToken);
+ setExtensionValues(extData, extension);
+ } catch (Exception e) {
+ throw convertException(e);
+ } finally {
+ closeService(service);
+ }
}
public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
@@ -451,12 +477,44 @@ public class ObjectService extends Abstr
public void bulkUpdateProperties(String repositoryId, CmisBulkUpdateType bulkUpdateData,
Holder<CmisExtensionType> extension, Holder<CmisObjectIdAndChangeTokenType> objectIdAndChangeToken)
throws CmisException {
- CmisFaultType fault = new CmisFaultType();
- fault.setMessage("Not supported!");
- fault.setCode(BigInteger.ZERO);
- fault.setType(EnumServiceException.NOT_SUPPORTED);
+ CmisService service = null;
+ try {
+ service = getService(wsContext, repositoryId);
- throw new CmisException(fault.getMessage(), fault);
- }
+ ExtensionsData extData = convertExtensionHolder(extension);
+ List<BulkUpdateObjectIdAndChangeToken> objectIdsAndChangeTokens = null;
+ Properties properties = null;
+ List<String> addSecondaryTypeIds = null;
+ List<String> removeSecondaryTypeIds = null;
+ if (bulkUpdateData != null) {
+ if (!bulkUpdateData.getObjectIdAndChangeToken().isEmpty()) {
+ objectIdsAndChangeTokens = new ArrayList<BulkUpdateObjectIdAndChangeToken>();
+ for (CmisObjectIdAndChangeTokenType idAndToken : bulkUpdateData.getObjectIdAndChangeToken()) {
+ objectIdsAndChangeTokens.add(convert(idAndToken));
+ }
+ }
+ properties = convert(bulkUpdateData.getProperties());
+ if (!bulkUpdateData.getAddSecondaryTypeIds().isEmpty()) {
+ addSecondaryTypeIds = bulkUpdateData.getAddSecondaryTypeIds();
+ }
+ if (!bulkUpdateData.getRemoveSecondaryTypeIds().isEmpty()) {
+ removeSecondaryTypeIds = bulkUpdateData.getRemoveSecondaryTypeIds();
+ }
+ }
+
+ List<BulkUpdateObjectIdAndChangeToken> result = service.bulkUpdateProperties(repositoryId,
+ objectIdsAndChangeTokens, properties, addSecondaryTypeIds, removeSecondaryTypeIds, extData);
+
+ if (objectIdAndChangeToken != null) {
+ // TODO: fix
+ }
+
+ setExtensionValues(extData, extension);
+ } catch (Exception e) {
+ throw convertException(e);
+ } finally {
+ closeService(service);
+ }
+ }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService10.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/ObjectService10.java?rev=1470473&r1=1470472&r2=1470473&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService10.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService10.java Mon Apr 22 12:19:24 2013
@@ -28,7 +28,7 @@ import com.sun.xml.ws.developer.Streamin
*/
@MTOM
@StreamingAttachment(parseEagerly = true, memoryThreshold = 4 * 1024 * 1204)
-@WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.webservices.ObjectServicePort10")
+@WebService(endpointInterface = "org.apache.chemistry.opencmis.server.impl.webservices.ObjectServicePort10")
public class ObjectService10 extends ObjectService {
}