You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2010/04/15 12:33:51 UTC
svn commit: r934361 [6/9] - in /incubator/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/s...
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,254 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+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.CmisObjectInFolderContainerType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectParentsType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.NavigationServicePort;
+import org.apache.chemistry.opencmis.commons.provider.NavigationService;
+import org.apache.chemistry.opencmis.commons.provider.ObjectData;
+import org.apache.chemistry.opencmis.commons.provider.ObjectInFolderContainer;
+import org.apache.chemistry.opencmis.commons.provider.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.provider.ObjectList;
+import org.apache.chemistry.opencmis.commons.provider.ObjectParentData;
+
+/**
+ * Navigation Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class NavigationServiceImpl extends AbstractWebServicesService implements NavigationService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public NavigationServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getChildren(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * java.math.BigInteger, java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ 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 = fPortProvider.getNavigationServicePort();
+
+ try {
+ return convert(port.getChildren(repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(EnumIncludeRelationships.class, includeRelationships),
+ renditionFilter, includePathSegment, maxItems, skipCount, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getDescendants(java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, ExtensionsData extension) {
+ NavigationServicePort port = fPortProvider.getNavigationServicePort();
+
+ try {
+ List<CmisObjectInFolderContainerType> containerList = port.getDescendants(repositoryId,
+ folderId, depth, filter, includeAllowableActions, convert(EnumIncludeRelationships.class,
+ includeRelationships), renditionFilter, includePathSegment, convert(extension));
+
+ // no list?
+ if (containerList == null) {
+ return null;
+ }
+
+ // convert list
+ List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
+ for (CmisObjectInFolderContainerType container : containerList) {
+ result.add(convert(container));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getFolderParent(java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public ObjectData getFolderParent(String repositoryId, String folderId, String filter,
+ ExtensionsData extension) {
+ NavigationServicePort port = fPortProvider.getNavigationServicePort();
+
+ try {
+ return convert(port.getFolderParent(repositoryId, folderId, filter, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getFolderTree(java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, ExtensionsData extension) {
+ NavigationServicePort port = fPortProvider.getNavigationServicePort();
+
+ try {
+ List<CmisObjectInFolderContainerType> containerList = port.getFolderTree(repositoryId,
+ folderId, depth, filter, includeAllowableActions, convert(EnumIncludeRelationships.class,
+ includeRelationships), renditionFilter, includePathSegment, convert(extension));
+
+ // no list?
+ if (containerList == null) {
+ return null;
+ }
+
+ // convert list
+ List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
+ for (CmisObjectInFolderContainerType container : containerList) {
+ result.add(convert(container));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getObjectParents(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<ObjectParentData> getObjectParents(String repositoryId, String objectId,
+ String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includeRelativePathSegment, ExtensionsData extension) {
+ NavigationServicePort port = fPortProvider.getNavigationServicePort();
+
+ try {
+ List<CmisObjectParentsType> parentsList = port.getObjectParents(repositoryId, objectId,
+ filter, includeAllowableActions, convert(EnumIncludeRelationships.class,
+ includeRelationships), renditionFilter, includeRelativePathSegment,
+ convert(extension));
+
+ // no list?
+ if (parentsList == null) {
+ return null;
+ }
+
+ // convert list
+ List<ObjectParentData> result = new ArrayList<ObjectParentData>();
+ for (CmisObjectParentsType parent : parentsList) {
+ result.add(convert(parent));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.NavigationService#getCheckedOutDocs(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.math.BigInteger,
+ * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ 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 = fPortProvider.getNavigationServicePort();
+
+ try {
+ return convert(port.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(EnumIncludeRelationships.class, includeRelationships),
+ renditionFilter, maxItems, skipCount, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/NavigationServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,557 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertHolder;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.setExtensionValues;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.setHolderValue;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.enums.UnfileObjects;
+import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+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.CmisRenditionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+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;
+import org.apache.chemistry.opencmis.commons.provider.AccessControlList;
+import org.apache.chemistry.opencmis.commons.provider.AllowableActionsData;
+import org.apache.chemistry.opencmis.commons.provider.ContentStreamData;
+import org.apache.chemistry.opencmis.commons.provider.FailedToDeleteData;
+import org.apache.chemistry.opencmis.commons.provider.Holder;
+import org.apache.chemistry.opencmis.commons.provider.ObjectData;
+import org.apache.chemistry.opencmis.commons.provider.ObjectService;
+import org.apache.chemistry.opencmis.commons.provider.PropertiesData;
+import org.apache.chemistry.opencmis.commons.provider.RenditionData;
+
+/**
+ * Object Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class ObjectServiceImpl extends AbstractWebServicesService implements ObjectService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public ObjectServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#createDocument(java.lang.String,
+ * org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
+ * org.apache.opencmis.client.provider.ContentStreamData, org.apache.opencmis.commons.enums.VersioningState,
+ * java.util.List, org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public String createDocument(String repositoryId, PropertiesData properties, String folderId,
+ ContentStreamData contentStream, VersioningState versioningState, List<String> policies,
+ AccessControlList addACEs, AccessControlList removeACEs, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ 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),
+ convert(EnumVersioningState.class, versioningState), policies, convert(addACEs),
+ convert(removeACEs), portExtension, objectId);
+
+ setExtensionValues(portExtension, extension);
+
+ return objectId.value;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#createDocumentFromSource(java.lang.String,
+ * java.lang.String, org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
+ * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
+ * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public String createDocumentFromSource(String repositoryId, String sourceId,
+ PropertiesData properties, String folderId, VersioningState versioningState,
+ List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.createDocumentFromSource(repositoryId, sourceId, convert(properties), folderId, convert(
+ EnumVersioningState.class, versioningState), policies, convert(addACEs),
+ convert(removeACEs), portExtension, objectId);
+
+ setExtensionValues(portExtension, extension);
+
+ return objectId.value;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#createFolder(java.lang.String,
+ * org.apache.opencmis.client.provider.PropertiesData, java.lang.String, java.util.List,
+ * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public String createFolder(String repositoryId, PropertiesData properties, String folderId,
+ List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.createFolder(repositoryId, convert(properties), folderId, policies, convert(addACEs),
+ convert(removeACEs), portExtension, objectId);
+
+ setExtensionValues(portExtension, extension);
+
+ return objectId.value;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#createPolicy(java.lang.String,
+ * org.apache.opencmis.client.provider.PropertiesData, java.lang.String, java.util.List,
+ * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public String createPolicy(String repositoryId, PropertiesData properties, String folderId,
+ List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.createPolicy(repositoryId, convert(properties), folderId, policies, convert(addACEs),
+ convert(removeACEs), portExtension, objectId);
+
+ setExtensionValues(portExtension, extension);
+
+ return objectId.value;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#createRelationship(java.lang.String,
+ * org.apache.opencmis.client.provider.PropertiesData, java.util.List,
+ * org.apache.opencmis.client.provider.AccessControlList, org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public String createRelationship(String repositoryId, PropertiesData properties,
+ List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.createRelationship(repositoryId, convert(properties), policies, convert(addACEs),
+ convert(removeACEs), portExtension, objectId);
+
+ setExtensionValues(portExtension, extension);
+
+ return objectId.value;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#updateProperties(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, org.apache.opencmis.client.provider.Holder,
+ * org.apache.opencmis.client.provider.PropertiesData, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void updateProperties(String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, PropertiesData properties, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
+ javax.xml.ws.Holder<String> portChangeToken = convertHolder(changeToken);
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.updateProperties(repositoryId, portObjectId, portChangeToken, convert(properties),
+ portExtension);
+
+ setHolderValue(portObjectId, objectId);
+ setHolderValue(portChangeToken, changeToken);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#deleteObject(java.lang.String,
+ * java.lang.String, java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void deleteObject(String repositoryId, String objectId, Boolean allVersions,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.deleteObject(repositoryId, objectId, allVersions, portExtension);
+
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#deleteTree(java.lang.String, java.lang.String,
+ * java.lang.Boolean, org.apache.opencmis.commons.enums.UnfileObject, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
+ UnfileObjects unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.deleteTree(repositoryId, folderId, allVersions, convert(
+ EnumUnfileObject.class, unfileObjects), continueOnFailure, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getAllowableActions(java.lang.String,
+ * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public AllowableActionsData getAllowableActions(String repositoryId, String objectId,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.getAllowableActions(repositoryId, objectId, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getContentStream(java.lang.String,
+ * java.lang.String, java.lang.String, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public ContentStreamData getContentStream(String repositoryId, String objectId, String streamId,
+ BigInteger offset, BigInteger length, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.getContentStream(repositoryId, objectId, streamId, offset, length,
+ convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getObject(java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships,
+ * java.lang.String, java.lang.Boolean, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public ObjectData getObject(String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.getObject(repositoryId, objectId, filter, includeAllowableActions,
+ convert(EnumIncludeRelationships.class, includeRelationships), renditionFilter,
+ includePolicyIds, includeACL, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getObjectByPath(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public ObjectData getObjectByPath(String repositoryId, String path, String filter,
+ Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.getObjectByPath(repositoryId, path, filter, includeAllowableActions,
+ convert(EnumIncludeRelationships.class, includeRelationships), renditionFilter,
+ includePolicyIds, includeACL, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getProperties(java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public PropertiesData getProperties(String repositoryId, String objectId, String filter,
+ ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ return convert(port.getProperties(repositoryId, objectId, filter, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#getRenditions(java.lang.String,
+ * java.lang.String, java.lang.String, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<RenditionData> getRenditions(String repositoryId, String objectId,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ List<CmisRenditionType> renditionList = port.getRenditions(repositoryId, objectId,
+ renditionFilter, maxItems, skipCount, convert(extension));
+
+ // no list?
+ if (renditionList == null) {
+ return null;
+ }
+
+ // convert list
+ List<RenditionData> result = new ArrayList<RenditionData>();
+ for (CmisRenditionType rendition : renditionList) {
+ result.add(convert(rendition));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#moveObject(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, java.lang.String, java.lang.String,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId,
+ String sourceFolderId, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.moveObject(repositoryId, portObjectId, targetFolderId, sourceFolderId, portExtension);
+
+ setHolderValue(portObjectId, objectId);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#setContentStream(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, java.lang.Boolean, org.apache.opencmis.client.provider.Holder,
+ * org.apache.opencmis.client.provider.ContentStreamData, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
+ Holder<String> changeToken, ContentStreamData contentStream, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
+ 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);
+
+ setHolderValue(portObjectId, objectId);
+ setHolderValue(portChangeToken, changeToken);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.ObjectService#deleteContentStream(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, org.apache.opencmis.client.provider.Holder,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void deleteContentStream(String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, ExtensionsData extension) {
+ ObjectServicePort port = fPortProvider.getObjectServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
+ javax.xml.ws.Holder<String> portChangeToken = convertHolder(changeToken);
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.deleteContentStream(repositoryId, portObjectId, portChangeToken, portExtension);
+
+ setHolderValue(portObjectId, objectId);
+ setHolderValue(portChangeToken, changeToken);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.setExtensionValues;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+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.CmisObjectType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.PolicyServicePort;
+import org.apache.chemistry.opencmis.commons.provider.ObjectData;
+import org.apache.chemistry.opencmis.commons.provider.PolicyService;
+
+/**
+ * Policy Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class PolicyServiceImpl extends AbstractWebServicesService implements PolicyService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public PolicyServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.PolicyService#applyPolicy(java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void applyPolicy(String repositoryId, String policyId, String objectId,
+ ExtensionsData extension) {
+ PolicyServicePort port = fPortProvider.getPolicyServicePort();
+
+ try {
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.applyPolicy(repositoryId, policyId, objectId, portExtension);
+
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.PolicyService#removePolicy(java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void removePolicy(String repositoryId, String policyId, String objectId,
+ ExtensionsData extension) {
+ PolicyServicePort port = fPortProvider.getPolicyServicePort();
+
+ try {
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.removePolicy(repositoryId, policyId, objectId, portExtension);
+
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.PolicyService#getAppliedPolicies(java.lang.String,
+ * java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
+ ExtensionsData extension) {
+ PolicyServicePort port = fPortProvider.getPolicyServicePort();
+
+ try {
+ List<CmisObjectType> policyList = port.getAppliedPolicies(repositoryId, objectId, filter,
+ convert(extension));
+
+ // no list?
+ if (policyList == null) {
+ return null;
+ }
+
+ // convert list
+ List<ObjectData> result = new ArrayList<ObjectData>();
+ for (CmisObjectType policy : policyList) {
+ result.add(convert(policy));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PolicyServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,316 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.soap.MTOMFeature;
+
+import org.apache.chemistry.opencmis.client.bindings.impl.CmisBindingsHelper;
+import org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider;
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.SessionParameter;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+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;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingService;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.NavigationService;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.NavigationServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectService;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.PolicyService;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.PolicyServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipService;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipServicePort;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryService;
+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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
+
+import com.sun.xml.ws.api.message.Headers;
+import com.sun.xml.ws.developer.JAXWSProperties;
+import com.sun.xml.ws.developer.StreamingAttachmentFeature;
+import com.sun.xml.ws.developer.WSBindingProvider;
+
+/**
+ * Provides CMIS Web Services port objects. Handles authentication headers.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class PortProvider {
+
+ private static Log log = LogFactory.getLog(PortProvider.class);
+
+ public static final String CMIS_NAMESPACE = "http://docs.oasis-open.org/ns/cmis/ws/200908/";
+
+ public static final String REPOSITORY_SERVICE = "RepositoryService";
+ public static final String OBJECT_SERVICE = "ObjectService";
+ public static final String DISCOVERY_SERVICE = "DiscoveryService";
+ public static final String NAVIGATION_SERVICE = "NavigationService";
+ public static final String MULTIFILING_SERVICE = "MulifilingService";
+ public static final String VERSIONING_SERVICE = "VersioningService";
+ public static final String RELATIONSHIP_SERVICE = "RelationshipService";
+ public static final String POLICY_SERVICE = "PolicyService";
+ public static final String ACL_SERVICE = "ACLService";
+
+ private static final int CHUNK_SIZE = 64 * 1024;
+
+ private final Session fSession;
+
+ /**
+ * Constructor.
+ */
+ public PortProvider(Session session) {
+ fSession = session;
+ }
+
+ /**
+ * Return the Repository Service port object.
+ */
+ public RepositoryServicePort getRepositoryServicePort() {
+ return (RepositoryServicePort) getPortObject(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE);
+ }
+
+ /**
+ * Return the Navigation Service port object.
+ */
+ public NavigationServicePort getNavigationServicePort() {
+ return (NavigationServicePort) getPortObject(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE);
+ }
+
+ /**
+ * Return the Object Service port object.
+ */
+ public ObjectServicePort getObjectServicePort() {
+ return (ObjectServicePort) getPortObject(SessionParameter.WEBSERVICES_OBJECT_SERVICE);
+ }
+
+ /**
+ * Return the Versioning Service port object.
+ */
+ public VersioningServicePort getVersioningServicePort() {
+ return (VersioningServicePort) getPortObject(SessionParameter.WEBSERVICES_VERSIONING_SERVICE);
+ }
+
+ /**
+ * Return the Discovery Service port object.
+ */
+ public DiscoveryServicePort getDiscoveryServicePort() {
+ return (DiscoveryServicePort) getPortObject(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE);
+ }
+
+ /**
+ * Return the MultiFiling Service port object.
+ */
+ public MultiFilingServicePort getMultiFilingServicePort() {
+ return (MultiFilingServicePort) getPortObject(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE);
+ }
+
+ /**
+ * Return the Relationship Service port object.
+ */
+ public RelationshipServicePort getRelationshipServicePort() {
+ return (RelationshipServicePort) getPortObject(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE);
+ }
+
+ /**
+ * Return the Policy Service port object.
+ */
+ public PolicyServicePort getPolicyServicePort() {
+ return (PolicyServicePort) getPortObject(SessionParameter.WEBSERVICES_POLICY_SERVICE);
+ }
+
+ /**
+ * Return the ACL Service port object.
+ */
+ public ACLServicePort getACLServicePort() {
+ return (ACLServicePort) getPortObject(SessionParameter.WEBSERVICES_ACL_SERVICE);
+ }
+
+ // ---- internal ----
+
+ /**
+ * Gets a port object from the session or (re-)initializes the port objects.
+ */
+ @SuppressWarnings("unchecked")
+ private Object getPortObject(String portKey) {
+ Map<String, Object> portMap = (Map<String, Object>) fSession.get(SpiSessionParameter.PORTS);
+
+ // does the port map exist?
+ if (portMap == null) {
+ fSession.writeLock();
+ try {
+ // try again
+ portMap = (Map<String, Object>) fSession.get(SpiSessionParameter.PORTS);
+ if (portMap == null) {
+ portMap = Collections.synchronizedMap(new HashMap<String, Object>());
+ fSession.put(SpiSessionParameter.PORTS, portMap, true);
+ }
+
+ if (portMap.containsKey(portKey)) {
+ return portMap.get(portKey);
+ }
+
+ // create object
+ Object portObject = initPortObject(portKey);
+ portMap.put(portKey, portObject);
+
+ return portObject;
+ }
+ finally {
+ fSession.writeUnlock();
+ }
+ }
+
+ // is the port in the port map?
+ if (!portMap.containsKey(portKey)) {
+ fSession.writeLock();
+ try {
+ // try again
+ if (portMap.containsKey(portKey)) {
+ return portMap.get(portKey);
+ }
+
+ // create object
+ Object portObject = initPortObject(portKey);
+ portMap.put(portKey, portObject);
+
+ return portObject;
+ }
+ finally {
+ fSession.writeUnlock();
+ }
+ }
+
+ return portMap.get(portKey);
+ }
+
+ /**
+ * Creates a port object.
+ */
+ private Object initPortObject(String portKey) {
+ Object portObject = null;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Initializing Web Service " + portKey + "...");
+ }
+
+ try {
+ // get WSDL URL
+ URL wsdlUrl = new URL((String) fSession.get(portKey));
+
+ // build the requested port object
+ if (SessionParameter.WEBSERVICES_REPOSITORY_SERVICE.equals(portKey)) {
+ RepositoryService service = new RepositoryService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ REPOSITORY_SERVICE));
+ portObject = service.getRepositoryServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_NAVIGATION_SERVICE.equals(portKey)) {
+ NavigationService service = new NavigationService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ NAVIGATION_SERVICE));
+ portObject = service.getNavigationServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_OBJECT_SERVICE.equals(portKey)) {
+ ObjectService service = new ObjectService(wsdlUrl,
+ new QName(CMIS_NAMESPACE, OBJECT_SERVICE));
+ portObject = service.getObjectServicePort(new MTOMFeature(),
+ new StreamingAttachmentFeature(null, true, 4 * 1024 * 1024));
+ ((BindingProvider) portObject).getRequestContext().put(
+ JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, CHUNK_SIZE);
+ }
+ else if (SessionParameter.WEBSERVICES_VERSIONING_SERVICE.equals(portKey)) {
+ VersioningService service = new VersioningService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ VERSIONING_SERVICE));
+ portObject = service.getVersioningServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_DISCOVERY_SERVICE.equals(portKey)) {
+ DiscoveryService service = new DiscoveryService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ DISCOVERY_SERVICE));
+ portObject = service.getDiscoveryServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_MULTIFILING_SERVICE.equals(portKey)) {
+ MultiFilingService service = new MultiFilingService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ MULTIFILING_SERVICE));
+ portObject = service.getMultiFilingServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE.equals(portKey)) {
+ RelationshipService service = new RelationshipService(wsdlUrl, new QName(CMIS_NAMESPACE,
+ RELATIONSHIP_SERVICE));
+ portObject = service.getRelationshipServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_POLICY_SERVICE.equals(portKey)) {
+ PolicyService service = new PolicyService(wsdlUrl,
+ new QName(CMIS_NAMESPACE, POLICY_SERVICE));
+ portObject = service.getPolicyServicePort(new MTOMFeature());
+ }
+ else if (SessionParameter.WEBSERVICES_ACL_SERVICE.equals(portKey)) {
+ ACLService service = new ACLService(wsdlUrl, new QName(CMIS_NAMESPACE, ACL_SERVICE));
+ portObject = service.getACLServicePort(new MTOMFeature());
+ }
+
+ // add SOAP and HTTP authentication headers
+ AbstractAuthenticationProvider authProvider = CmisBindingsHelper
+ .getAuthenticationProvider(fSession);
+ if (authProvider != null) {
+ // SOAP header
+ Element soapHeader = authProvider.getSOAPHeaders(portObject);
+ if (soapHeader != null) {
+ ((WSBindingProvider) portObject).setOutboundHeaders(Headers.create(soapHeader));
+ }
+
+ // HTTP header
+ Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(wsdlUrl.toString());
+ if (httpHeaders != null) {
+ ((BindingProvider) portObject).getRequestContext().put(
+ MessageContext.HTTP_REQUEST_HEADERS, httpHeaders);
+ }
+ }
+ }
+ catch (CmisBaseException ce) {
+ throw ce;
+ }
+ catch (Exception e) {
+ throw new CmisConnectionException("Cannot initalize Web Services port object [" + portKey
+ + "]: " + e.getMessage(), e);
+ }
+
+ // we have no object ... strange ...
+ if (portObject == null) {
+ throw new CmisRuntimeException("Cannot find Web Services port object [" + portKey + "]!");
+ }
+
+ return portObject;
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
+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.EnumRelationshipDirection;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipServicePort;
+import org.apache.chemistry.opencmis.commons.provider.ObjectList;
+import org.apache.chemistry.opencmis.commons.provider.RelationshipService;
+
+/**
+ * Relationship Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class RelationshipServiceImpl extends AbstractWebServicesService implements
+ RelationshipService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public RelationshipServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.RelationshipService#getObjectRelationships(java.lang.String,
+ * java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.RelationshipDirection,
+ * java.lang.String, java.lang.String, java.lang.Boolean, java.math.BigInteger,
+ * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ 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 = fPortProvider.getRelationshipServicePort();
+
+ try {
+ return convert(port.getObjectRelationships(repositoryId, objectId,
+ includeSubRelationshipTypes, convert(EnumRelationshipDirection.class,
+ relationshipDirection), typeId, filter, includeAllowableActions, maxItems, skipCount,
+ convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RelationshipServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertTypeContainerList;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.api.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.chemistry.opencmis.commons.api.TypeDefinitionList;
+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.CmisRepositoryEntryType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryServicePort;
+import org.apache.chemistry.opencmis.commons.provider.RepositoryInfoData;
+import org.apache.chemistry.opencmis.commons.provider.RepositoryService;
+
+/**
+ * Repository Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class RepositoryServiceImpl extends AbstractWebServicesService implements RepositoryService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public RepositoryServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.client.provider.RepositoryService#getRepositoryInfos(org.apache.opencmis.client.provider
+ * .ExtensionsData)
+ */
+ public List<RepositoryInfoData> getRepositoryInfos(ExtensionsData extension) {
+ RepositoryServicePort port = fPortProvider.getRepositoryServicePort();
+
+ List<RepositoryInfoData> infos = null;
+ try {
+ // get the list of repositories
+ List<CmisRepositoryEntryType> entries = port.getRepositories(convert(extension));
+
+ if (entries != null) {
+ infos = new ArrayList<RepositoryInfoData>();
+
+ // iterate through the list and fetch repository infos
+ for (CmisRepositoryEntryType entry : entries) {
+ CmisRepositoryInfoType info = port.getRepositoryInfo(entry.getRepositoryId(), null);
+ infos.add(convert(info));
+ }
+ }
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+
+ return infos;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.RepositoryService#getRepositoryInfo(java.lang.String,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public RepositoryInfoData getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+ RepositoryServicePort port = fPortProvider.getRepositoryServicePort();
+
+ try {
+ return convert(port.getRepositoryInfo(repositoryId, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.RepositoryService#getTypeDefinition(java.lang.String,
+ * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public TypeDefinition getTypeDefinition(String repositoryId, String typeId,
+ ExtensionsData extension) {
+ RepositoryServicePort port = fPortProvider.getRepositoryServicePort();
+
+ try {
+ return convert(port.getTypeDefinition(repositoryId, typeId, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.RepositoryService#getTypeChildren(java.lang.String,
+ * java.lang.String, java.lang.Boolean, java.math.BigInteger, java.math.BigInteger,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public TypeDefinitionList getTypeChildren(String repositoryId, String typeId,
+ Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
+ ExtensionsData extension) {
+ RepositoryServicePort port = fPortProvider.getRepositoryServicePort();
+
+ try {
+ return convert(port.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
+ maxItems, skipCount, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.RepositoryService#getTypeDescendants(java.lang.String,
+ * java.lang.String, java.math.BigInteger, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId,
+ BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
+ RepositoryServicePort port = fPortProvider.getRepositoryServicePort();
+
+ try {
+ return convertTypeContainerList(port.getTypeDescendants(repositoryId, typeId, depth,
+ includePropertyDefinitions, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+/**
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public final class SpiSessionParameter {
+
+ public static final String PORTS = "org.apache.chemistry.opencmis.provider.webservices.ports";
+
+ private SpiSessionParameter() {
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/SpiSessionParameter.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: incubator/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/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java?rev=934361&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java Thu Apr 15 10:33:49 2010
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
+
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.convertHolder;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.setExtensionValues;
+import static org.apache.chemistry.opencmis.commons.impl.Converter.setHolderValue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.client.bindings.spi.Session;
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+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.CmisObjectType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.VersioningServicePort;
+import org.apache.chemistry.opencmis.commons.provider.AccessControlList;
+import org.apache.chemistry.opencmis.commons.provider.ContentStreamData;
+import org.apache.chemistry.opencmis.commons.provider.Holder;
+import org.apache.chemistry.opencmis.commons.provider.ObjectData;
+import org.apache.chemistry.opencmis.commons.provider.PropertiesData;
+import org.apache.chemistry.opencmis.commons.provider.VersioningService;
+
+/**
+ * Versioning Service Web Services client.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+public class VersioningServiceImpl extends AbstractWebServicesService implements VersioningService {
+
+ private final PortProvider fPortProvider;
+
+ /**
+ * Constructor.
+ */
+ public VersioningServiceImpl(Session session, PortProvider portProvider) {
+ setSession(session);
+ fPortProvider = portProvider;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.VersioningService#checkOut(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, org.apache.opencmis.client.provider.ExtensionsData,
+ * org.apache.opencmis.client.provider.Holder)
+ */
+ public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
+ Holder<Boolean> contentCopied) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ javax.xml.ws.Holder<String> portObjectId = convertHolder(objectId);
+ javax.xml.ws.Holder<Boolean> portContentCopied = new javax.xml.ws.Holder<Boolean>();
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.checkOut(repositoryId, portObjectId, portExtension, portContentCopied);
+
+ setHolderValue(portObjectId, objectId);
+ setHolderValue(portContentCopied, contentCopied);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.VersioningService#cancelCheckOut(java.lang.String,
+ * java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+ port.cancelCheckOut(repositoryId, objectId, portExtension);
+
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.VersioningService#checkIn(java.lang.String,
+ * org.apache.opencmis.client.provider.Holder, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.PropertiesData,
+ * org.apache.opencmis.client.provider.ContentStreamData, java.lang.String, java.util.List,
+ * org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.AccessControlList,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
+ PropertiesData properties, ContentStreamData contentStream, String checkinComment,
+ List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
+ ExtensionsData extension) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ 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),
+ checkinComment, policies, convert(addACEs), convert(removeACEs), portExtension);
+
+ setHolderValue(portObjectId, objectId);
+ setExtensionValues(portExtension, extension);
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.commons.provider.VersioningService#getAllVersions(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.api.ExtensionsData)
+ */
+ public List<ObjectData> getAllVersions(String repositoryId, String objectId,
+ String versionSeriesId, String filter, Boolean includeAllowableActions,
+ ExtensionsData extension) {
+ return getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions, extension);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.opencmis.client.provider.VersioningService#getAllVersions(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public List<ObjectData> getAllVersions(String repositoryId, String versionSeriesId,
+ String filter, Boolean includeAllowableActions, ExtensionsData extension) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ List<CmisObjectType> versionList = port.getAllVersions(repositoryId, versionSeriesId, filter,
+ includeAllowableActions, convert(extension));
+
+ // no list?
+ if (versionList == null) {
+ return null;
+ }
+
+ // convert list
+ List<ObjectData> result = new ArrayList<ObjectData>();
+ for (CmisObjectType version : versionList) {
+ result.add(convert(version));
+ }
+
+ return result;
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.client.provider.VersioningService#getObjectOfLatestVersion(java.lang.String
+ * , java.lang.String, java.lang.Boolean, java.lang.String, java.lang.Boolean,
+ * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean,
+ * java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public ObjectData getObjectOfLatestVersion(String repositoryId, String versionSeriesId,
+ Boolean major, String filter, Boolean includeAllowableActions,
+ IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+ Boolean includeACL, ExtensionsData extension) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ return convert(port.getObjectOfLatestVersion(repositoryId, versionSeriesId, major, filter,
+ includeAllowableActions, convert(EnumIncludeRelationships.class, includeRelationships),
+ renditionFilter, includePolicyIds, includeACL, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.opencmis.client.provider.VersioningService#getPropertiesOfLatestVersion(java.lang
+ * .String, java.lang.String, java.lang.Boolean, java.lang.String,
+ * org.apache.opencmis.client.provider.ExtensionsData)
+ */
+ public PropertiesData getPropertiesOfLatestVersion(String repositoryId, String VersionSeriesId,
+ Boolean major, String filter, ExtensionsData extension) {
+ VersioningServicePort port = fPortProvider.getVersioningServicePort();
+
+ try {
+ return convert(port.getPropertiesOfLatestVersion(repositoryId, VersionSeriesId, major,
+ filter, convert(extension)));
+ }
+ catch (CmisException e) {
+ throw convertException(e);
+ }
+ catch (Exception e) {
+ throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+ }
+ }
+}
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/VersioningServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Id