chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r937530 [2/3] - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src...
Date Fri, 23 Apr 2010 21:43:58 GMT
Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java Fri Apr 23 21:43:56 2010
@@ -36,31 +36,23 @@ import javax.servlet.http.HttpServletRes
 import org.apache.chemistry.opencmis.commons.api.ObjectData;
 import org.apache.chemistry.opencmis.commons.api.ObjectList;
 import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.api.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisRelationshipService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Relationship Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class RelationshipService {
 
     /**
      * Get object relationships.
      */
-    public static void getObjectRelationships(CallContext context, AbstractServicesFactory factory,
-            String repositoryId, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisRelationshipService service = factory.getRelationshipService();
-
+    public static void getObjectRelationships(CallContext context, CmisService service, String repositoryId,
+            HttpServletRequest request, HttpServletResponse response) throws Exception {
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         Boolean includeSubRelationshipTypes = getBooleanParameter(request, Constants.PARAM_SUB_RELATIONSHIP_TYPES);
@@ -73,16 +65,14 @@ public class RelationshipService {
         BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectList relationships = service.getObjectRelationships(context, repositoryId, objectId,
-                includeSubRelationshipTypes, relationshipDirection, typeId, filter, includeAllowableActions, maxItems,
-                skipCount, null, objectInfoHolder);
+        ObjectList relationships = service.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
+                relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, null);
 
         if (relationships == null) {
             throw new CmisRuntimeException("Relationships are null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(objectId);
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
         if (objectInfo == null) {
             throw new CmisRuntimeException("Object Info is missing!");
         }
@@ -123,7 +113,7 @@ public class RelationshipService {
                 if (object == null) {
                     continue;
                 }
-                writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, false);
+                writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
             }
         }
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java Fri Apr 23 21:43:56 2010
@@ -54,18 +54,14 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.api.TypeDefinitionList;
 import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisRepositoryService;
 
 /**
  * Repository Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public final class RepositoryService {
 
@@ -78,10 +74,8 @@ public final class RepositoryService {
     /**
      * Renders the service document.
      */
-    public static void getRepositories(CallContext context, AbstractServicesFactory factory,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisRepositoryService service = factory.getRepositoryService();
-
+    public static void getRepositories(CallContext context, CmisService service, HttpServletRequest request,
+            HttpServletResponse response) throws Exception {
         // get parameters
         String repositoryId = getStringParameter(request, Constants.PARAM_REPOSITORY_ID);
 
@@ -89,9 +83,9 @@ public final class RepositoryService {
         List<RepositoryInfo> infoDataList = null;
 
         if (repositoryId == null) {
-            infoDataList = service.getRepositoryInfos(context, null);
+            infoDataList = service.getRepositoryInfos(null);
         } else {
-            infoDataList = Collections.singletonList(service.getRepositoryInfo(context, repositoryId, null));
+            infoDataList = Collections.singletonList(service.getRepositoryInfo(repositoryId, null));
         }
 
         // set headers
@@ -239,10 +233,8 @@ public final class RepositoryService {
     /**
      * Renders a type children collection.
      */
-    public static void getTypeChildren(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getTypeChildren(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisRepositoryService service = factory.getRepositoryService();
-
         // get parameters
         String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);
         boolean includePropertyDefinitions = getBooleanParameter(request, Constants.PARAM_PROPERTY_DEFINITIONS, false);
@@ -250,8 +242,8 @@ public final class RepositoryService {
         BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
         // execute
-        TypeDefinitionList typeList = service.getTypeChildren(context, repositoryId, typeId,
-                includePropertyDefinitions, maxItems, skipCount, null);
+        TypeDefinitionList typeList = service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
+                maxItems, skipCount, null);
 
         BigInteger numItems = (typeList == null ? null : typeList.getNumItems());
         Boolean hasMoreItems = (typeList == null ? null : typeList.hasMoreItems());
@@ -262,7 +254,7 @@ public final class RepositoryService {
         // in order to get the parent type, we need the type definition of this
         // type as well
         if (typeId != null) {
-            TypeDefinition typeDefinition = service.getTypeDefinition(context, repositoryId, typeId, null);
+            TypeDefinition typeDefinition = service.getTypeDefinition(repositoryId, typeId, null);
 
             parentTypeId = (typeDefinition == null ? null : typeDefinition.getParentTypeId());
             typeName = (typeDefinition == null ? typeId : typeDefinition.getDisplayName());
@@ -326,17 +318,15 @@ public final class RepositoryService {
     /**
      * Renders a type descendants feed.
      */
-    public static void getTypeDescendants(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getTypeDescendants(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisRepositoryService service = factory.getRepositoryService();
-
         // get parameters
         String typeId = getStringParameter(request, Constants.PARAM_TYPE_ID);
         BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
         boolean includePropertyDefinitions = getBooleanParameter(request, Constants.PARAM_PROPERTY_DEFINITIONS, false);
 
         // execute
-        List<TypeDefinitionContainer> typeTree = service.getTypeDescendants(context, repositoryId, typeId, depth,
+        List<TypeDefinitionContainer> typeTree = service.getTypeDescendants(repositoryId, typeId, depth,
                 includePropertyDefinitions, null);
 
         String parentTypeId = null;
@@ -345,7 +335,7 @@ public final class RepositoryService {
         // in order to get the parent type, we need the type definition of this
         // type as well
         if (typeId != null) {
-            TypeDefinition typeDefinition = service.getTypeDefinition(context, repositoryId, typeId, null);
+            TypeDefinition typeDefinition = service.getTypeDefinition(repositoryId, typeId, null);
 
             parentTypeId = (typeDefinition == null ? null : typeDefinition.getParentTypeId());
             typeName = (typeDefinition == null ? typeId : typeDefinition.getDisplayName());
@@ -403,15 +393,13 @@ public final class RepositoryService {
     /**
      * Renders a type definition.
      */
-    public static void getTypeDefinition(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getTypeDefinition(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisRepositoryService service = factory.getRepositoryService();
-
         // get parameters
         String typeId = getStringParameter(request, Constants.PARAM_ID);
 
         // execute
-        TypeDefinition type = service.getTypeDefinition(context, repositoryId, typeId, null);
+        TypeDefinition type = service.getTypeDefinition(repositoryId, typeId, null);
 
         // write XML
         response.setStatus(HttpServletResponse.SC_OK);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java Fri Apr 23 21:43:56 2010
@@ -34,39 +34,35 @@ import javax.servlet.http.HttpServletRes
 import org.apache.chemistry.opencmis.commons.api.Holder;
 import org.apache.chemistry.opencmis.commons.api.ObjectData;
 import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.api.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisObjectService;
-import org.apache.chemistry.opencmis.server.spi.CmisVersioningService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Versioning Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class VersioningService {
 
     /**
      * Check Out.
      */
-    public static void checkOut(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void checkOut(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisVersioningService service = factory.getVersioningService();
-
         // get parameters
         AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = service.checkOut(context, repositoryId, new Holder<String>(parser.getId()), null, null,
-                objectInfoHolder);
+        Holder<String> checkOutId = new Holder<String>(parser.getId());
+        service.checkOut(repositoryId, checkOutId, null, null);
+
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, checkOutId.getValue());
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
+        }
 
+        ObjectData object = objectInfo.getObject();
         if (object == null) {
             throw new CmisRuntimeException("Object is null!");
         }
@@ -87,32 +83,29 @@ public class VersioningService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream());
-        writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
 
     /**
      * Get all versions.
      */
-    public static void getAllVersions(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getAllVersions(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisVersioningService service = factory.getVersioningService();
-
         // get parameters
-        String versionSeriesId = getStringParameter(request, Constants.PARAM_ID);
+        String objectId = getStringParameter(request, Constants.PARAM_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
         Boolean includeAllowableActions = getBooleanParameter(request, Constants.PARAM_ALLOWABLE_ACTIONS);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        List<ObjectData> versions = service.getAllVersions(context, repositoryId, versionSeriesId, filter,
-                includeAllowableActions, null, objectInfoHolder);
+        List<ObjectData> versions = service.getAllVersions(repositoryId, objectId, null, filter,
+                includeAllowableActions, null);
 
         if (versions == null) {
             throw new CmisRuntimeException("Versions are null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(versionSeriesId);
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
         if (objectInfo == null) {
             throw new CmisRuntimeException("Version Series Info is missing!");
         }
@@ -137,7 +130,7 @@ public class VersioningService {
 
         feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);
 
-        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, versionSeriesId));
+        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));
 
         // write entries
         AtomEntry entry = new AtomEntry(feed.getWriter());
@@ -145,7 +138,7 @@ public class VersioningService {
             if (object == null) {
                 continue;
             }
-            writeObjectEntry(entry, object, objectInfoHolder, null, repositoryId, null, null, baseUrl, false);
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
         }
 
         // we are done
@@ -156,15 +149,13 @@ public class VersioningService {
     /**
      * Delete object.
      */
-    public static void deleteAllVersions(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void deleteAllVersions(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisObjectService service = factory.getObjectService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
 
         // execute
-        service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, Boolean.TRUE, null);
+        service.deleteObjectOrCancelCheckOut(repositoryId, objectId, Boolean.TRUE, null);
 
         // set headers
         response.setStatus(HttpServletResponse.SC_NO_CONTENT);

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java?rev=937530&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java Fri Apr 23 21:43:56 2010
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.server.impl.dummy;
+
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.api.ObjectData;
+import org.apache.chemistry.opencmis.commons.api.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.api.ObjectParentData;
+import org.apache.chemistry.opencmis.commons.api.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.api.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.api.TypeDefinitionList;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
+
+/**
+ * Simplest Repository Service implementation.
+ */
+public class DummyService extends AbstractCmisService {
+
+	private RepositoryInfoImpl fRepInfo;
+
+	public DummyService(String id, String name) {
+		fRepInfo = new RepositoryInfoImpl();
+
+		fRepInfo.setRepositoryId(id);
+		fRepInfo.setRepositoryName(name);
+		fRepInfo.setRepositoryDescription(name);
+		fRepInfo.setCmisVersionSupported("1.0");
+		fRepInfo.setRootFolder("root");
+
+		fRepInfo.setVendorName("OpenCMIS");
+		fRepInfo.setProductName("OpenCMIS Server");
+		fRepInfo.setProductVersion("1.0");
+	}
+
+	public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+		if (!fRepInfo.getId().equals(repositoryId)) {
+			throw new CmisObjectNotFoundException("A repository with repository id '" + repositoryId
+					+ "' does not exist!");
+		}
+
+		return fRepInfo;
+	}
+
+	public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+		return Collections.singletonList((RepositoryInfo) fRepInfo);
+	}
+
+	@Override
+	public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
+			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+			Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+		throw new CmisNotSupportedException();
+	}
+
+	@Override
+	public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
+			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+			Boolean includeAcl, ExtensionsData extension) {
+		throw new CmisNotSupportedException();
+	}
+
+	@Override
+	public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
+			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+			Boolean includeRelativePathSegment, ExtensionsData extension) {
+		throw new CmisNotSupportedException();
+	}
+
+	@Override
+	public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
+			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+		throw new CmisNotSupportedException();
+	}
+
+	@Override
+	public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
+		throw new CmisNotSupportedException();
+	}
+}

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java Fri Apr 23 21:43:56 2010
@@ -20,18 +20,16 @@ package org.apache.chemistry.opencmis.se
 
 import java.util.Map;
 
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisRepositoryService;
+import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
  * Implementation of a repository factory without back-end for test purposes.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
-public class DummyServicesFactory extends AbstractServicesFactory {
+public class DummyServicesFactory extends AbstractServiceFactory {
 
     private static final String REPOSITORY_ID = "repository.id";
     private static final String REPOSITORY_ID_DEFAULT = "test-rep";
@@ -41,38 +39,37 @@ public class DummyServicesFactory extend
 
     private static final Log LOG = LogFactory.getLog(DummyServicesFactory.class.getName());
 
-    private DummyRepositoryService fRepositoryService;
-    private String fId;
-    private String fName;
+    private DummyService service;
+    private String id;
+    private String name;
 
     @Override
     public void init(Map<String, String> parameters) {
         // get the id
-        fId = parameters.get(REPOSITORY_ID);
-        if ((fId == null) || (fId.trim().length() == 0)) {
-            fId = REPOSITORY_ID_DEFAULT;
+        id = parameters.get(REPOSITORY_ID);
+        if ((id == null) || (id.trim().length() == 0)) {
+            id = REPOSITORY_ID_DEFAULT;
         }
 
         // get the name
-        fName = parameters.get(REPOSITORY_NAME);
-        if ((fName == null) || (fName.trim().length() == 0)) {
-            fName = REPOSITORY_NAME_DEFAULT;
+        name = parameters.get(REPOSITORY_NAME);
+        if ((name == null) || (name.trim().length() == 0)) {
+            name = REPOSITORY_NAME_DEFAULT;
         }
 
         // create a repository service
-        fRepositoryService = new DummyRepositoryService(fId, fName);
+        service = new DummyService(id, name);
 
-        LOG.info("Initialized dummy repository '" + fName + "' (" + fId + ")");
+        LOG.info("Initialized dummy repository '" + name + "' (" + id + ")");
     }
 
     @Override
     public void destroy() {
-        LOG.info("Destroyed dummy repository '" + fName + "' (" + fId + ")");
+        LOG.info("Destroyed dummy repository '" + name + "' (" + id + ")");
     }
 
     @Override
-    public CmisRepositoryService getRepositoryService() {
-        return fRepositoryService;
+    public CmisService getService(CallContext context) {
+        return service;
     }
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java Fri Apr 23 21:43:56 2010
@@ -26,6 +26,7 @@ import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.handler.MessageContext;
 
 import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException;
@@ -42,9 +43,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisFaultType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumServiceException;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
 import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
 import org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
 
 /**
  * This class contains operations used by all services.
@@ -56,11 +57,11 @@ public abstract class AbstractService {
     /**
      * Returns the services factory.
      */
-    protected AbstractServicesFactory getServicesFactory(WebServiceContext wsContext) {
+    protected AbstractServiceFactory getServiceFactory(WebServiceContext wsContext) {
         ServletContext servletContext = (ServletContext) wsContext.getMessageContext().get(
                 MessageContext.SERVLET_CONTEXT);
 
-        return (AbstractServicesFactory) servletContext.getAttribute(CmisRepositoryContextListener.SERVICES_FACTORY);
+        return (AbstractServiceFactory) servletContext.getAttribute(CmisRepositoryContextListener.SERVICES_FACTORY);
     }
 
     /**
@@ -82,6 +83,24 @@ public abstract class AbstractService {
     }
 
     /**
+     * Returns the {@link CmisService} object.
+     */
+    protected CmisService getService(WebServiceContext wsContext, String repositoryId) {
+        AbstractServiceFactory factory = getServiceFactory(wsContext);
+        CallContext context = createContext(wsContext, repositoryId);
+        return factory.getService(context);
+    }
+
+    /**
+     * Closes the service instance.
+     */
+    protected void closeService(CmisService service) {
+        if (service != null) {
+            service.close();
+        }
+    }
+
+    /**
      * Converts a CMIS exception to the appropriate Web Service exception.
      */
     protected CmisException convertException(Exception ex) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java Fri Apr 23 21:43:56 2010
@@ -25,7 +25,7 @@ import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.Acl;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisACLType;
@@ -33,8 +33,6 @@ import org.apache.chemistry.opencmis.com
 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.EnumACLPropagation;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisAclService;
 
 /**
  * CMIS ACL Service.
@@ -47,13 +45,12 @@ public class AclService extends Abstract
     public CmisACLType applyACL(String repositoryId, String objectId, CmisAccessControlListType addAces,
             CmisAccessControlListType removeAces, EnumACLPropagation aclPropagation, CmisExtensionType extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisAclService service = factory.getAclService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            Acl acl = service.applyAcl(context, repositoryId, objectId, convert(addAces, null), convert(removeAces,
-                    null), convert(AclPropagation.class, aclPropagation), convert(extension));
+            Acl acl = service.applyAcl(repositoryId, objectId, convert(addAces, null), convert(removeAces, null),
+                    convert(AclPropagation.class, aclPropagation), convert(extension));
 
             if (acl == null) {
                 return null;
@@ -66,18 +63,18 @@ public class AclService extends Abstract
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisACLType getACL(String repositoryId, String objectId, Boolean onlyBasicPermissions,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisAclService service = factory.getAclService();
-            CallContext context = createContext(wsContext, repositoryId);
-
-            Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions, convert(extension));
+            service = getService(wsContext, repositoryId);
 
+            Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, convert(extension));
             if (acl == null) {
                 return null;
             }
@@ -89,7 +86,8 @@ public class AclService extends Abstract
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java Fri Apr 23 21:43:56 2010
@@ -30,15 +30,13 @@ import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.ObjectList;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 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.CmisObjectListType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisDiscoveryService;
 
 /**
  * CMIS Discovery Service.
@@ -51,15 +49,14 @@ public class DiscoveryService extends Ab
     public void getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
             String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems,
             CmisExtensionType extension, Holder<CmisObjectListType> objects) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisDiscoveryService service = factory.getDiscoveryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             org.apache.chemistry.opencmis.commons.api.Holder<String> changeLogTokenHolder = convertHolder(changeLogToken);
 
-            ObjectList changesList = service.getContentChanges(context, repositoryId, changeLogTokenHolder,
-                    includeProperties, filter, includePolicyIds, includeAcl, maxItems, convert(extension), null);
+            ObjectList changesList = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties,
+                    filter, includePolicyIds, includeAcl, maxItems, convert(extension));
 
             if (objects != null) {
                 objects.value = convert(changesList);
@@ -68,23 +65,25 @@ public class DiscoveryService extends Ab
             setHolderValue(changeLogTokenHolder, changeLogToken);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisObjectListType query(String repositoryId, String statement, Boolean searchAllVersions,
             Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
             BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisDiscoveryService service = factory.getDiscoveryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.query(context, repositoryId, statement, searchAllVersions, includeAllowableActions,
-                    convert(IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount,
+            return convert(service.query(repositoryId, statement, searchAllVersions, includeAllowableActions, convert(
+                    IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount,
                     convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java Fri Apr 23 21:43:56 2010
@@ -27,12 +27,10 @@ import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 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.MultiFilingServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisMultiFilingService;
 
 /**
  * CMIS MultiFiling Service.
@@ -44,36 +42,37 @@ public class MultiFilingService extends 
 
     public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
             Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisMultiFilingService service = factory.getMultiFilingService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extData, null);
+            service.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void removeObjectFromFolder(String repositoryId, String objectId, String folderId,
             Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisMultiFilingService service = factory.getMultiFilingService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.removeObjectFromFolder(context, repositoryId, objectId, folderId, extData, null);
+            service.removeObjectFromFolder(repositoryId, objectId, folderId, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java Fri Apr 23 21:43:56 2010
@@ -30,7 +30,7 @@ import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.ObjectInFolderContainer;
 import org.apache.chemistry.opencmis.commons.api.ObjectParentData;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
@@ -41,8 +41,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.NavigationServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisNavigationService;
 
 /**
  * CMIS Navigation Service.
@@ -55,16 +53,17 @@ public class NavigationService extends A
     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 {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
-                    includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
-                    renditionFilter, maxItems, skipCount, convert(extension), null));
+            return convert(service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy, includeAllowableActions,
+                    convert(IncludeRelationships.class, includeRelationships), renditionFilter, maxItems, skipCount,
+                    convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
@@ -72,32 +71,32 @@ public class NavigationService extends A
             Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
             Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getChildren(context, repositoryId, folderId, filter, orderBy,
-                    includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
-                    renditionFilter, includePathSegment, maxItems, skipCount, convert(extension), null));
+            return convert(service.getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
+                    convert(IncludeRelationships.class, includeRelationships), renditionFilter, includePathSegment,
+                    maxItems, skipCount, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisObjectInFolderContainerType> getDescendants(String repositoryId, String folderId, BigInteger depth,
             String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
             String renditionFilter, Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             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);
+            List<ObjectInFolderContainer> serviceResult = service.getDescendants(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+                    renditionFilter, includePathSegment, convert(extension));
 
             if (serviceResult != null) {
                 for (ObjectInFolderContainer container : serviceResult) {
@@ -108,35 +107,37 @@ public class NavigationService extends A
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisObjectType getFolderParent(String repositoryId, String folderId, String filter,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getFolderParent(context, repositoryId, folderId, filter, convert(extension), null));
+            return convert(service.getFolderParent(repositoryId, folderId, filter, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisObjectInFolderContainerType> getFolderTree(String repositoryId, String folderId, BigInteger depth,
             String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
             String renditionFilter, Boolean includePathSegment, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             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);
+            List<ObjectInFolderContainer> serviceResult = service.getFolderTree(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
+                    renditionFilter, includePathSegment, convert(extension));
 
             if (serviceResult != null) {
                 for (ObjectInFolderContainer container : serviceResult) {
@@ -147,22 +148,23 @@ public class NavigationService extends A
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisObjectParentsType> getObjectParents(String repositoryId, String objectId, String filter,
             Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
             Boolean includeRelativePathSegment, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisNavigationService service = factory.getNavigationService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             List<CmisObjectParentsType> result = new ArrayList<CmisObjectParentsType>();
 
-            List<ObjectParentData> serviceResult = service.getObjectParents(context, repositoryId, objectId, filter,
+            List<ObjectParentData> serviceResult = service.getObjectParents(repositoryId, objectId, filter,
                     includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
-                    renditionFilter, includeRelativePathSegment, convert(extension), null);
+                    renditionFilter, includeRelativePathSegment, convert(extension));
 
             if (serviceResult != null) {
                 for (ObjectParentData parent : serviceResult) {
@@ -173,6 +175,8 @@ public class NavigationService extends A
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java Fri Apr 23 21:43:56 2010
@@ -35,7 +35,7 @@ import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.api.RenditionData;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
@@ -52,8 +52,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumVersioningState;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectServicePort;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.DeleteTreeResponse.FailedToDelete;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisObjectService;
 
 import com.sun.xml.ws.developer.StreamingAttachment;
 
@@ -70,16 +68,15 @@ public class ObjectService extends Abstr
             CmisContentStreamType contentStream, EnumVersioningState versioningState, List<String> policies,
             CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
             Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             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);
+            String id = service.createDocument(repositoryId, convert(properties), folderId, convert(contentStream),
+                    convert(VersioningState.class, versioningState), policies, convert(addAces, null), convert(
+                            removeAces, null), extData);
 
             if (objectId != null) {
                 objectId.value = id;
@@ -88,6 +85,8 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
@@ -95,16 +94,15 @@ public class ObjectService extends Abstr
             String folderId, EnumVersioningState versioningState, List<String> policies,
             CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
             Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             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);
+            String id = service.createDocumentFromSource(repositoryId, sourceId, convert(properties), folderId,
+                    convert(VersioningState.class, versioningState), policies, convert(addAces, null), convert(
+                            removeAces, null), extData);
 
             if (objectId != null) {
                 objectId.value = id;
@@ -113,21 +111,22 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void createFolder(String repositoryId, CmisPropertiesType properties, String folderId,
             List<String> policies, CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
             Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            String id = service.createFolder(context, repositoryId, convert(properties), folderId, policies, convert(
-                    addAces, null), convert(removeAces, null), extData);
+            String id = service.createFolder(repositoryId, convert(properties), folderId, policies, convert(addAces,
+                    null), convert(removeAces, null), extData);
 
             if (objectId != null) {
                 objectId.value = id;
@@ -136,21 +135,22 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void createPolicy(String repositoryId, CmisPropertiesType properties, String folderId,
             List<String> policies, CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
             Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            String id = service.createPolicy(context, repositoryId, convert(properties), folderId, policies, convert(
-                    addAces, null), convert(removeAces, null), extData);
+            String id = service.createPolicy(repositoryId, convert(properties), folderId, policies, convert(addAces,
+                    null), convert(removeAces, null), extData);
 
             if (objectId != null) {
                 objectId.value = id;
@@ -159,21 +159,22 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void createRelationship(String repositoryId, CmisPropertiesType properties, List<String> policies,
             CmisAccessControlListType addAces, CmisAccessControlListType removeAces,
             Holder<CmisExtensionType> extension, Holder<String> objectId) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            String id = service.createRelationship(context, repositoryId, convert(properties), policies, convert(
-                    addAces, null), convert(removeAces, null), extData);
+            String id = service.createRelationship(repositoryId, convert(properties), policies, convert(addAces, null),
+                    convert(removeAces, null), extData);
 
             if (objectId != null) {
                 objectId.value = id;
@@ -182,144 +183,153 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
             Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
             org.apache.chemistry.opencmis.commons.api.Holder<String> changeTokenHolder = convertHolder(changeToken);
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.deleteContentStream(context, repositoryId, objectIdHolder, changeTokenHolder, extData);
+            service.deleteContentStream(repositoryId, objectIdHolder, changeTokenHolder, extData);
 
             setHolderValue(objectIdHolder, objectId);
             setHolderValue(changeTokenHolder, changeToken);
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void deleteObject(String repositoryId, String objectId, Boolean allVersions,
             Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, allVersions, extData);
+            service.deleteObjectOrCancelCheckOut(repositoryId, objectId, allVersions, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public FailedToDelete deleteTree(String repositoryId, String folderId, Boolean allVersions,
             EnumUnfileObject unfileObjects, Boolean continueOnFailure, CmisExtensionType extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.deleteTree(context, repositoryId, folderId, allVersions, convert(UnfileObject.class,
+            return convert(service.deleteTree(repositoryId, folderId, allVersions, convert(UnfileObject.class,
                     unfileObjects), continueOnFailure, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisAllowableActionsType getAllowableActions(String repositoryId, String objectId,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getAllowableActions(context, repositoryId, objectId, convert(extension)));
+            return convert(service.getAllowableActions(repositoryId, objectId, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisContentStreamType getContentStream(String repositoryId, String objectId, String streamId,
             BigInteger offset, BigInteger length, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getContentStream(context, repositoryId, objectId, streamId, offset, length,
+            return convert(service.getContentStream(repositoryId, objectId, streamId, offset, length,
                     convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisObjectType getObject(String repositoryId, String objectId, String filter,
             Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
             Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getObject(context, repositoryId, objectId, filter, includeAllowableActions, convert(
+            return convert(service.getObject(repositoryId, objectId, filter, includeAllowableActions, convert(
                     IncludeRelationships.class, includeRelationships), renditionFilter, includePolicyIds, includeAcl,
-                    convert(extension), null));
+                    convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisObjectType getObjectByPath(String repositoryId, String path, String filter,
             Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
             Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
-
-            return convert(service.getObjectByPath(context, repositoryId, path, filter, includeAllowableActions,
-                    convert(IncludeRelationships.class, includeRelationships), renditionFilter, includePolicyIds,
-                    includeAcl, convert(extension), null));
+            service = getService(wsContext, repositoryId);
+
+            return convert(service.getObjectByPath(repositoryId, path, filter, includeAllowableActions, convert(
+                    IncludeRelationships.class, includeRelationships), renditionFilter, includePolicyIds, includeAcl,
+                    convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisPropertiesType getProperties(String repositoryId, String objectId, String filter,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getProperties(context, repositoryId, objectId, filter, convert(extension)));
+            return convert(service.getProperties(repositoryId, objectId, filter, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisRenditionType> getRenditions(String repositoryId, String objectId, String renditionFilter,
             BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             List<CmisRenditionType> result = new ArrayList<CmisRenditionType>();
 
-            List<RenditionData> renditionList = service.getRenditions(context, repositoryId, objectId, renditionFilter,
+            List<RenditionData> renditionList = service.getRenditions(repositoryId, objectId, renditionFilter,
                     maxItems, skipCount, convert(extension));
 
             if (renditionList != null) {
@@ -331,41 +341,43 @@ public class ObjectService extends Abstr
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
             Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.moveObject(context, repositoryId, objectIdHolder, targetFolderId, sourceFolderId, extData, null);
+            service.moveObject(repositoryId, objectIdHolder, targetFolderId, sourceFolderId, extData);
 
             setHolderValue(objectIdHolder, objectId);
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
             Holder<String> changeToken, CmisContentStreamType contentStream, Holder<CmisExtensionType> extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
             org.apache.chemistry.opencmis.commons.api.Holder<String> changeTokenHolder = convertHolder(changeToken);
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.setContentStream(context, repositoryId, objectIdHolder, overwriteFlag, changeTokenHolder,
+            service.setContentStream(repositoryId, objectIdHolder, overwriteFlag, changeTokenHolder,
                     convert(contentStream), extData);
 
             setHolderValue(objectIdHolder, objectId);
@@ -373,28 +385,30 @@ public class ObjectService extends Abstr
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
             CmisPropertiesType properties, Holder<CmisExtensionType> extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisObjectService service = factory.getObjectService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             org.apache.chemistry.opencmis.commons.api.Holder<String> objectIdHolder = convertHolder(objectId);
             org.apache.chemistry.opencmis.commons.api.Holder<String> changeTokenHolder = convertHolder(changeToken);
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.updateProperties(context, repositoryId, objectIdHolder, changeTokenHolder, convert(properties),
-                    null, extData, null);
+            service.updateProperties(repositoryId, objectIdHolder, changeTokenHolder, convert(properties), extData);
 
             setHolderValue(objectIdHolder, objectId);
             setHolderValue(changeTokenHolder, changeToken);
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java Fri Apr 23 21:43:56 2010
@@ -32,13 +32,11 @@ import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.ExtensionsData;
 import org.apache.chemistry.opencmis.commons.api.ObjectData;
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.PolicyServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisPolicyService;
 
 /**
  * CMIS Policy Service.
@@ -50,30 +48,29 @@ public class PolicyService extends Abstr
 
     public void applyPolicy(String repositoryId, String policyId, String objectId, Holder<CmisExtensionType> extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisPolicyService service = factory.getPolicyService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.applyPolicy(context, repositoryId, policyId, objectId, extData, null);
+            service.applyPolicy(repositoryId, policyId, objectId, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisObjectType> getAppliedPolicies(String repositoryId, String objectId, String filter,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisPolicyService service = factory.getPolicyService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            List<ObjectData> policies = service.getAppliedPolicies(context, repositoryId, objectId, filter,
-                    convert(extension), null);
+            List<ObjectData> policies = service.getAppliedPolicies(repositoryId, objectId, filter, convert(extension));
 
             if (policies == null) {
                 return null;
@@ -87,24 +84,26 @@ public class PolicyService extends Abstr
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void removePolicy(String repositoryId, String policyId, String objectId, Holder<CmisExtensionType> extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisPolicyService service = factory.getPolicyService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.removePolicy(context, repositoryId, policyId, objectId, extData);
+            service.removePolicy(repositoryId, policyId, objectId, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java Fri Apr 23 21:43:56 2010
@@ -26,15 +26,13 @@ import javax.annotation.Resource;
 import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
-import org.apache.chemistry.opencmis.commons.api.server.CallContext;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
 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.CmisObjectListType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumRelationshipDirection;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisRelationshipService;
 
 /**
  * CMIS Relationship Service.
@@ -48,17 +46,17 @@ public class RelationshipService extends
             Boolean includeSubRelationshipTypes, EnumRelationshipDirection relationshipDirection, String typeId,
             String filter, Boolean includeAllowableActions, BigInteger maxItems, BigInteger skipCount,
             CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRelationshipService service = factory.getRelationshipService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getObjectRelationships(context, repositoryId, objectId, includeSubRelationshipTypes,
-                    convert(RelationshipDirection.class, relationshipDirection), typeId, filter,
-                    includeAllowableActions, maxItems, skipCount, convert(extension), null));
+            return convert(service.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes, convert(
+                    RelationshipDirection.class, relationshipDirection), typeId, filter, includeAllowableActions,
+                    maxItems, skipCount, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
 }



Mime
View raw message