You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by dc...@apache.org on 2010/02/16 17:04:07 UTC
svn commit: r910572 [26/36] - in /incubator/chemistry/trunk/opencmis: ./
_dev/ opencmis-client/ opencmis-client/opencmis-client-api/
opencmis-client/opencmis-client-api/src/
opencmis-client/opencmis-client-api/src/main/
opencmis-client/opencmis-client-...
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/NavigationService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/NavigationService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/NavigationService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,194 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectInFolderContainerType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectInFolderListType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectListType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectParentsType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.opencmis.commons.impl.jaxb.NavigationServicePort;
+import org.apache.opencmis.commons.provider.ObjectInFolderContainer;
+import org.apache.opencmis.commons.provider.ObjectParentData;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisNavigationService;
+
+/**
+ * CMIS Navigation Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.NavigationServicePort")
+public class NavigationService extends AbstractService implements NavigationServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public CmisObjectListType getCheckedOutDocs(String repositoryId, String folderId, String filter,
+ String orderBy, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter, BigInteger maxItems,
+ BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, maxItems, skipCount, convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectInFolderListType getChildren(String repositoryId, String folderId,
+ String filter, String orderBy, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getChildren(context, repositoryId, folderId, filter, orderBy,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePathSegment, maxItems, skipCount, convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectInFolderContainerType> getDescendants(String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
+
+ List<ObjectInFolderContainer> serviceResult = service.getDescendants(context, repositoryId,
+ folderId, depth, filter, includeAllowableActions, convert(IncludeRelationships.class,
+ includeRelationships), renditionFilter, includePathSegment, convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectInFolderContainer container : serviceResult) {
+ result.add(convert(container));
+ }
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectType getFolderParent(String repositoryId, String folderId, String filter,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getFolderParent(context, repositoryId, folderId, filter,
+ convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectInFolderContainerType> getFolderTree(String repositoryId, String folderId,
+ BigInteger depth, String filter, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectInFolderContainerType> result = new ArrayList<CmisObjectInFolderContainerType>();
+
+ List<ObjectInFolderContainer> serviceResult = service.getFolderTree(context, repositoryId,
+ folderId, depth, filter, includeAllowableActions, convert(IncludeRelationships.class,
+ includeRelationships), renditionFilter, includePathSegment, convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectInFolderContainer container : serviceResult) {
+ result.add(convert(container));
+ }
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectParentsType> getObjectParents(String repositoryId, String objectId,
+ String filter, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includeRelativePathSegment, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisNavigationService service = factory.getNavigationService();
+ CallContext context = createContext(fContext);
+
+ List<CmisObjectParentsType> result = new ArrayList<CmisObjectParentsType>();
+
+ List<ObjectParentData> serviceResult = service.getObjectParents(context, repositoryId,
+ objectId, filter, includeAllowableActions, convert(IncludeRelationships.class,
+ includeRelationships), renditionFilter, includeRelativePathSegment,
+ convert(extension), null);
+
+ if (serviceResult != null) {
+ for (ObjectParentData parent : serviceResult) {
+ result.add(convert(parent));
+ }
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/NavigationService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/ObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/ObjectService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/ObjectService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/ObjectService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,434 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.opencmis.commons.impl.Converter.convertHolder;
+import static org.apache.opencmis.commons.impl.Converter.setExtensionValues;
+import static org.apache.opencmis.commons.impl.Converter.setHolderValue;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.enums.UnfileObjects;
+import org.apache.opencmis.commons.enums.VersioningState;
+import org.apache.opencmis.commons.impl.jaxb.CmisAccessControlListType;
+import org.apache.opencmis.commons.impl.jaxb.CmisAllowableActionsType;
+import org.apache.opencmis.commons.impl.jaxb.CmisContentStreamType;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.impl.jaxb.CmisPropertiesType;
+import org.apache.opencmis.commons.impl.jaxb.CmisRenditionType;
+import org.apache.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.opencmis.commons.impl.jaxb.EnumUnfileObject;
+import org.apache.opencmis.commons.impl.jaxb.EnumVersioningState;
+import org.apache.opencmis.commons.impl.jaxb.ObjectServicePort;
+import org.apache.opencmis.commons.impl.jaxb.DeleteTreeResponse.FailedToDelete;
+import org.apache.opencmis.commons.provider.RenditionData;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisObjectService;
+
+import com.sun.xml.ws.developer.StreamingAttachment;
+
+/**
+ * CMIS Object Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@StreamingAttachment(parseEagerly = true, memoryThreshold = 4 * 1024 * 1204)
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.ObjectServicePort")
+public class ObjectService extends AbstractService implements ObjectServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public void createDocument(String repositoryId, CmisPropertiesType properties, String folderId,
+ CmisContentStreamType contentStream, EnumVersioningState versioningState,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension,
+ Holder<String> objectId) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createDocument(context, repositoryId, convert(properties), folderId,
+ convert(contentStream), convert(VersioningState.class, versioningState), policies,
+ convert(addAces, null), convert(removeAces, null), extData);
+
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void createDocumentFromSource(String repositoryId, String sourceId,
+ CmisPropertiesType properties, String folderId, EnumVersioningState versioningState,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension,
+ Holder<String> objectId) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createDocumentFromSource(context, repositoryId, sourceId,
+ convert(properties), folderId, convert(VersioningState.class, versioningState), policies,
+ convert(addAces, null), convert(removeAces, null), extData);
+
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void createFolder(String repositoryId, CmisPropertiesType properties, String folderId,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension,
+ Holder<String> objectId) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createFolder(context, repositoryId, convert(properties), folderId,
+ policies, convert(addAces, null), convert(removeAces, null), extData);
+
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void createPolicy(String repositoryId, CmisPropertiesType properties, String folderId,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension,
+ Holder<String> objectId) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createPolicy(context, repositoryId, convert(properties), folderId,
+ policies, convert(addAces, null), convert(removeAces, null), extData);
+
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void createRelationship(String repositoryId, CmisPropertiesType properties,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension,
+ Holder<String> objectId) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ String id = service.createRelationship(context, repositoryId, convert(properties), policies,
+ convert(addAces, null), convert(removeAces, null), extData);
+
+ if (objectId != null) {
+ objectId.value = id;
+ }
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void deleteContentStream(String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ org.apache.opencmis.commons.provider.Holder<String> changeTokenHolder = convertHolder(changeToken);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service
+ .deleteContentStream(context, repositoryId, objectIdHolder, changeTokenHolder, extData);
+
+ setHolderValue(objectIdHolder, objectId);
+ setHolderValue(changeTokenHolder, changeToken);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void deleteObject(String repositoryId, String objectId, Boolean allVersions,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, allVersions, extData);
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public FailedToDelete deleteTree(String repositoryId, String folderId, Boolean allVersions,
+ EnumUnfileObject unfileObjects, Boolean continueOnFailure, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.deleteTree(context, repositoryId, folderId, allVersions, convert(
+ UnfileObjects.class, unfileObjects), continueOnFailure, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisAllowableActionsType getAllowableActions(String repositoryId, String objectId,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getAllowableActions(context, repositoryId, objectId,
+ convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisContentStreamType getContentStream(String repositoryId, String objectId,
+ String streamId, BigInteger offset, BigInteger length, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getContentStream(context, repositoryId, objectId, streamId, offset,
+ length, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectType getObject(String repositoryId, String objectId, String filter,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getObject(context, repositoryId, objectId, filter,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePolicyIds, includeAcl, convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectType getObjectByPath(String repositoryId, String path, String filter,
+ Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
+ String renditionFilter, Boolean includePolicyIds, Boolean includeAcl,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getObjectByPath(context, repositoryId, path, filter,
+ includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+ renditionFilter, includePolicyIds, includeAcl, convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisPropertiesType getProperties(String repositoryId, String objectId, String filter,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getProperties(context, repositoryId, objectId, filter,
+ convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisRenditionType> getRenditions(String repositoryId, String objectId,
+ String renditionFilter, BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ List<CmisRenditionType> result = new ArrayList<CmisRenditionType>();
+
+ List<RenditionData> renditionList = service.getRenditions(context, repositoryId, objectId,
+ renditionFilter, maxItems, skipCount, convert(extension));
+
+ if (renditionList != null) {
+ for (RenditionData rendition : renditionList) {
+ result.add(convert(rendition));
+ }
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId,
+ String sourceFolderId, Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.moveObject(context, repositoryId, objectIdHolder, targetFolderId, sourceFolderId,
+ extData, null);
+
+ setHolderValue(objectIdHolder, objectId);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
+ Holder<String> changeToken, CmisContentStreamType contentStream,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ org.apache.opencmis.commons.provider.Holder<String> changeTokenHolder = convertHolder(changeToken);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.setContentStream(context, repositoryId, objectIdHolder, overwriteFlag,
+ changeTokenHolder, convert(contentStream), extData);
+
+ setHolderValue(objectIdHolder, objectId);
+ setHolderValue(changeTokenHolder, changeToken);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void updateProperties(String repositoryId, Holder<String> objectId,
+ Holder<String> changeToken, CmisPropertiesType properties, Holder<CmisExtensionType> extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisObjectService service = factory.getObjectService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ org.apache.opencmis.commons.provider.Holder<String> changeTokenHolder = convertHolder(changeToken);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.updateProperties(context, repositoryId, objectIdHolder, changeTokenHolder,
+ convert(properties), null, extData, null);
+
+ setHolderValue(objectIdHolder, objectId);
+ setHolderValue(changeTokenHolder, changeToken);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/ObjectService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/PolicyService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/PolicyService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/PolicyService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/PolicyService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,116 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.opencmis.commons.impl.Converter.setExtensionValues;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.impl.jaxb.PolicyServicePort;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisPolicyService;
+
+/**
+ * CMIS Policy Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.PolicyServicePort")
+public class PolicyService extends AbstractService implements PolicyServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public void applyPolicy(String repositoryId, String policyId, String objectId,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisPolicyService service = factory.getPolicyService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.applyPolicy(context, repositoryId, policyId, objectId, extData, null);
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectType> getAppliedPolicies(String repositoryId, String objectId,
+ String filter, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisPolicyService service = factory.getPolicyService();
+ CallContext context = createContext(fContext);
+
+ List<ObjectData> policies = service.getAppliedPolicies(context, repositoryId, objectId,
+ filter, convert(extension), null);
+
+ if (policies == null) {
+ return null;
+ }
+
+ List<CmisObjectType> result = new ArrayList<CmisObjectType>();
+ for (ObjectData object : policies) {
+ result.add(convert(object));
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void removePolicy(String repositoryId, String policyId, String objectId,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisPolicyService service = factory.getPolicyService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.removePolicy(context, repositoryId, policyId, objectId, extData);
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/PolicyService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RelationshipService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RelationshipService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RelationshipService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RelationshipService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,68 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+
+import java.math.BigInteger;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.enums.RelationshipDirection;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectListType;
+import org.apache.opencmis.commons.impl.jaxb.EnumRelationshipDirection;
+import org.apache.opencmis.commons.impl.jaxb.RelationshipServicePort;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisRelationshipService;
+
+/**
+ * CMIS Relationship Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.RelationshipServicePort")
+public class RelationshipService extends AbstractService implements RelationshipServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public CmisObjectListType getObjectRelationships(String repositoryId, String objectId,
+ Boolean includeSubRelationshipTypes, EnumRelationshipDirection relationshipDirection,
+ String typeId, String filter, Boolean includeAllowableActions, BigInteger maxItems,
+ BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRelationshipService service = factory.getRelationshipService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getObjectRelationships(context, repositoryId, objectId,
+ includeSubRelationshipTypes, convert(RelationshipDirection.class, relationshipDirection),
+ typeId, filter, includeAllowableActions, maxItems, skipCount, convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RelationshipService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RepositoryService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RepositoryService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RepositoryService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,149 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertTypeContainerList;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisRepositoryEntryType;
+import org.apache.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
+import org.apache.opencmis.commons.impl.jaxb.CmisTypeContainer;
+import org.apache.opencmis.commons.impl.jaxb.CmisTypeDefinitionListType;
+import org.apache.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
+import org.apache.opencmis.commons.impl.jaxb.RepositoryServicePort;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisRepositoryService;
+
+/**
+ * CMIS Repository Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.RepositoryServicePort")
+public class RepositoryService extends AbstractService implements RepositoryServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public List<CmisRepositoryEntryType> getRepositories(CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRepositoryService service = factory.getRepositoryService();
+ CallContext context = createContext(fContext);
+
+ List<RepositoryInfoData> infoDataList = service.getRepositoryInfos(context,
+ convert(extension));
+
+ if (infoDataList == null) {
+ return null;
+ }
+
+ List<CmisRepositoryEntryType> result = new ArrayList<CmisRepositoryEntryType>();
+ for (RepositoryInfoData infoData : infoDataList) {
+ CmisRepositoryEntryType entry = new CmisRepositoryEntryType();
+ entry.setRepositoryId(infoData.getRepositoryId());
+ entry.setRepositoryName(infoData.getRepositoryName());
+
+ result.add(entry);
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisRepositoryInfoType getRepositoryInfo(String repositoryId, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRepositoryService service = factory.getRepositoryService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getRepositoryInfo(context, repositoryId, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisTypeDefinitionListType getTypeChildren(String repositoryId, String typeId,
+ Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRepositoryService service = factory.getRepositoryService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getTypeChildren(context, repositoryId, typeId,
+ includePropertyDefinitions, maxItems, skipCount, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisTypeDefinitionType getTypeDefinition(String repositoryId, String typeId,
+ CmisExtensionType extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRepositoryService service = factory.getRepositoryService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getTypeDefinition(context, repositoryId, typeId, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisTypeContainer> getTypeDescendants(String repositoryId, String typeId,
+ BigInteger depth, Boolean includePropertyDefinitions, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisRepositoryService service = factory.getRepositoryService();
+ CallContext context = createContext(fContext);
+
+ List<CmisTypeContainer> result = new ArrayList<CmisTypeContainer>();
+ convertTypeContainerList(service.getTypeDescendants(context, repositoryId, typeId, depth,
+ includePropertyDefinitions, convert(extension)), result);
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/RepositoryService.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/VersioningService.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/VersioningService.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/VersioningService.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,192 @@
+/*
+ * 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.opencmis.server.impl.webservices;
+
+import static org.apache.opencmis.commons.impl.Converter.convert;
+import static org.apache.opencmis.commons.impl.Converter.convertExtensionHolder;
+import static org.apache.opencmis.commons.impl.Converter.convertHolder;
+import static org.apache.opencmis.commons.impl.Converter.setExtensionValues;
+import static org.apache.opencmis.commons.impl.Converter.setHolderValue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.opencmis.commons.api.ExtensionsData;
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.impl.jaxb.CmisAccessControlListType;
+import org.apache.opencmis.commons.impl.jaxb.CmisContentStreamType;
+import org.apache.opencmis.commons.impl.jaxb.CmisException;
+import org.apache.opencmis.commons.impl.jaxb.CmisExtensionType;
+import org.apache.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.opencmis.commons.impl.jaxb.CmisPropertiesType;
+import org.apache.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
+import org.apache.opencmis.commons.impl.jaxb.VersioningServicePort;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.opencmis.server.spi.CallContext;
+import org.apache.opencmis.server.spi.CmisVersioningService;
+
+/**
+ * CMIS Versioning Service.
+ *
+ * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
+ *
+ */
+@WebService(endpointInterface = "org.apache.opencmis.commons.impl.jaxb.VersioningServicePort")
+public class VersioningService extends AbstractService implements VersioningServicePort {
+ @Resource
+ WebServiceContext fContext;
+
+ public void cancelCheckOut(String repositoryId, String objectId,
+ Holder<CmisExtensionType> extension) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.cancelCheckOut(context, repositoryId, objectId, extData);
+
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void checkIn(String repositoryId, Holder<String> objectId, Boolean major,
+ CmisPropertiesType properties, CmisContentStreamType contentStream, String checkinComment,
+ List<String> policies, CmisAccessControlListType addAces,
+ CmisAccessControlListType removeAces, Holder<CmisExtensionType> extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.checkIn(context, repositoryId, objectIdHolder, major, convert(properties),
+ convert(contentStream), checkinComment, policies, convert(addAces, null), convert(
+ removeAces, null), extData, null);
+
+ setHolderValue(objectIdHolder, objectId);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public void checkOut(String repositoryId, Holder<String> objectId,
+ Holder<CmisExtensionType> extension, Holder<Boolean> contentCopied) throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ org.apache.opencmis.commons.provider.Holder<String> objectIdHolder = convertHolder(objectId);
+ org.apache.opencmis.commons.provider.Holder<Boolean> contentCopiedHolder = new org.apache.opencmis.commons.provider.Holder<Boolean>();
+ ExtensionsData extData = convertExtensionHolder(extension);
+
+ service.checkOut(context, repositoryId, objectIdHolder, extData, contentCopiedHolder, null);
+
+ if (contentCopied != null) {
+ contentCopied.value = contentCopiedHolder.getValue();
+ }
+
+ setHolderValue(objectIdHolder, objectId);
+ setExtensionValues(extData, extension);
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public List<CmisObjectType> getAllVersions(String repositoryId, String versionSeriesId,
+ String filter, Boolean includeAllowableActions, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId,
+ filter, includeAllowableActions, convert(extension), null);
+
+ if (versions == null) {
+ return null;
+ }
+
+ List<CmisObjectType> result = new ArrayList<CmisObjectType>();
+ for (ObjectData object : versions) {
+ result.add(convert(object));
+ }
+
+ return result;
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisObjectType getObjectOfLatestVersion(String repositoryId, String versionSeriesId,
+ Boolean major, String filter, Boolean includeAllowableActions,
+ EnumIncludeRelationships includeRelationships, String renditionFilter,
+ Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getObjectOfLatestVersion(context, repositoryId, versionSeriesId,
+ major, filter, includeAllowableActions, convert(IncludeRelationships.class,
+ includeRelationships), renditionFilter, includePolicyIds, includeAcl,
+ convert(extension), null));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+ public CmisPropertiesType getPropertiesOfLatestVersion(String repositoryId,
+ String versionSeriesId, Boolean major, String filter, CmisExtensionType extension)
+ throws CmisException {
+ try {
+ AbstractServicesFactory factory = getServicesFactory(fContext);
+ CmisVersioningService service = factory.getVersioningService();
+ CallContext context = createContext(fContext);
+
+ return convert(service.getPropertiesOfLatestVersion(context, repositoryId, versionSeriesId,
+ major, filter, convert(extension)));
+ }
+ catch (Exception e) {
+ throw convertException(e);
+ }
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/java/org/apache/opencmis/server/impl/webservices/VersioningService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Feb 16 16:03:38 2010
@@ -0,0 +1 @@
+wsdl
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/classes/repository.properties?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/classes/repository.properties (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/classes/repository.properties Tue Feb 16 16:03:38 2010
@@ -0,0 +1,4 @@
+class=org.apache.opencmis.server.impl.dummy.DummyServicesFactory
+
+repository.id=dummy-rep
+repository.name=Dummy Repository
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/classes/repository.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/sun-jaxws.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/sun-jaxws.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/sun-jaxws.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/sun-jaxws.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
+
+ <endpoint name="RepositoryService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.RepositoryService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}RepositoryService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}RepositoryServicePort"
+ url-pattern="/services/RepositoryService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="NavigationService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.NavigationService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}NavigationService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}NavigationServicePort"
+ url-pattern="/services/NavigationService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="ObjectService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.ObjectService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}ObjectService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}ObjectServicePort"
+ url-pattern="/services/ObjectService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="VersioningService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.VersioningService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}VersioningService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}VersioningServicePort"
+ url-pattern="/services/VersioningService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="RelationshipService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.RelationshipService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}RelationshipService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}RelationshipServicePort"
+ url-pattern="/services/RelationshipService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="DiscoveryService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.DiscoveryService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}DiscoveryService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}DiscoveryServicePort"
+ url-pattern="/services/DiscoveryService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="MultiFilingService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.MultiFilingService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}MultiFilingService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}MultiFilingServicePort"
+ url-pattern="/services/MultiFilingService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="ACLService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.AclService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}ACLService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}ACLServicePort"
+ url-pattern="/services/ACLService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+ <endpoint name="PolicyService" wsdl="WEB-INF/wsdl/CMISWS-Service.wsdl"
+ implementation="org.apache.opencmis.server.impl.webservices.PolicyService"
+ service="{http://docs.oasis-open.org/ns/cmis/ws/200908/}PolicyService"
+ port="{http://docs.oasis-open.org/ns/cmis/ws/200908/}PolicyServicePort"
+ url-pattern="/services/PolicyService" enable-mtom="true">
+ <handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
+ <handler-chain>
+ <handler>
+ <handler-class>org.apache.opencmis.server.impl.webservices.AuthHandler</handler-class>
+ </handler>
+ </handler-chain>
+ </handler-chains>
+ </endpoint>
+
+</endpoints>
\ No newline at end of file
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/sun-jaxws.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/web.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/web.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <display-name>OpenCMIS Server</display-name>
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.opencmis.server.impl.CmisRepositoryContextListener</listener-class>
+ </listener>
+
+ <listener>
+ <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>cmisws</servlet-name>
+ <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>cmisatom</servlet-name>
+ <servlet-class>org.apache.opencmis.server.impl.atompub.CmisAtomPubServlet</servlet-class>
+ <init-param>
+ <param-name>callContextHandler</param-name>
+ <param-value>org.apache.opencmis.server.impl.atompub.BasicAuthCallContextHandler</param-value>
+ </init-param>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+
+ <servlet-mapping>
+ <servlet-name>cmisws</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>cmisatom</servlet-name>
+ <url-pattern>/atom/*</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>60</session-timeout>
+ </session-config>
+</web-app>
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-impl/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Feb 16 16:03:38 2010
@@ -0,0 +1,7 @@
+bin
+target
+*.iws
+*.ipr
+*.iml
+.*
+log4j.log*
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/pom.xml?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/pom.xml (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/pom.xml Tue Feb 16 16:03:38 2010
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>opencmis-server-inmemory</artifactId>
+ <name>OpenCMIS InMemory Server Implementation</name>
+ <packaging>war</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <overlays>
+ <overlay>
+ </overlay>
+ <overlay>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-server-impl</artifactId>
+ </overlay>
+ </overlays>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-commons-api</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-commons-impl</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-provider-impl</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-server-spi</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-test-util</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opencmis</groupId>
+ <artifactId>opencmis-server-impl</artifactId>
+ <version>${version}</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/AbstractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/AbstractServiceImpl.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/AbstractServiceImpl.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/AbstractServiceImpl.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,155 @@
+/*
+ * 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.opencmis.inmemory;
+
+import org.apache.opencmis.commons.PropertyIds;
+import org.apache.opencmis.commons.api.TypeDefinition;
+import org.apache.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.opencmis.commons.exceptions.CmisUpdateConflictException;
+import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.inmemory.storedobj.api.DocumentVersion;
+import org.apache.opencmis.inmemory.storedobj.api.ObjectStore;
+import org.apache.opencmis.inmemory.storedobj.api.StoreManager;
+import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
+import org.apache.opencmis.inmemory.storedobj.api.VersionedDocument;
+
+/**
+ * Common functionality for all service implementations
+ *
+ * @author Jens
+ *
+ */
+public class AbstractServiceImpl {
+
+ protected StoreManager fStoreManager;
+
+ protected AbstractServiceImpl(StoreManager storeManager) {
+ fStoreManager = storeManager;
+ }
+
+ protected void checkStandardParameters(String repositoryId, String objectId) {
+
+ ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+ if (objStore==null)
+ throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+
+ StoredObject so = objStore.getObjectById(objectId);
+
+ if (so==null)
+ throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+ }
+
+ protected void checkExistingObjectId(ObjectStore objStore, String objectId) {
+
+ StoredObject so = objStore.getObjectById(objectId);
+
+ if (so==null)
+ throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+ }
+
+ protected void checkRepositoryId(String repositoryId) {
+ ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
+
+ if (objStore==null)
+ throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+ }
+
+ protected TypeDefinition getTypeDefinition(String repositoryId, PropertiesData properties) {
+ String typeId = (String) properties.getProperties().get(PropertyIds.CMIS_OBJECT_TYPE_ID)
+ .getFirstValue();
+ TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
+ if (typeDefC == null)
+ throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
+
+ return typeDefC.getTypeDefinition();
+ }
+
+ protected TypeDefinition getTypeDefinition(String repositoryId, StoredObject obj) {
+
+ TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, obj.getTypeId());
+ return typeDefC.getTypeDefinition();
+ }
+
+ /**
+ * We allow checkin, cancel, checkout operations on a single version as well as on a version series
+ * This method returns the versioned document (version series) in each case
+ * @param value
+ * version or version series id of a document
+ * @return
+ * version series id
+ */
+ protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {
+
+ VersionedDocument verDoc;
+ if (so instanceof DocumentVersion) {
+ // get document the version is contained in to c
+ verDoc = ((DocumentVersion) so).getParentDocument();
+ } else {
+ verDoc = (VersionedDocument) so;
+ }
+
+ return verDoc;
+ }
+
+ protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
+ checkIsVersionableObject(so);
+ VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+ if (verDoc.isCheckedOut())
+ testCheckedOutByCurrentUser(user, verDoc);
+
+ return verDoc;
+ }
+
+ protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {
+
+ checkIsVersionableObject(so);
+ VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+
+ checkHasUser(user);
+
+ testIsCheckedOut(verDoc);
+ testCheckedOutByCurrentUser(user, verDoc);
+
+ return verDoc;
+ }
+
+ protected void checkIsVersionableObject(StoredObject so) {
+ if (! (so instanceof VersionedDocument || so instanceof DocumentVersion))
+ throw new RuntimeException("Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
+ }
+
+ protected void checkHasUser(String user) {
+ if (null == user || user.length() == 0)
+ throw new CmisUpdateConflictException("Object can't be checked-in, no user is given.");
+ }
+
+ protected void testCheckedOutByCurrentUser(String user, VersionedDocument verDoc) {
+ if (! user.equals(verDoc.getCheckedOutBy()))
+ throw new CmisUpdateConflictException("Object can't be checked-in, user "
+ + verDoc.getCheckedOutBy() + " has checked out the document.");
+ }
+
+ protected void testIsCheckedOut(VersionedDocument verDoc) {
+ if (!verDoc.isCheckedOut())
+ throw new CmisUpdateConflictException("Canot check-in: Document " + verDoc.getId() + " is not checked out.");
+ }
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/AbstractServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.opencmis.inmemory;
+
+public class ConfigConstants {
+ public static final String REPOSITORY_ID = "InMemoryServer.RepositoryId";
+ public static final String TYPE_CREATOR_CLASS = "InMemoryServer.TypesCreatorClass";
+ public static final String REPOSITORY_INFO_CREATOR_CLASS = "InMemoryServer.RepositoryInfoCreatorClass";
+ public static final String USERNAME = "InMemoryServer.User";
+ public static final String PASSWORD = "InMemoryServer.Password";
+ public static final String REPOSITORY_CLASS = "InMemoryServer.Class";
+
+ // Helper constants that allow to fill a repository with data on initialization
+ public static final String USE_REPOSITORY_FILER = "RepositoryFiller.Enable";
+ public static final String FILLER_DOCUMENT_TYPE_ID = "RepositoryFiller.DocumentTypeId";
+ public static final String FILLER_FOLDER_TYPE_ID = "RepositoryFiller.FolderTypeId";
+ public static final String FILLER_DOCS_PER_FOLDER = "RepositoryFiller.DocsPerFolder";
+ public static final String FILLER_FOLDERS_PER_FOLDER = "RepositoryFiller.FolderPerFolder";
+ public static final String FILLER_DEPTH = "RepositoryFiller.Depth";
+ public static final String FILLER_CONTENT_SIZE = "RepositoryFiller.ContentSizeInKB";
+ public static final String FILLER_DOCUMENT_PROPERTY = "RepositoryFiller.DocumentProperty.";
+ public static final String FILLER_FOLDER_PROPERTY = "RepositoryFiller.FolderProperty.";
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.opencmis.inmemory;
+
+/**
+ * @author Jens
+ *
+ * ConfigMap is an interface that abstracts how runtime and configuration parameters are
+ * retrieved. For the in-memory store they can come from a CallContext in a server scenario
+ * and from a Session if it is used as provider. This interface is used to hide the details
+ * where the parameters are read from.
+ */
+public interface ConfigMap {
+
+ /**
+ * Read a configuration value
+ *
+ * @param paramName
+ * named parameter key
+ * @return
+ * parameter value
+ */
+ String get(String paramName);
+
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DataObjectCreator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DataObjectCreator.java?rev=910572&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DataObjectCreator.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DataObjectCreator.java Tue Feb 16 16:03:38 2010
@@ -0,0 +1,117 @@
+/*
+ * 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.opencmis.inmemory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.opencmis.commons.enums.IncludeRelationships;
+import org.apache.opencmis.commons.impl.dataobjects.AccessControlListImpl;
+import org.apache.opencmis.commons.impl.dataobjects.AllowableActionsDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.ChangeEventInfoDataImpl;
+import org.apache.opencmis.commons.impl.dataobjects.PolicyIdListDataImpl;
+import org.apache.opencmis.commons.provider.AccessControlEntry;
+import org.apache.opencmis.commons.provider.AccessControlList;
+import org.apache.opencmis.commons.provider.AllowableActionsData;
+import org.apache.opencmis.commons.provider.ChangeEventInfoData;
+import org.apache.opencmis.commons.provider.ObjectData;
+import org.apache.opencmis.commons.provider.PolicyIdListData;
+import org.apache.opencmis.commons.provider.RenditionData;
+import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
+
+/**
+ * @author Jens A collection of utility functions to fill the data objects used as return values for
+ * the service object calls
+ */
+public class DataObjectCreator {
+
+ public static AllowableActionsData fillAllowableActions(StoredObject so) {
+
+ AllowableActionsDataImpl allowableActions = new AllowableActionsDataImpl();
+ Map<String, Boolean> actions = new HashMap<String, Boolean>();
+ actions.put(AllowableActionsData.ACTION_CAN_DELETE_OBJECT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_UPDATE_PROPERTIES, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_PROPERTIES, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_OBJECT_RELATIONSHIPS, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_OBJECT_PARENTS, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_FOLDER_PARENT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_FOLDER_TREE, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_DESCENDANTS, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_MOVE_OBJECT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_DELETE_CONTENT_STREAM, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CHECK_OUT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CANCEL_CHECK_OUT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CHECK_IN, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_SET_CONTENT_STREAM, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_ALL_VERSIONS, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_ADD_OBJECT_TO_FOLDER, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_REMOVE_OBJECT_FROM_FOLDER, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_CONTENT_STREAM, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_APPLY_POLICY, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_APPLIED_POLICIES, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_REMOVE_POLICY, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_CHILDREN, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CREATE_DOCUMENT, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CREATE_FOLDER, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CREATE_RELATIONSHIP, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_CREATE_POLICY, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_DELETE_TREE, Boolean.TRUE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_RENDITIONS, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_GET_ACL, Boolean.FALSE);
+ actions.put(AllowableActionsData.ACTION_CAN_APPLY_ACL, Boolean.FALSE);
+ allowableActions.setAllowableActions(actions);
+ return allowableActions;
+ }
+
+ public static AccessControlList fillACL(StoredObject so) {
+ AccessControlListImpl acl = new AccessControlListImpl();
+ List<AccessControlEntry> aces = new ArrayList<AccessControlEntry>();
+ // TODO to be completed if ACLs are implemented
+ acl.setAces(aces);
+ return acl;
+ }
+
+ public static PolicyIdListData fillPolicyIds(StoredObject so) {
+ // TODO: to be completed if policies are implemented
+ PolicyIdListDataImpl polIds = new PolicyIdListDataImpl();
+ // polIds.setPolicyIds(...);
+ return polIds;
+ }
+
+ public static List<ObjectData> fillRelationships(IncludeRelationships includeRelationships,
+ StoredObject so) {
+ // TODO: to be completed if relationships are implemented
+ List<ObjectData> relationships = new ArrayList<ObjectData>();
+ return relationships;
+ }
+
+ public static List<RenditionData> fillRenditions(StoredObject so) {
+ // TODO: to be completed if renditions are implemented
+ List<RenditionData> renditions = new ArrayList<RenditionData>();
+ return renditions;
+ }
+
+ public static ChangeEventInfoData fillChangeEventInfo(StoredObject so) {
+ // TODO: to be completed if change information is implemented
+ ChangeEventInfoData changeEventInfo = new ChangeEventInfoDataImpl();
+ return changeEventInfo;
+ }
+}
Propchange: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DataObjectCreator.java
------------------------------------------------------------------------------
svn:eol-style = native