chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1468472 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ chemistry-opencmis-commons/chemistry-opencmis-commons-impl/sr...
Date Tue, 16 Apr 2013 15:44:50 GMT
Author: fmui
Date: Tue Apr 16 15:44:49 2013
New Revision: 1468472

URL: http://svn.apache.org/r1468472
Log:
CMIS 1.1: more Web Services code

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/RepositoryServiceImpl.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/RepositoryService.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/ObjectServiceImpl.java?rev=1468472&r1=1468471&r2=1468472&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
Tue Apr 16 15:44:49 2013
@@ -38,6 +38,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 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;
 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
@@ -165,8 +166,30 @@ public class ObjectServiceImpl extends A
     }
 
     public String createItem(String repositoryId, Properties properties, String folderId,
List<String> policies,
-            Acl addAces, Acl removeAces, ExtensionsData extension) {
-        throw new CmisNotSupportedException("Not supported!");
+            Acl addACEs, Acl removeACEs, ExtensionsData extension) {
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
+        ObjectServicePort port = portProvider.getObjectServicePort();
+
+        try {
+            javax.xml.ws.Holder<String> objectId = new javax.xml.ws.Holder<String>();
+            javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+            port.createItem(repositoryId, convert(properties), folderId, 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);
+        } finally {
+            portProvider.endCall(port);
+        }
     }
 
     public String createRelationship(String repositoryId, Properties properties, List<String>
policies, Acl addACEs,
@@ -218,6 +241,10 @@ public class ObjectServiceImpl extends A
     public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(String repositoryId,
             List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties
properties,
             List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds,
ExtensionsData extension) {
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
         throw new CmisNotSupportedException("Not supported!");
     }
 
@@ -433,6 +460,29 @@ public class ObjectServiceImpl extends A
 
     public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String>
changeToken,
             ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
-        throw new CmisNotSupportedException("Not supported!");
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
+        ObjectServicePort port = portProvider.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.appendContentStream(repositoryId, portObjectId, isLastChunk, portChangeToken,
+                    convert(contentStream, false), 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);
+        } finally {
+            portProvider.endCall(port);
+        }
     }
 }

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=1468472&r1=1468471&r2=1468472&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
Tue Apr 16 15:44:49 2013
@@ -19,7 +19,9 @@
 package org.apache.chemistry.opencmis.client.bindings.spi.webservices;
 
 import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convertExtensionHolder;
 import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convertTypeContainerList;
+import static org.apache.chemistry.opencmis.commons.impl.WSConverter.setExtensionValues;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -31,11 +33,14 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 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.CmisRepositoryEntryType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryServicePort;
 import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
 
@@ -141,16 +146,72 @@ public class RepositoryServiceImpl exten
             portProvider.endCall(port);
         }
     }
-    
+
     public TypeDefinition createType(String repositoryId, TypeDefinition type, ExtensionsData
extension) {
-        throw new CmisNotSupportedException("Not supported!");
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
+        RepositoryServicePort port = portProvider.getRepositoryServicePort();
+
+        try {
+            javax.xml.ws.Holder<CmisTypeDefinitionType> typeDef = new javax.xml.ws.Holder<CmisTypeDefinitionType>(
+                    convert(type));
+
+            port.createType(repositoryId, typeDef, convert(extension));
+
+            return convert(typeDef.value);
+        } catch (CmisException e) {
+            throw convertException(e);
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+        } finally {
+            portProvider.endCall(port);
+        }
     }
 
     public TypeDefinition updateType(String repositoryId, TypeDefinition type, ExtensionsData
extension) {
-        throw new CmisNotSupportedException("Not supported!");
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
+        RepositoryServicePort port = portProvider.getRepositoryServicePort();
+
+        try {
+            javax.xml.ws.Holder<CmisTypeDefinitionType> typeDef = new javax.xml.ws.Holder<CmisTypeDefinitionType>(
+                    convert(type));
+
+            port.updateType(repositoryId, typeDef, convert(extension));
+
+            return convert(typeDef.value);
+        } catch (CmisException e) {
+            throw convertException(e);
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+        } finally {
+            portProvider.endCall(port);
+        }
     }
 
     public void deleteType(String repositoryId, String typeId, ExtensionsData extension)
{
-        throw new CmisNotSupportedException("Not supported!");
+        if (getCmisVersion(repositoryId) == CmisVersion.CMIS_1_0) {
+            throw new CmisNotSupportedException("Repository is a CMIS 1.0 repository!");
+        }
+
+        RepositoryServicePort port = portProvider.getRepositoryServicePort();
+
+        try {
+            javax.xml.ws.Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
+
+            port.deleteType(repositoryId, typeId, portExtension);
+
+            setExtensionValues(portExtension, extension);
+        } catch (CmisException e) {
+            throw convertException(e);
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Error: " + e.getMessage(), e);
+        } finally {
+            portProvider.endCall(port);
+        }
     }
 }

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=1468472&r1=1468471&r2=1468472&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
Tue Apr 16 15:44:49 2013
@@ -97,6 +97,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
+import org.apache.chemistry.opencmis.commons.definitions.TypeMutability;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.Action;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -170,6 +171,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.SecondaryTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionListImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisACLCapabilityType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisACLType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlEntryType;
@@ -228,6 +230,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDocumentDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeFolderDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeItemDefinitionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeMutabilityCapabilitiesType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypePolicyDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeRelationshipDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeSecondaryDefinitionType;
@@ -724,6 +727,19 @@ public final class WSConverter {
         result.setParentTypeId(typeDefinition.getParentId());
         result.setQueryName(typeDefinition.getQueryName());
 
+        if (typeDefinition.getTypeMutability() != null) {
+            CmisTypeMutabilityCapabilitiesType typeMutability = typeDefinition.getTypeMutability();
+            TypeMutabilityImpl target = new TypeMutabilityImpl();
+
+            target.setCanCreate(typeMutability.isCreate());
+            target.setCanUpdate(typeMutability.isUpdate());
+            target.setCanDelete(typeMutability.isDelete());
+
+            convertExtension(typeMutability, target);
+
+            result.setTypeMutability(target);
+        }
+
         for (CmisPropertyDefinitionType propertyDefinition : typeDefinition.getPropertyDefinition())
{
             result.addPropertyDefinition(convert(propertyDefinition));
         }
@@ -937,6 +953,19 @@ public final class WSConverter {
         result.setQueryable(convertBoolean(typeDefinition.isQueryable(), false));
         result.setQueryName(typeDefinition.getQueryName());
 
+        if (typeDefinition.getTypeMutability() != null) {
+            TypeMutability typeMutability = typeDefinition.getTypeMutability();
+            CmisTypeMutabilityCapabilitiesType target = new CmisTypeMutabilityCapabilitiesType();
+
+            target.setCreate(typeMutability.canCreate() == null ? true : typeMutability.canCreate());
+            target.setUpdate(typeMutability.canUpdate() == null ? true : typeMutability.canUpdate());
+            target.setDelete(typeMutability.canDelete() == null ? true : typeMutability.canDelete());
+
+            convertExtension(typeMutability, target);
+
+            result.setTypeMutability(target);
+        }
+
         if (typeDefinition.getPropertyDefinitions() != null) {
             for (PropertyDefinition<?> propDef : typeDefinition.getPropertyDefinitions().values())
{
                 result.getPropertyDefinition().add(convert(propDef));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java?rev=1468472&r1=1468471&r2=1468472&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
Tue Apr 16 15:44:49 2013
@@ -19,7 +19,9 @@
 package org.apache.chemistry.opencmis.server.impl.webservices;
 
 import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convert;
+import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convertExtensionHolder;
 import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convertTypeContainerList;
+import static org.apache.chemistry.opencmis.commons.impl.WSConverter.setExtensionValues;
 
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -31,17 +33,16 @@ import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.soap.MTOM;
 
+import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 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.CmisRepositoryEntryType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeContainer;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionListType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumServiceException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryServicePort;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 
@@ -148,31 +149,48 @@ public class RepositoryService extends A
 
     public void createType(String repositoryId, Holder<CmisTypeDefinitionType> type,
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);
+            type.value = convert(service.createType(repositoryId, convert(type.value), convert(extension)));
+        } catch (Exception e) {
+            throw convertException(e);
+        } finally {
+            closeService(service);
+        }
     }
 
     public void updateType(String repositoryId, Holder<CmisTypeDefinitionType> type,
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);
+            type.value = convert(service.updateType(repositoryId, convert(type.value), convert(extension)));
+        } catch (Exception e) {
+            throw convertException(e);
+        } finally {
+            closeService(service);
+        }
     }
 
     public void deleteType(String repositoryId, String typeId, Holder<CmisExtensionType>
extension)
             throws CmisException {
-        CmisFaultType fault = new CmisFaultType();
-        fault.setMessage("Not supported!");
-        fault.setCode(BigInteger.ZERO);
-        fault.setType(EnumServiceException.NOT_SUPPORTED);
 
-        throw new CmisException(fault.getMessage(), fault);
+        CmisService service = null;
+        try {
+            service = getService(wsContext, repositoryId);
+
+            ExtensionsData extData = convertExtensionHolder(extension);
+
+            service.deleteType(repositoryId, typeId, extData);
+
+            setExtensionValues(extData, extension);
+        } catch (Exception e) {
+            throw convertException(e);
+        } finally {
+            closeService(service);
+        }
     }
 }



Mime
View raw message