chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r937530 [1/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
Author: fmui
Date: Fri Apr 23 21:43:56 2010
New Revision: 937530

URL: http://svn.apache.org/viewvc?rev=937530&view=rev
Log:
activated the new server interface

Added:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ObjectInfoHandler.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyService.java
Removed:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyRepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/DocumentInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FolderInfo.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/ServicesFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/VersioningService.java
Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/Dispatcher.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/dummy/DummyServicesFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/main/webapp/WEB-INF/classes/repository.properties
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectVersionIT.java

Added: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ObjectInfoHandler.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ObjectInfoHandler.java?rev=937530&view=auto
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ObjectInfoHandler.java (added)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/api/server/ObjectInfoHandler.java Fri Apr 23 21:43:56 2010
@@ -0,0 +1,8 @@
+package org.apache.chemistry.opencmis.commons.api.server;
+
+public interface ObjectInfoHandler {
+
+	ObjectInfo getObjectInfo(String repositoryId, String objectId);
+
+	void addObjectInfo(ObjectInfo objectInfo);
+}

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/server/AbstractCmisService.java Fri Apr 23 21:43:56 2010
@@ -34,6 +34,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.TypeDefinitionList;
 import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.api.server.ObjectInfo;
+import org.apache.chemistry.opencmis.commons.api.server.ObjectInfoHandler;
 import org.apache.chemistry.opencmis.commons.api.server.RenditionInfo;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -47,7 +48,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 
-public abstract class AbstractCmisService implements CmisService {
+public abstract class AbstractCmisService implements CmisService, ObjectInfoHandler {
 
     private Map<String, ObjectInfo> objectInfoMap;
     private boolean addObjectInfos = true;
@@ -865,9 +866,9 @@ public abstract class AbstractCmisServic
      * </ul>
      */
     public ObjectInfo getObjectInfo(String repositoryId, String objectId) {
-        objectInfoMap = getObjectInfoMap();
+        Map<String, ObjectInfo> oim = getObjectInfoMap();
 
-        ObjectInfo info = objectInfoMap.get(objectId);
+        ObjectInfo info = oim.get(objectId);
         if (info == null) {
             // object info has not been found -> create one
             ObjectInfoImpl infoImpl = new ObjectInfoImpl();

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.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/CmisRepositoryContextListener.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/CmisRepositoryContextListener.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/CmisRepositoryContextListener.java Fri Apr 23 21:43:56 2010
@@ -28,15 +28,12 @@ import java.util.Properties;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
 
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
  * CMIS context listener.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class CmisRepositoryContextListener implements ServletContextListener {
 
@@ -47,40 +44,27 @@ public class CmisRepositoryContextListen
     private static final String CONFIG_FILENAME = "/repository.properties";
     private static final String PROPERTY_CLASS = "class";
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * javax.servlet.ServletContextListener#contextInitialized(javax.servlet
-     * .ServletContextEvent)
-     */
     public void contextInitialized(ServletContextEvent sce) {
         // create services factory
-        AbstractServicesFactory factory = createServicesFactory(CONFIG_FILENAME);
+        AbstractServiceFactory factory = createServiceFactory(CONFIG_FILENAME);
 
         // set the services factory into the servlet context
         sce.getServletContext().setAttribute(SERVICES_FACTORY, factory);
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seejavax.servlet.ServletContextListener#contextDestroyed(javax.servlet.
-     * ServletContextEvent)
-     */
     public void contextDestroyed(ServletContextEvent sce) {
         // destroy services factory
-        AbstractServicesFactory factory = (AbstractServicesFactory) sce.getServletContext().getAttribute(
-                SERVICES_FACTORY);
+        AbstractServiceFactory factory = (AbstractServiceFactory) sce.getServletContext()
+                .getAttribute(SERVICES_FACTORY);
         if (factory != null) {
             factory.destroy();
         }
     }
 
     /**
-     * Creates a services factory.
+     * Creates a service factory.
      */
-    private AbstractServicesFactory createServicesFactory(String filename) {
+    private AbstractServiceFactory createServiceFactory(String filename) {
         // load properties
         InputStream stream = this.getClass().getResourceAsStream(filename);
 
@@ -113,11 +97,11 @@ public class CmisRepositoryContextListen
             return null;
         }
 
-        if (!(object instanceof AbstractServicesFactory)) {
-            log.warn("The provided class is not a sub class of AbstractServicesFactory!");
+        if (!(object instanceof AbstractServiceFactory)) {
+            log.warn("The provided class is not a sub class of AbstractServiceFactory!");
         }
 
-        AbstractServicesFactory factory = (AbstractServicesFactory) object;
+        AbstractServiceFactory factory = (AbstractServiceFactory) object;
 
         // initialize factory instance
         Map<String, String> parameters = new HashMap<String, String>();

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/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/atompub/AclService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java Fri Apr 23 21:43:56 2010
@@ -30,36 +30,30 @@ import javax.xml.bind.Unmarshaller;
 
 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.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisAclService;
 
 /**
  * ACL Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class AclService {
 
     /**
      * Get ACL.
      */
-    public static void getAcl(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getAcl(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisAclService service = factory.getAclService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);
 
         // execute
-        Acl acl = service.getAcl(context, repositoryId, objectId, onlyBasicPermissions, null);
+        Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, null);
 
         if (acl == null) {
             throw new CmisRuntimeException("ACL is null!");
@@ -77,10 +71,8 @@ public class AclService {
     /**
      * Apply ACL.
      */
-    public static void applyAcl(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void applyAcl(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisAclService service = factory.getAclService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         AclPropagation aclPropagation = getEnumParameter(request, Constants.PARAM_ACL_PROPAGATION, AclPropagation.class);
@@ -104,7 +96,7 @@ public class AclService {
         Acl aces = convert((CmisAccessControlListType) ((JAXBElement<?>) aclRequest).getValue(), null);
 
         // execute
-        Acl acl = service.applyAcl(context, repositoryId, objectId, aces, aclPropagation);
+        Acl acl = service.applyAcl(repositoryId, objectId, aces, aclPropagation);
 
         // set headers
         response.setStatus(HttpServletResponse.SC_CREATED);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.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/AtomPubUtils.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/AtomPubUtils.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java Fri Apr 23 21:43:56 2010
@@ -34,6 +34,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.PropertyData;
 import org.apache.chemistry.opencmis.commons.api.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.api.TypeDefinitionContainer;
+import org.apache.chemistry.opencmis.commons.api.server.CmisService;
 import org.apache.chemistry.opencmis.commons.api.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.api.server.RenditionInfo;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -42,13 +43,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * This class contains operations used by all services.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public final class AtomPubUtils {
 
@@ -259,14 +256,14 @@ public final class AtomPubUtils {
     /**
      * Writes the a object entry.
      */
-    public static void writeObjectEntry(AtomEntry entry, ObjectData object, ObjectInfoHolder infoHolder,
+    public static void writeObjectEntry(CmisService service, AtomEntry entry, ObjectData object,
             List<ObjectInFolderContainer> children, String repositoryId, String pathSegment,
             String relativePathSegment, UrlBuilder baseUrl, boolean isRoot) throws XMLStreamException, JAXBException {
-        if ((object == null) || (infoHolder == null)) {
-            throw new CmisRuntimeException("Object or Object Info not set!");
+        if (object == null) {
+            throw new CmisRuntimeException("Object not set!");
         }
 
-        ObjectInfo info = infoHolder.getObjectInfo(object.getId());
+        ObjectInfo info = service.getObjectInfo(repositoryId, object.getId());
         if (info == null) {
             throw new CmisRuntimeException("Object Info not found!");
         }
@@ -369,7 +366,7 @@ public final class AtomPubUtils {
 
         // write children
         if ((children != null) && (children.size() > 0)) {
-            writeObjectChildren(entry, info, children, infoHolder, repositoryId, baseUrl);
+            writeObjectChildren(service, entry, info, children, repositoryId, baseUrl);
         }
 
         // we are done
@@ -379,9 +376,9 @@ public final class AtomPubUtils {
     /**
      * Writes an objects entry children feed.
      */
-    public static void writeObjectChildren(AtomEntry entry, ObjectInfo folderInfo,
-            List<ObjectInFolderContainer> children, ObjectInfoHolder infoHolder, String repositoryId, UrlBuilder baseUrl)
-            throws XMLStreamException, JAXBException {
+    public static void writeObjectChildren(CmisService service, AtomEntry entry, ObjectInfo folderInfo,
+            List<ObjectInFolderContainer> children, String repositoryId, UrlBuilder baseUrl) throws XMLStreamException,
+            JAXBException {
 
         // start
         AtomFeed feed = new AtomFeed(entry.getWriter());
@@ -408,7 +405,7 @@ public final class AtomPubUtils {
 
         for (ObjectInFolderContainer container : children) {
             if ((container != null) && (container.getObject() != null)) {
-                writeObjectEntry(entry, container.getObject().getObject(), infoHolder, container.getChildren(),
+                writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(),
                         repositoryId, container.getObject().getPathSegment(), 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/CmisAtomPubServlet.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/CmisAtomPubServlet.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/CmisAtomPubServlet.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java Fri Apr 23 21:43:56 2010
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 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;
@@ -43,9 +44,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
+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;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -184,31 +185,41 @@ public class CmisAtomPubServlet extends 
     private void dispatch(CallContext context, HttpServletRequest request, HttpServletResponse response)
             throws Exception {
 
-        // get services factory
-        AbstractServicesFactory servicesFactory = (AbstractServicesFactory) getServletContext().getAttribute(
-                CmisRepositoryContextListener.SERVICES_FACTORY);
-
-        // analyze the path
-        String[] pathFragments = splitPath(request);
-
-        if (pathFragments.length < 2) {
-            // root -> service document
-            RepositoryService.getRepositories(context, servicesFactory, request, response);
-            return;
-        }
+        CmisService service = null;
+        try {
+            // get services factory
+            AbstractServiceFactory factory = (AbstractServiceFactory) getServletContext().getAttribute(
+                    CmisRepositoryContextListener.SERVICES_FACTORY);
+
+            // get the service
+            service = factory.getService(context);
+
+            // analyze the path
+            String[] pathFragments = splitPath(request);
+
+            if (pathFragments.length < 2) {
+                // root -> service document
+                RepositoryService.getRepositories(context, service, request, response);
+                return;
+            }
 
-        String method = request.getMethod();
-        String repositoryId = pathFragments[0];
-        String resource = pathFragments[1];
-
-        // dispatch
-        boolean methodFound = fDispatcher.dispatch(resource, method, context, servicesFactory, repositoryId, request,
-                response);
-
-        // if the dispatcher couldn't find a matching method, return an error
-        // message
-        if (!methodFound) {
-            response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Unknown operation");
+            String method = request.getMethod();
+            String repositoryId = pathFragments[0];
+            String resource = pathFragments[1];
+
+            // dispatch
+            boolean methodFound = fDispatcher.dispatch(resource, method, context, service, repositoryId, request,
+                    response);
+
+            // if the dispatcher couldn't find a matching method, return an
+            // error message
+            if (!methodFound) {
+                response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Unknown operation");
+            }
+        } finally {
+            if (service != null) {
+                service.close();
+            }
         }
     }
 
@@ -225,7 +236,7 @@ public class CmisAtomPubServlet extends 
 
         CallContextImpl context = new CallContextImpl(CallContext.BINDING_ATOMPUB, repositoryId, true);
 
-        // call call text handler
+        // call call context handler
         if (fCallContextHandler != null) {
             Map<String, String> callContextMap = fCallContextHandler.getCallContextMap(request);
             if (callContextMap != null) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/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/atompub/DiscoveryService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java Fri Apr 23 21:43:56 2010
@@ -41,6 +41,7 @@ import org.apache.chemistry.opencmis.com
 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.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
@@ -49,16 +50,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisQueryType;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisDiscoveryService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Discovery Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class DiscoveryService {
 
@@ -68,10 +62,8 @@ public class DiscoveryService {
     /**
      * Query.
      */
-    public static void query(CallContext context, AbstractServicesFactory factory, String repositoryId,
-            HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisDiscoveryService service = factory.getDiscoveryService();
-
+    public static void query(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
+            HttpServletResponse response) throws Exception {
         // get parameters
         String statement = null;
         Boolean searchAllVersions = null;
@@ -128,8 +120,8 @@ public class DiscoveryService {
         }
 
         // execute
-        ObjectList results = service.query(context, repositoryId, statement, searchAllVersions,
-                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
+        ObjectList results = service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
+                includeRelationships, renditionFilter, maxItems, skipCount, null);
 
         if (results == null) {
             throw new CmisRuntimeException("Results are null!");
@@ -212,10 +204,8 @@ public class DiscoveryService {
     /**
      * Get content changes.
      */
-    public static void getContentChanges(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getContentChanges(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisDiscoveryService service = factory.getDiscoveryService();
-
         // get parameters
         String changeLogToken = getStringParameter(request, Constants.PARAM_CHANGE_LOG_TOKEN);
         Boolean includeProperties = getBooleanParameter(request, Constants.PARAM_PROPERTIES);
@@ -225,10 +215,9 @@ public class DiscoveryService {
         BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
         Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
-        ObjectList changes = service.getContentChanges(context, repositoryId, changeLogTokenHolder, includeProperties,
-                filter, includePolicyIds, includeAcl, maxItems, null, objectInfoHolder);
+        ObjectList changes = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties, filter,
+                includePolicyIds, includeAcl, maxItems, null);
 
         if (changes == null) {
             throw new CmisRuntimeException("Changes are null!");
@@ -270,7 +259,7 @@ public class DiscoveryService {
                 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/Dispatcher.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/Dispatcher.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/Dispatcher.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/Dispatcher.java Fri Apr 23 21:43:56 2010
@@ -27,9 +27,9 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 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.CmisRuntimeException;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -54,7 +54,7 @@ public class Dispatcher {
     public synchronized void addResource(String resource, String httpMethod, Class<?> clazz, String classmethod)
             throws NoSuchMethodException {
 
-        Method m = clazz.getMethod(classmethod, CallContext.class, AbstractServicesFactory.class, String.class,
+        Method m = clazz.getMethod(classmethod, CallContext.class, CmisService.class, String.class,
                 HttpServletRequest.class, HttpServletResponse.class);
 
         fMethodMap.put(getKey(resource, httpMethod), m);
@@ -66,9 +66,8 @@ public class Dispatcher {
      * @return <code>true</code> if the method was found, <code>false</code>
      *         otherwise.
      */
-    public boolean dispatch(String resource, String httpMethod, CallContext context, AbstractServicesFactory factory,
+    public boolean dispatch(String resource, String httpMethod, CallContext context, CmisService service,
             String repositoryId, HttpServletRequest request, HttpServletResponse response) {
-
         Method m = fMethodMap.get(getKey(resource, httpMethod));
         if (m == null) {
             return false;
@@ -79,7 +78,7 @@ public class Dispatcher {
         }
 
         try {
-            m.invoke(null, context, factory, repositoryId, request, response);
+            m.invoke(null, context, service, repositoryId, request, response);
         } catch (IllegalArgumentException e) {
             throw e;
         } catch (IllegalAccessException e) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/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/atompub/MultiFilingService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java Fri Apr 23 21:43:56 2010
@@ -29,29 +29,22 @@ import javax.servlet.http.HttpServletRes
 
 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.CmisMultiFilingService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * MultiFiling Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class MultiFilingService {
 
     /**
      * Remove object from folder.
      */
-    public static void removeObjectFromFolder(CallContext context, AbstractServicesFactory factory,
-            String repositoryId, HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisMultiFilingService service = factory.getMultiFilingService();
-
+    public static void removeObjectFromFolder(CallContext context, CmisService service, String repositoryId,
+            HttpServletRequest request, HttpServletResponse response) throws Exception {
         // get parameters
         String removeFrom = getStringParameter(request, Constants.PARAM_REMOVE_FROM);
 
@@ -59,10 +52,14 @@ public class MultiFilingService {
         String objectId = parser.getId();
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = service.removeObjectFromFolder(context, repositoryId, objectId, removeFrom, null,
-                objectInfoHolder);
+        service.removeObjectFromFolder(repositoryId, objectId, removeFrom, null);
+
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
+        }
 
+        ObjectData object = objectInfo.getObject();
         if (object == null) {
             throw new CmisRuntimeException("Object is null!");
         }
@@ -81,7 +78,7 @@ public class MultiFilingService {
         // 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();
     }
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/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/atompub/NavigationService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java Fri Apr 23 21:43:56 2010
@@ -53,6 +53,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.ObjectList;
 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.api.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.api.server.RenditionInfo;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
@@ -60,26 +61,17 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisNavigationService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Navigation Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public final class NavigationService {
 
     /**
      * Children Collection GET.
      */
-    public static void getChildren(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getChildren(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisNavigationService service = factory.getNavigationService();
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
@@ -93,16 +85,15 @@ public final class NavigationService {
         BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectInFolderList children = service.getChildren(context, repositoryId, folderId, filter, orderBy,
+        ObjectInFolderList children = service.getChildren(repositoryId, folderId, filter, orderBy,
                 includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems,
-                skipCount, null, objectInfoHolder);
+                skipCount, null);
 
         if (children == null) {
             throw new CmisRuntimeException("Children are null!");
         }
 
-        ObjectInfo folderInfo = objectInfoHolder.getObjectInfo(folderId);
+        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
         if (folderInfo == null) {
             throw new CmisRuntimeException("Folder Object Info is missing!");
         }
@@ -186,8 +177,8 @@ public final class NavigationService {
                 if ((object == null) || (object.getObject() == null)) {
                     continue;
                 }
-                writeObjectEntry(entry, object.getObject(), objectInfoHolder, null, repositoryId, object
-                        .getPathSegment(), null, baseUrl, false);
+                writeObjectEntry(service, entry, object.getObject(), null, repositoryId, object.getPathSegment(), null,
+                        baseUrl, false);
             }
         }
 
@@ -199,10 +190,8 @@ public final class NavigationService {
     /**
      * Descendants feed GET.
      */
-    public static void getDescendants(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getDescendants(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisNavigationService service = factory.getNavigationService();
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
@@ -214,16 +203,14 @@ public final class NavigationService {
         Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        List<ObjectInFolderContainer> descendants = service.getDescendants(context, repositoryId, folderId, depth,
-                filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null,
-                objectInfoHolder);
+        List<ObjectInFolderContainer> descendants = service.getDescendants(repositoryId, folderId, depth, filter,
+                includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
         if (descendants == null) {
             throw new CmisRuntimeException("Descendants are null!");
         }
 
-        ObjectInfo folderInfo = objectInfoHolder.getObjectInfo(folderId);
+        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
         if (folderInfo == null) {
             throw new CmisRuntimeException("Folder Object Info is missing!");
         }
@@ -266,8 +253,8 @@ public final class NavigationService {
             if ((container == null) || (container.getObject() == null) || (container.getObject().getObject() == null)) {
                 continue;
             }
-            writeObjectEntry(entry, container.getObject().getObject(), objectInfoHolder, container.getChildren(),
-                    repositoryId, container.getObject().getPathSegment(), null, baseUrl, false);
+            writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
+                    container.getObject().getPathSegment(), null, baseUrl, false);
         }
 
         // we are done
@@ -278,10 +265,8 @@ public final class NavigationService {
     /**
      * Folder tree feed GET.
      */
-    public static void getFolderTree(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getFolderTree(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisNavigationService service = factory.getNavigationService();
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         BigInteger depth = getBigIntegerParameter(request, Constants.PARAM_DEPTH);
@@ -293,16 +278,14 @@ public final class NavigationService {
         Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        List<ObjectInFolderContainer> folderTree = service.getFolderTree(context, repositoryId, folderId, depth,
-                filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null,
-                objectInfoHolder);
+        List<ObjectInFolderContainer> folderTree = service.getFolderTree(repositoryId, folderId, depth, filter,
+                includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
         if (folderTree == null) {
             throw new CmisRuntimeException("Folder tree is null!");
         }
 
-        ObjectInfo folderInfo = objectInfoHolder.getObjectInfo(folderId);
+        ObjectInfo folderInfo = service.getObjectInfo(repositoryId, folderId);
         if (folderInfo == null) {
             throw new CmisRuntimeException("Folder Object Info is missing!");
         }
@@ -346,8 +329,8 @@ public final class NavigationService {
             if ((container == null) || (container.getObject() == null) || (container.getObject().getObject() == null)) {
                 continue;
             }
-            writeObjectEntry(entry, container.getObject().getObject(), objectInfoHolder, container.getChildren(),
-                    repositoryId, container.getObject().getPathSegment(), null, baseUrl, false);
+            writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
+                    container.getObject().getPathSegment(), null, baseUrl, false);
         }
 
         // we are done
@@ -358,10 +341,8 @@ public final class NavigationService {
     /**
      * Object parents feed GET.
      */
-    public static void getObjectParents(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getObjectParents(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisNavigationService service = factory.getNavigationService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
@@ -372,16 +353,14 @@ public final class NavigationService {
         Boolean includeRelativePathSegment = getBooleanParameter(request, Constants.PARAM_RELATIVE_PATH_SEGMENT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        List<ObjectParentData> parents = service.getObjectParents(context, repositoryId, objectId, filter,
-                includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null,
-                objectInfoHolder);
+        List<ObjectParentData> parents = service.getObjectParents(repositoryId, objectId, filter,
+                includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null);
 
         if (parents == null) {
             throw new CmisRuntimeException("Parents are null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(objectId);
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
         if (objectInfo == null) {
             throw new CmisRuntimeException("Object Info is missing!");
         }
@@ -413,7 +392,7 @@ public final class NavigationService {
                 if ((object == null) || (object.getObject() == null)) {
                     continue;
                 }
-                writeObjectEntry(entry, object.getObject(), objectInfoHolder, null, repositoryId, null, object
+                writeObjectEntry(service, entry, object.getObject(), null, repositoryId, null, object
                         .getRelativePathSegment(), baseUrl, false);
             }
         }
@@ -426,10 +405,8 @@ public final class NavigationService {
     /**
      * Checked Out Collection GET.
      */
-    public static void getCheckedOutDocs(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getCheckedOutDocs(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisNavigationService service = factory.getNavigationService();
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
@@ -442,10 +419,8 @@ public final class NavigationService {
         BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectList checkedOut = service.getCheckedOutDocs(context, repositoryId, folderId, filter, orderBy,
-                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null,
-                objectInfoHolder);
+        ObjectList checkedOut = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
 
         if (checkedOut == null) {
             throw new CmisRuntimeException("Checked Out list is null!");
@@ -453,7 +428,7 @@ public final class NavigationService {
 
         ObjectInfo folderInfo = null;
         if (folderId != null) {
-            folderInfo = objectInfoHolder.getObjectInfo(folderId);
+            folderInfo = service.getObjectInfo(repositoryId, folderId);
             if (folderInfo == null) {
                 throw new CmisRuntimeException("Folder Object Info is missing!");
             }
@@ -507,7 +482,7 @@ public final class NavigationService {
                 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/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/atompub/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/atompub/ObjectService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java Fri Apr 23 21:43:56 2010
@@ -48,6 +48,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.api.PropertyData;
 import org.apache.chemistry.opencmis.commons.api.PropertyString;
 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.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
@@ -57,18 +58,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisMultiFilingService;
-import org.apache.chemistry.opencmis.server.spi.CmisObjectService;
-import org.apache.chemistry.opencmis.server.spi.CmisVersioningService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Object Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public final class ObjectService {
 
@@ -77,9 +69,8 @@ public final class ObjectService {
     /**
      * Create*.
      */
-    public static void create(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void create(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         String sourceFolderId = getStringParameter(request, Constants.PARAM_SOURCE_FOLDER_ID);
@@ -90,34 +81,33 @@ public final class ObjectService {
         String objectId = parser.getId();
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = null;
+        String newObjectId = null;
 
         if (objectId == null) {
             // create
-            CmisObjectService service = factory.getObjectService();
-            object = service.create(context, repositoryId, parser.getProperties(), folderId, parser.getContentStream(),
-                    versioningState, parser.getPolicyIds(), null, objectInfoHolder);
+            newObjectId = service.create(repositoryId, parser.getProperties(), folderId, parser.getContentStream(),
+                    versioningState, parser.getPolicyIds(), null);
         } else {
             if ((sourceFolderId == null) || (sourceFolderId.trim().length() == 0)) {
                 // addObjectToFolder
-                CmisMultiFilingService service = factory.getMultiFilingService();
-                object = service.addObjectToFolder(context, repositoryId, objectId, sourceFolderId, null, null,
-                        objectInfoHolder);
+                service.addObjectToFolder(repositoryId, objectId, folderId, null, null);
+                newObjectId = objectId;
             } else {
                 // move
-                CmisObjectService service = factory.getObjectService();
-                object = service.moveObject(context, repositoryId, new Holder<String>(objectId), folderId,
-                        sourceFolderId, null, objectInfoHolder);
+                Holder<String> objectIdHolder = new Holder<String>(objectId);
+                service.moveObject(repositoryId, objectIdHolder, folderId, sourceFolderId, null);
+                newObjectId = objectIdHolder.getValue();
             }
         }
 
-        if (object == null) {
-            throw new CmisRuntimeException("Object is null!");
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
         }
 
-        if (object.getId() == null) {
-            throw new CmisRuntimeException("Object Id is null!");
+        ObjectData object = objectInfo.getObject();
+        if (object == null) {
+            throw new CmisRuntimeException("Object is null!");
         }
 
         // set headers
@@ -125,57 +115,62 @@ public final class ObjectService {
 
         response.setStatus(HttpServletResponse.SC_CREATED);
         response.setContentType(Constants.MEDIATYPE_ENTRY);
-        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, object.getId()));
+        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, newObjectId));
 
         // 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();
     }
 
     /**
      * Create relationship.
      */
-    public static void createRelationship(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void createRelationship(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisObjectService service = factory.getObjectService();
-
         // get parameters
         AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = service.create(context, repositoryId, parser.getProperties(), null, null, null, parser
-                .getPolicyIds(), null, objectInfoHolder);
+        String newObjectId = service.createRelationship(repositoryId, parser.getProperties(), parser.getPolicyIds(),
+                null, null, null);
+
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
+        }
+
+        ObjectData object = objectInfo.getObject();
+        if (object == null) {
+            throw new CmisRuntimeException("Object is null!");
+        }
 
         // set headers
         UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
 
         response.setStatus(HttpServletResponse.SC_CREATED);
         response.setContentType(Constants.MEDIATYPE_ENTRY);
-        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, object.getId()));
+        response.setHeader("Location", compileUrl(baseUrl, RESOURCE_ENTRY, newObjectId));
 
         // 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();
     }
 
     /**
      * Delete object.
      */
-    public static void deleteObject(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void deleteObject(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);
         Boolean allVersions = getBooleanParameter(request, Constants.PARAM_ALL_VERSIONS);
 
         // execute
-        service.deleteObjectOrCancelCheckOut(context, repositoryId, objectId, allVersions, null);
+        service.deleteObjectOrCancelCheckOut(repositoryId, objectId, allVersions, null);
 
         // set headers
         response.setStatus(HttpServletResponse.SC_NO_CONTENT);
@@ -184,16 +179,14 @@ public final class ObjectService {
     /**
      * Delete content stream.
      */
-    public static void deleteContentStream(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void deleteContentStream(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);
         String changeToken = getStringParameter(request, Constants.PARAM_CHANGE_TOKEN);
 
         // execute
-        service.deleteContentStream(context, repositoryId, new Holder<String>(objectId), changeToken == null ? null
+        service.deleteContentStream(repositoryId, new Holder<String>(objectId), changeToken == null ? null
                 : new Holder<String>(changeToken), null);
 
         // set headers
@@ -203,10 +196,8 @@ public final class ObjectService {
     /**
      * Set content stream.
      */
-    public static void setContentStream(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void setContentStream(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);
         String changeToken = getStringParameter(request, Constants.PARAM_CHANGE_TOKEN);
@@ -225,7 +216,7 @@ public final class ObjectService {
 
         // execute
         Holder<String> objectIdHolder = new Holder<String>(objectId);
-        service.setContentStream(context, repositoryId, objectIdHolder, overwriteFlag, changeToken == null ? null
+        service.setContentStream(repositoryId, objectIdHolder, overwriteFlag, changeToken == null ? null
                 : new Holder<String>(changeToken), contentStream, null);
 
         // set headers
@@ -240,10 +231,8 @@ public final class ObjectService {
     /**
      * Delete tree.
      */
-    public static void deleteTree(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void deleteTree(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisObjectService service = factory.getObjectService();
-
         // get parameters
         String folderId = getStringParameter(request, Constants.PARAM_ID);
         Boolean allVersions = getBooleanParameter(request, Constants.PARAM_ALL_VERSIONS);
@@ -251,7 +240,7 @@ public final class ObjectService {
         Boolean continueOnFailure = getBooleanParameter(request, Constants.PARAM_CONTINUE_ON_FAILURE);
 
         // execute
-        FailedToDeleteData ftd = service.deleteTree(context, repositoryId, folderId, allVersions, unfileObjects,
+        FailedToDeleteData ftd = service.deleteTree(repositoryId, folderId, allVersions, unfileObjects,
                 continueOnFailure, null);
 
         if ((ftd != null) && (ftd.getIds() != null) && (ftd.getIds().size() > 0)) {
@@ -278,9 +267,8 @@ public final class ObjectService {
     /**
      * getObject.
      */
-    public static void getObject(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getObject(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         ReturnVersion returnVersion = getEnumParameter(request, Constants.PARAM_RETURN_VERSION, ReturnVersion.class);
@@ -293,25 +281,22 @@ public final class ObjectService {
         Boolean includeAcl = getBooleanParameter(request, Constants.PARAM_ACL);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
         ObjectData object = null;
 
         if ((returnVersion == ReturnVersion.LATEST) || (returnVersion == ReturnVersion.LASTESTMAJOR)) {
-            CmisVersioningService service = factory.getVersioningService();
-            object = service.getObjectOfLatestVersion(context, repositoryId, objectId,
+            object = service.getObjectOfLatestVersion(repositoryId, objectId, null,
                     returnVersion == ReturnVersion.LASTESTMAJOR, filter, includeAllowableActions, includeRelationships,
-                    renditionFilter, includePolicyIds, includeAcl, null, objectInfoHolder);
+                    renditionFilter, includePolicyIds, includeAcl, null);
         } else {
-            CmisObjectService service = factory.getObjectService();
-            object = service.getObject(context, repositoryId, objectId, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePolicyIds, includeAcl, null, objectInfoHolder);
+            object = service.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships,
+                    renditionFilter, includePolicyIds, includeAcl, null);
         }
 
         if (object == null) {
             throw new CmisRuntimeException("Object is null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(object.getId());
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
         if (objectInfo == null) {
             throw new CmisRuntimeException("Object Info is missing!");
         }
@@ -325,17 +310,15 @@ public final class ObjectService {
 
         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();
     }
 
     /**
      * objectByPath URI template.
      */
-    public static void getObjectByPath(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getObjectByPath(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisObjectService service = factory.getObjectService();
-
         // get parameters
         String path = getStringParameter(request, Constants.PARAM_PATH);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
@@ -347,15 +330,14 @@ public final class ObjectService {
         Boolean includeAcl = getBooleanParameter(request, Constants.PARAM_ACL);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = service.getObjectByPath(context, repositoryId, path, filter, includeAllowableActions,
-                includeRelationships, renditionFilter, includePolicyIds, includeAcl, null, objectInfoHolder);
+        ObjectData object = service.getObjectByPath(repositoryId, path, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includePolicyIds, includeAcl, null);
 
         if (object == null) {
             throw new CmisRuntimeException("Object is null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(object.getId());
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, object.getId());
         if (objectInfo == null) {
             throw new CmisRuntimeException("Object Info is missing!");
         }
@@ -369,22 +351,20 @@ public final class ObjectService {
 
         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();
     }
 
     /**
      * Allowable Actions.
      */
-    public static void getAllowableActions(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getAllowableActions(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
-        AllowableActions allowableActions = service.getAllowableActions(context, repositoryId, objectId, null);
+        AllowableActions allowableActions = service.getAllowableActions(repositoryId, objectId, null);
 
         if (allowableActions == null) {
             throw new CmisRuntimeException("Allowable Actions is null!");
@@ -402,10 +382,8 @@ public final class ObjectService {
     /**
      * getContentStream.
      */
-    public static void getContentStream(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getContentStream(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);
         String streamId = getStringParameter(request, Constants.PARAM_STREAM_ID);
@@ -423,8 +401,7 @@ public final class ObjectService {
         }
 
         // execute
-        ContentStream content = service.getContentStream(context, repositoryId, objectId, streamId, offset, length,
-                null);
+        ContentStream content = service.getContentStream(repositoryId, objectId, streamId, offset, length, null);
 
         if ((content == null) || (content.getStream() == null)) {
             throw new CmisRuntimeException("Content stream is null!");
@@ -460,9 +437,8 @@ public final class ObjectService {
     /**
      * UpdateProperties.
      */
-    public static void updateProperties(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void updateProperties(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         Boolean checkin = getBooleanParameter(request, Constants.PARAM_CHECK_IN);
@@ -472,34 +448,31 @@ public final class ObjectService {
         AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData object = null;
+        Holder<String> objectIdHolder = new Holder<String>(objectId);
 
         if ((checkin != null) && (checkin.booleanValue())) {
-            CmisVersioningService service = factory.getVersioningService();
-            object = service.checkIn(context, repositoryId, new Holder<String>(objectId), major,
-                    parser.getProperties(), parser.getContentStream(), checkinComment, parser.getPolicyIds(), null,
-                    null, null, objectInfoHolder);
+            service.checkIn(repositoryId, objectIdHolder, major, parser.getProperties(), parser.getContentStream(),
+                    checkinComment, parser.getPolicyIds(), null, null, null);
         } else {
             String changeToken = extractChangeToken(parser.getProperties());
 
-            CmisObjectService service = factory.getObjectService();
-            object = service.updateProperties(context, repositoryId, new Holder<String>(objectId),
-                    changeToken == null ? null : new Holder<String>(changeToken), parser.getProperties(), parser
-                            .getAcl(), null, objectInfoHolder);
+            service.updateProperties(repositoryId, objectIdHolder, changeToken == null ? null : new Holder<String>(
+                    changeToken), parser.getProperties(), null);
         }
 
-        if (object == null) {
-            throw new CmisRuntimeException("Object is null!");
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectIdHolder.getValue());
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
         }
 
-        if (object.getId() == null) {
-            throw new CmisRuntimeException("Object Id is null!");
+        ObjectData object = objectInfo.getObject();
+        if (object == null) {
+            throw new CmisRuntimeException("Object is null!");
         }
 
         // set headers
         UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
-        String location = compileUrl(baseUrl, RESOURCE_ENTRY, object.getId());
+        String location = compileUrl(baseUrl, RESOURCE_ENTRY, objectIdHolder.getValue());
 
         response.setStatus(HttpServletResponse.SC_CREATED);
         response.setContentType(Constants.MEDIATYPE_ENTRY);
@@ -509,7 +482,7 @@ public final class ObjectService {
         // 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();
     }
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/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/atompub/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/atompub/PolicyService.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java Fri Apr 23 21:43:56 2010
@@ -32,45 +32,35 @@ import javax.servlet.http.HttpServletRes
 
 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.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.server.impl.ObjectInfoHolderImpl;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisPolicyService;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 /**
  * Policy Service operations.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class PolicyService {
 
     /**
      * Get applied policies.
      */
-    public static void getAppliedPolicies(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void getAppliedPolicies(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisPolicyService service = factory.getPolicyService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         String filter = getStringParameter(request, Constants.PARAM_FILTER);
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        List<ObjectData> policies = service.getAppliedPolicies(context, repositoryId, objectId, filter, null,
-                objectInfoHolder);
+        List<ObjectData> policies = service.getAppliedPolicies(repositoryId, objectId, filter, null);
 
         if (policies == null) {
             throw new CmisRuntimeException("Policies are null!");
         }
 
-        ObjectInfo objectInfo = objectInfoHolder.getObjectInfo(objectId);
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
         if (objectInfo == null) {
             throw new CmisRuntimeException("Object Info is missing!");
         }
@@ -102,7 +92,7 @@ public class PolicyService {
                 if (policy == null) {
                     continue;
                 }
-                writePolicyEntry(entry, objectInfo.getId(), policy, objectInfoHolder, baseUrl);
+                writePolicyEntry(service, entry, objectInfo.getId(), policy, repositoryId, baseUrl);
             }
         }
 
@@ -114,20 +104,22 @@ public class PolicyService {
     /**
      * Apply policy.
      */
-    public static void applyPolicy(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void applyPolicy(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisPolicyService service = factory.getPolicyService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
 
         AtomEntryParser parser = new AtomEntryParser(request.getInputStream());
 
         // execute
-        ObjectInfoHolder objectInfoHolder = new ObjectInfoHolderImpl();
-        ObjectData policy = service
-                .applyPolicy(context, repositoryId, parser.getId(), objectId, null, objectInfoHolder);
+        service.applyPolicy(repositoryId, parser.getId(), objectId, null);
 
+        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, parser.getId());
+        if (objectInfo == null) {
+            throw new CmisRuntimeException("Object Info is missing!");
+        }
+
+        ObjectData policy = objectInfo.getObject();
         if (policy == null) {
             throw new CmisRuntimeException("Policy is null!");
         }
@@ -145,23 +137,21 @@ public class PolicyService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream());
-        writePolicyEntry(entry, objectId, policy, objectInfoHolder, baseUrl);
+        writePolicyEntry(service, entry, objectId, policy, repositoryId, baseUrl);
         entry.endDocument();
     }
 
     /**
      * Remove policy.
      */
-    public static void removePolicy(CallContext context, AbstractServicesFactory factory, String repositoryId,
+    public static void removePolicy(CallContext context, CmisService service, String repositoryId,
             HttpServletRequest request, HttpServletResponse response) throws Exception {
-        CmisPolicyService service = factory.getPolicyService();
-
         // get parameters
         String objectId = getStringParameter(request, Constants.PARAM_ID);
         String policyId = getStringParameter(request, Constants.PARAM_POLICY_ID);
 
         // execute
-        service.removePolicy(context, repositoryId, policyId, objectId, null);
+        service.removePolicy(repositoryId, policyId, objectId, null);
 
         // set headers
         response.setStatus(HttpServletResponse.SC_NO_CONTENT);
@@ -170,14 +160,14 @@ public class PolicyService {
     /**
      * Writes an entry that is attached to an object.
      */
-    private static void writePolicyEntry(AtomEntry entry, String objectId, ObjectData policy,
-            ObjectInfoHolder infoHolder, UrlBuilder baseUrl) throws Exception {
+    private static void writePolicyEntry(CmisService service, AtomEntry entry, String objectId, ObjectData policy,
+            String repositoryId, UrlBuilder baseUrl) throws Exception {
         CmisObjectType resultJaxb = convert(policy);
         if (resultJaxb == null) {
             return;
         }
 
-        ObjectInfo info = infoHolder.getObjectInfo(policy.getId());
+        ObjectInfo info = service.getObjectInfo(repositoryId, policy.getId());
         if (info == null) {
             throw new CmisRuntimeException("Object Info not found!");
         }



Mime
View raw message