chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r937530 [3/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/webservices/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/webservices/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/webservices/RepositoryService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
Fri Apr 23 21:43:56 2010
@@ -30,7 +30,7 @@ import javax.jws.WebService;
 import javax.xml.ws.WebServiceContext;
 
 import org.apache.chemistry.opencmis.commons.api.RepositoryInfo;
-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.CmisRepositoryEntryType;
@@ -39,8 +39,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionListType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.RepositoryServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisRepositoryService;
 
 /**
  * CMIS Repository Service.
@@ -51,12 +49,11 @@ public class RepositoryService extends A
     WebServiceContext wsContext;
 
     public List<CmisRepositoryEntryType> getRepositories(CmisExtensionType extension)
throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRepositoryService service = factory.getRepositoryService();
-            CallContext context = createContext(wsContext, null);
+            service = getService(wsContext, null);
 
-            List<RepositoryInfo> infoDataList = service.getRepositoryInfos(context,
convert(extension));
+            List<RepositoryInfo> infoDataList = service.getRepositoryInfos(convert(extension));
 
             if (infoDataList == null) {
                 return null;
@@ -74,31 +71,33 @@ public class RepositoryService extends A
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisRepositoryInfoType getRepositoryInfo(String repositoryId, CmisExtensionType
extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRepositoryService service = factory.getRepositoryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getRepositoryInfo(context, repositoryId, convert(extension)));
+            return convert(service.getRepositoryInfo(repositoryId, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisTypeDefinitionListType getTypeChildren(String repositoryId, String typeId,
             Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount,
CmisExtensionType extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRepositoryService service = factory.getRepositoryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getTypeChildren(context, repositoryId, typeId, includePropertyDefinitions,
maxItems,
+            return convert(service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
maxItems,
                     skipCount, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
@@ -107,32 +106,33 @@ public class RepositoryService extends A
 
     public CmisTypeDefinitionType getTypeDefinition(String repositoryId, String typeId, CmisExtensionType
extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRepositoryService service = factory.getRepositoryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getTypeDefinition(context, repositoryId, typeId, convert(extension)));
+            return convert(service.getTypeDefinition(repositoryId, typeId, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisTypeContainer> getTypeDescendants(String repositoryId, String typeId,
BigInteger depth,
             Boolean includePropertyDefinitions, CmisExtensionType extension) throws CmisException
{
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisRepositoryService service = factory.getRepositoryService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             List<CmisTypeContainer> result = new ArrayList<CmisTypeContainer>();
-            convertTypeContainerList(service.getTypeDescendants(context, repositoryId, typeId,
depth,
+            convertTypeContainerList(service.getTypeDescendants(repositoryId, typeId, depth,
                     includePropertyDefinitions, convert(extension)), result);
 
             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/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/webservices/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/webservices/VersioningService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
Fri Apr 23 21:43:56 2010
@@ -34,7 +34,7 @@ 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.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisContentStreamType;
@@ -44,8 +44,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisPropertiesType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.VersioningServicePort;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
-import org.apache.chemistry.opencmis.server.spi.CmisVersioningService;
 
 /**
  * CMIS Versioning Service.
@@ -57,18 +55,19 @@ public class VersioningService extends A
 
     public void cancelCheckOut(String repositoryId, String objectId, Holder<CmisExtensionType>
extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.cancelCheckOut(context, repositoryId, objectId, extData);
+            service.cancelCheckOut(repositoryId, objectId, extData);
 
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
@@ -76,36 +75,36 @@ public class VersioningService extends A
             CmisContentStreamType contentStream, String checkinComment, List<String>
policies,
             CmisAccessControlListType addAces, CmisAccessControlListType removeAces, Holder<CmisExtensionType>
extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            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.checkIn(context, repositoryId, objectIdHolder, major, convert(properties),
convert(contentStream),
-                    checkinComment, policies, convert(addAces, null), convert(removeAces,
null), extData, null);
+            service.checkIn(repositoryId, objectIdHolder, major, convert(properties), convert(contentStream),
+                    checkinComment, policies, convert(addAces, null), convert(removeAces,
null), extData);
 
             setHolderValue(objectIdHolder, objectId);
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public void checkOut(String repositoryId, Holder<String> objectId, Holder<CmisExtensionType>
extension,
             Holder<Boolean> contentCopied) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            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<Boolean> contentCopiedHolder
= new org.apache.chemistry.opencmis.commons.api.Holder<Boolean>();
             ExtensionsData extData = convertExtensionHolder(extension);
 
-            service.checkOut(context, repositoryId, objectIdHolder, extData, contentCopiedHolder,
null);
+            service.checkOut(repositoryId, objectIdHolder, extData, contentCopiedHolder);
 
             if (contentCopied != null) {
                 contentCopied.value = contentCopiedHolder.getValue();
@@ -115,18 +114,19 @@ public class VersioningService extends A
             setExtensionValues(extData, extension);
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public List<CmisObjectType> getAllVersions(String repositoryId, String versionSeriesId,
String filter,
             Boolean includeAllowableActions, CmisExtensionType extension) throws CmisException
{
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            List<ObjectData> versions = service.getAllVersions(context, repositoryId,
versionSeriesId, filter,
-                    includeAllowableActions, convert(extension), null);
+            List<ObjectData> versions = service.getAllVersions(repositoryId, null,
versionSeriesId, filter,
+                    includeAllowableActions, convert(extension));
 
             if (versions == null) {
                 return null;
@@ -140,6 +140,8 @@ public class VersioningService extends A
             return result;
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
@@ -147,31 +149,32 @@ public class VersioningService extends A
             String filter, Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships,
             String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, CmisExtensionType
extension)
             throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getObjectOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
+            return convert(service.getObjectOfLatestVersion(repositoryId, null, versionSeriesId,
major, filter,
                     includeAllowableActions, convert(IncludeRelationships.class, includeRelationships),
-                    renditionFilter, includePolicyIds, includeAcl, convert(extension), null));
+                    renditionFilter, includePolicyIds, includeAcl, convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
 
     public CmisPropertiesType getPropertiesOfLatestVersion(String repositoryId, String versionSeriesId,
Boolean major,
             String filter, CmisExtensionType extension) throws CmisException {
+        CmisService service = null;
         try {
-            AbstractServicesFactory factory = getServicesFactory(wsContext);
-            CmisVersioningService service = factory.getVersioningService();
-            CallContext context = createContext(wsContext, repositoryId);
+            service = getService(wsContext, repositoryId);
 
-            return convert(service.getPropertiesOfLatestVersion(context, repositoryId, versionSeriesId,
major, filter,
+            return convert(service.getPropertiesOfLatestVersion(repositoryId, null, versionSeriesId,
major, filter,
                     convert(extension)));
         } catch (Exception e) {
             throw convertException(e);
+        } finally {
+            closeService(service);
         }
     }
-
-}
+}
\ No newline at end of file

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
Fri Apr 23 21:43:56 2010
@@ -69,6 +69,7 @@ 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.ObjectInfoHandler;
 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.Action;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
@@ -122,16 +123,12 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisProperty;
 import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
-import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
  * File system back-end for CMIS server.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class FileShareRepository {
 
@@ -351,7 +348,7 @@ public class FileShareRepository {
      * Create* dispatch for AtomPub.
      */
     public ObjectData create(CallContext context, Properties properties, String folderId,
ContentStream contentStream,
-            VersioningState versioningState, ObjectInfoHolder objectInfos) {
+            VersioningState versioningState, ObjectInfoHandler objectInfos) {
         debug("create");
         boolean userReadOnly = checkUser(context, true);
 
@@ -370,7 +367,7 @@ public class FileShareRepository {
             throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId
+ "'!");
         }
 
-        return compileObjectType(getFile(objectId), null, false, false, userReadOnly, objectInfos);
+        return compileObjectType(context, getFile(objectId), null, false, false, userReadOnly,
objectInfos);
     }
 
     /**
@@ -635,7 +632,7 @@ public class FileShareRepository {
      * CMIS moveObject.
      */
     public ObjectData moveObject(CallContext context, Holder<String> objectId, String
targetFolderId,
-            ObjectInfoHolder objectInfos) {
+            ObjectInfoHandler objectInfos) {
         debug("moveObject");
         boolean userReadOnly = checkUser(context, true);
 
@@ -670,7 +667,7 @@ public class FileShareRepository {
             }
         }
 
-        return compileObjectType(newFile, null, false, false, userReadOnly, objectInfos);
+        return compileObjectType(context, newFile, null, false, false, userReadOnly, objectInfos);
     }
 
     /**
@@ -779,7 +776,7 @@ public class FileShareRepository {
      * CMIS updateProperties.
      */
     public ObjectData updateProperties(CallContext context, Holder<String> objectId,
Properties properties,
-            ObjectInfoHolder objectInfos) {
+            ObjectInfoHandler objectInfos) {
         debug("updateProperties");
         boolean userReadOnly = checkUser(context, true);
 
@@ -849,14 +846,14 @@ public class FileShareRepository {
             }
         }
 
-        return compileObjectType(newFile, null, false, false, userReadOnly, objectInfos);
+        return compileObjectType(context, newFile, null, false, false, userReadOnly, objectInfos);
     }
 
     /**
      * CMIS getObject.
      */
     public ObjectData getObject(CallContext context, String objectId, String filter, Boolean
includeAllowableActions,
-            Boolean includeAcl, ObjectInfoHolder objectInfos) {
+            Boolean includeAcl, ObjectInfoHandler objectInfos) {
         debug("getObject");
         boolean userReadOnly = checkUser(context, false);
 
@@ -876,7 +873,7 @@ public class FileShareRepository {
         Set<String> filterCollection = splitFilter(filter);
 
         // gather properties
-        return compileObjectType(file, filterCollection, iaa, iacl, userReadOnly, objectInfos);
+        return compileObjectType(context, file, filterCollection, iaa, iacl, userReadOnly,
objectInfos);
     }
 
     /**
@@ -949,7 +946,7 @@ public class FileShareRepository {
      */
     public ObjectInFolderList getChildren(CallContext context, String folderId, String filter,
             Boolean includeAllowableActions, Boolean includePathSegment, BigInteger maxItems,
BigInteger skipCount,
-            ObjectInfoHolder objectInfos) {
+            ObjectInfoHandler objectInfos) {
         debug("getChildren");
         boolean userReadOnly = checkUser(context, false);
 
@@ -978,8 +975,8 @@ public class FileShareRepository {
         }
 
         // set object info of the the folder
-        if (objectInfos != null) {
-            compileObjectType(folder, null, false, false, userReadOnly, objectInfos);
+        if (context.isObjectInfoRequired()) {
+            compileObjectType(context, folder, null, false, false, userReadOnly, objectInfos);
         }
 
         // prepare result
@@ -1009,7 +1006,8 @@ public class FileShareRepository {
 
             // build and add child object
             ObjectInFolderDataImpl objectInFolder = new ObjectInFolderDataImpl();
-            objectInFolder.setObject(compileObjectType(child, filterCollection, iaa, false,
userReadOnly, objectInfos));
+            objectInFolder.setObject(compileObjectType(context, child, filterCollection,
iaa, false, userReadOnly,
+                    objectInfos));
             if (ips) {
                 objectInFolder.setPathSegment(child.getName());
             }
@@ -1026,7 +1024,7 @@ public class FileShareRepository {
      * CMIS getDescendants.
      */
     public List<ObjectInFolderContainer> getDescendants(CallContext context, String
folderId, BigInteger depth,
-            String filter, Boolean includeAllowableActions, Boolean includePathSegment, ObjectInfoHolder
objectInfos,
+            String filter, Boolean includeAllowableActions, Boolean includePathSegment, ObjectInfoHandler
objectInfos,
             boolean foldersOnly) {
         debug("getDescendants or getFolderTree");
         boolean userReadOnly = checkUser(context, false);
@@ -1054,13 +1052,14 @@ public class FileShareRepository {
         }
 
         // set object info of the the folder
-        if (objectInfos != null) {
-            compileObjectType(folder, null, false, false, userReadOnly, objectInfos);
+        if (context.isObjectInfoRequired()) {
+            compileObjectType(context, folder, null, false, false, userReadOnly, objectInfos);
         }
 
         // get the tree
         List<ObjectInFolderContainer> result = new ArrayList<ObjectInFolderContainer>();
-        gatherDescendants(folder, result, foldersOnly, d, filterCollection, iaa, ips, userReadOnly,
objectInfos);
+        gatherDescendants(context, folder, result, foldersOnly, d, filterCollection, iaa,
ips, userReadOnly,
+                objectInfos);
 
         return result;
     }
@@ -1068,7 +1067,7 @@ public class FileShareRepository {
     /**
      * CMIS getFolderParent.
      */
-    public ObjectData getFolderParent(CallContext context, String folderId, String filter,
ObjectInfoHolder objectInfos) {
+    public ObjectData getFolderParent(CallContext context, String folderId, String filter,
ObjectInfoHandler objectInfos) {
         List<ObjectParentData> parents = getObjectParents(context, folderId, filter,
false, false, objectInfos);
 
         if (parents.size() == 0) {
@@ -1082,7 +1081,7 @@ public class FileShareRepository {
      * CMIS getObjectParents.
      */
     public List<ObjectParentData> getObjectParents(CallContext context, String objectId,
String filter,
-            Boolean includeAllowableActions, Boolean includeRelativePathSegment, ObjectInfoHolder
objectInfos) {
+            Boolean includeAllowableActions, Boolean includeRelativePathSegment, ObjectInfoHandler
objectInfos) {
         debug("getObjectParents");
         boolean userReadOnly = checkUser(context, false);
 
@@ -1102,13 +1101,13 @@ public class FileShareRepository {
         }
 
         // set object info of the the object
-        if (objectInfos != null) {
-            compileObjectType(file, null, false, false, userReadOnly, objectInfos);
+        if (context.isObjectInfoRequired()) {
+            compileObjectType(context, file, null, false, false, userReadOnly, objectInfos);
         }
 
         // get parent folder
         File parent = file.getParentFile();
-        ObjectData object = compileObjectType(parent, filterCollection, iaa, false, userReadOnly,
objectInfos);
+        ObjectData object = compileObjectType(context, parent, filterCollection, iaa, false,
userReadOnly, objectInfos);
 
         ObjectParentDataImpl result = new ObjectParentDataImpl();
         result.setObject(object);
@@ -1123,7 +1122,7 @@ public class FileShareRepository {
      * CMIS getObjectByPath.
      */
     public ObjectData getObjectByPath(CallContext context, String folderPath, String filter,
-            boolean includeAllowableActions, boolean includeACL, ObjectInfoHolder objectInfos)
{
+            boolean includeAllowableActions, boolean includeACL, ObjectInfoHandler objectInfos)
{
         debug("getObjectByPath");
         boolean userReadOnly = checkUser(context, false);
 
@@ -1148,7 +1147,8 @@ public class FileShareRepository {
             throw new CmisObjectNotFoundException("Path doesn't exist.");
         }
 
-        return compileObjectType(file, filterCollection, includeAllowableActions, includeACL,
userReadOnly, objectInfos);
+        return compileObjectType(context, file, filterCollection, includeAllowableActions,
includeACL, userReadOnly,
+                objectInfos);
     }
 
     // --- helper methods ---
@@ -1156,9 +1156,9 @@ public class FileShareRepository {
     /**
      * Gather the children of a folder.
      */
-    private void gatherDescendants(File folder, List<ObjectInFolderContainer> list,
boolean foldersOnly, int depth,
-            Set<String> filter, boolean includeAllowableActions, boolean includePathSegments,
boolean userReadOnly,
-            ObjectInfoHolder objectInfos) {
+    private void gatherDescendants(CallContext context, File folder, List<ObjectInFolderContainer>
list,
+            boolean foldersOnly, int depth, Set<String> filter, boolean includeAllowableActions,
+            boolean includePathSegments, boolean userReadOnly, ObjectInfoHandler objectInfos)
{
         // iterate through children
         for (File child : folder.listFiles()) {
             // skip hidden and shadow files
@@ -1173,8 +1173,8 @@ public class FileShareRepository {
 
             // add to list
             ObjectInFolderDataImpl objectInFolder = new ObjectInFolderDataImpl();
-            objectInFolder.setObject(compileObjectType(child, filter, includeAllowableActions,
false, userReadOnly,
-                    objectInfos));
+            objectInFolder.setObject(compileObjectType(context, child, filter, includeAllowableActions,
false,
+                    userReadOnly, objectInfos));
             if (includePathSegments) {
                 objectInFolder.setPathSegment(child.getName());
             }
@@ -1187,7 +1187,7 @@ public class FileShareRepository {
             // move to next level
             if ((depth != 1) && child.isDirectory()) {
                 container.setChildren(new ArrayList<ObjectInFolderContainer>());
-                gatherDescendants(child, container.getChildren(), foldersOnly, depth - 1,
filter,
+                gatherDescendants(context, child, container.getChildren(), foldersOnly, depth
- 1, filter,
                         includeAllowableActions, includePathSegments, userReadOnly, objectInfos);
             }
         }
@@ -1276,11 +1276,12 @@ public class FileShareRepository {
     /**
      * Compiles an object type object from a file or folder.�
      */
-    private ObjectData compileObjectType(File file, Set<String> filter, boolean includeAllowableActions,
-            boolean includeAcl, boolean userReadOnly, ObjectInfoHolder objectInfos) {
+    private ObjectData compileObjectType(CallContext context, File file, Set<String>
filter,
+            boolean includeAllowableActions, boolean includeAcl, boolean userReadOnly, ObjectInfoHandler
objectInfos) {
         ObjectDataImpl result = new ObjectDataImpl();
+        ObjectInfoImpl objectInfo = new ObjectInfoImpl();
 
-        result.setProperties(compileProperties(file, filter, objectInfos));
+        result.setProperties(compileProperties(file, filter, objectInfo));
 
         if (includeAllowableActions) {
             result.setAllowableActions(compileAllowableActions(file, userReadOnly));
@@ -1291,13 +1292,18 @@ public class FileShareRepository {
             result.setIsExactAcl(true);
         }
 
+        if (context.isObjectInfoRequired()) {
+            objectInfo.setObject(result);
+            objectInfos.addObjectInfo(objectInfo);
+        }
+
         return result;
     }
 
     /**
      * Gathers all base properties of a file or folder.
      */
-    private Properties compileProperties(File file, Set<String> orgfilter, ObjectInfoHolder
objectInfos) {
+    private Properties compileProperties(File file, Set<String> orgfilter, ObjectInfoImpl
objectInfo) {
         if (file == null) {
             throw new IllegalArgumentException("File must not be null!");
         }
@@ -1312,16 +1318,44 @@ public class FileShareRepository {
 
         // find base type
         String typeId = null;
-        ObjectInfoImpl objectInfo = null;
 
         if (file.isDirectory()) {
             typeId = TypeManager.FOLDER_TYPE_ID;
-            objectInfo = new FolderInfo();
+            objectInfo.setBaseType(BaseTypeId.CMIS_FOLDER);
             objectInfo.setTypeId(typeId);
+            objectInfo.setContentType(null);
+            objectInfo.setFileName(null);
+            objectInfo.setHasAcl(true);
+            objectInfo.setHasContent(false);
+            objectInfo.setVersionSeriesId(null);
+            objectInfo.setIsCurrentVersion(true);
+            objectInfo.setRelationshipSourceIds(null);
+            objectInfo.setRelationshipTargetIds(null);
+            objectInfo.setRenditionInfos(null);
+            objectInfo.setSupportsDescendants(true);
+            objectInfo.setSupportsFolderTree(true);
+            objectInfo.setSupportsPolicies(false);
+            objectInfo.setSupportsRelationships(false);
+            objectInfo.setWorkingCopyId(null);
+            objectInfo.setWorkingCopyOriginalId(null);
         } else {
             typeId = TypeManager.DOCUMENT_TYPE_ID;
-            objectInfo = new DocumentInfo();
+            objectInfo.setBaseType(BaseTypeId.CMIS_DOCUMENT);
             objectInfo.setTypeId(typeId);
+            objectInfo.setHasAcl(true);
+            objectInfo.setHasContent(true);
+            objectInfo.setHasParent(true);
+            objectInfo.setVersionSeriesId(null);
+            objectInfo.setIsCurrentVersion(true);
+            objectInfo.setRelationshipSourceIds(null);
+            objectInfo.setRelationshipTargetIds(null);
+            objectInfo.setRenditionInfos(null);
+            objectInfo.setSupportsDescendants(false);
+            objectInfo.setSupportsFolderTree(false);
+            objectInfo.setSupportsPolicies(false);
+            objectInfo.setSupportsRelationships(false);
+            objectInfo.setWorkingCopyId(null);
+            objectInfo.setWorkingCopyOriginalId(null);
         }
 
         // let's do it
@@ -1397,10 +1431,6 @@ public class FileShareRepository {
                 }
             }
 
-            if (objectInfos != null) {
-                objectInfos.addObjectInfo(objectInfo);
-            }
-
             return result;
         } catch (Exception e) {
             if (e instanceof CmisBaseException) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
Fri Apr 23 21:43:56 2010
@@ -17,7 +17,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
-import org.apache.chemistry.opencmis.server.spi.AbstractServicesFactory;
 import org.apache.chemistry.opencmis.server.support.CmisServiceWrapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -35,7 +34,7 @@ public class FileShareServiceFactory ext
     private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(200);
     private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(10);
 
-    private static final Log log = LogFactory.getLog(AbstractServicesFactory.class);
+    private static final Log log = LogFactory.getLog(FileShareServiceFactory.class);
 
     private RepositoryMap repositoryMap;
     private TypeManager typeManager;
@@ -60,7 +59,7 @@ public class FileShareServiceFactory ext
 
     @Override
     public CmisService getService(CallContext context) {
-        repositoryMap.getAuthenticatedRepository(context, context.getRepositoryId());
+        repositoryMap.authenticate(context);
 
         CmisServiceWrapper<FileShareService> wrapperService = threadLocalService.get();
         if (wrapperService == null) {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/RepositoryMap.java
Fri Apr 23 21:43:56 2010
@@ -67,16 +67,13 @@ public class RepositoryMap {
     }
 
     /**
-     * Gets a repository object by id.
+     * Takes user and password from the CallContext and checks them.
      */
-    public FileShareRepository getAuthenticatedRepository(CallContext context, String repositoryId)
{
+    public void authenticate(CallContext context) {
         // check user and password first
         if (!authenticate(context.getUsername(), context.getPassword())) {
             throw new CmisPermissionDeniedException();
         }
-
-        // get repository object
-        return repositoryId == null ? null : getRepository(repositoryId);
     }
 
     /**

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/webapp/WEB-INF/classes/repository.properties
Fri Apr 23 21:43:56 2010
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-class=org.apache.chemistry.opencmis.fileshare.ServicesFactory
+class=org.apache.chemistry.opencmis.fileshare.FileShareServiceFactory
 
 login.1 = test:test
 login.2 = cmisuser:password

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
Fri Apr 23 21:43:56 2010
@@ -37,7 +37,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
 import org.apache.chemistry.opencmis.server.spi.CmisDiscoveryService;
-import org.apache.chemistry.opencmis.server.spi.CmisRepositoryService;
 import org.apache.chemistry.opencmis.server.spi.ObjectInfoHolder;
 
 public class InMemoryDiscoveryServiceImpl implements CmisDiscoveryService {

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
Fri Apr 23 21:43:56 2010
@@ -180,6 +180,8 @@ public class InMemoryNavigationServiceIm
                     + folderId);
 
         ObjectData res = getFolderParentIntern(repositoryId, folder, filter, objectInfos);
+        if (res == null)
+            throw new CmisInvalidArgumentException("Cannot get parent of a root folder");
 
         // To be able to provide all Atom links in the response we need
         // additional information:
@@ -230,8 +232,7 @@ public class InMemoryNavigationServiceIm
         if (so instanceof Filing)
             spo = (Filing) so;
         else
-            throw new CmisInvalidArgumentException(
-                    "Can't get object parent, id does not refer to a folder or document:
" + objectId);
+            return Collections.emptyList();
 
         result = getObjectParentsIntern(repositoryId, spo, filter, objectInfos);
 
@@ -386,10 +387,7 @@ public class InMemoryNavigationServiceIm
         Folder parentFolder = sop.getParent();
 
         if (null == parentFolder) {
-            if (sop instanceof Children) // a folder without a parent
-                throw new CmisInvalidArgumentException("Cannot get parent of a root folder");
-            else
-                return null; // an unfiled document
+            return null;
         }
 
         copyFilteredProperties(repositoryId, parentFolder, filter, parent);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
Fri Apr 23 21:43:56 2010
@@ -60,11 +60,6 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
 import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
-import org.apache.chemistry.opencmis.server.support.DiscoveryServiceWrapper;
-import org.apache.chemistry.opencmis.server.support.NavigationServiceWrapper;
-import org.apache.chemistry.opencmis.server.support.ObjectServiceWrapper;
-import org.apache.chemistry.opencmis.server.support.RepositoryServiceWrapper;
-import org.apache.chemistry.opencmis.server.support.VersioningServiceWrapper;
 import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -367,8 +362,8 @@ public class InMemoryService extends Abs
     public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
             Boolean includeAllowableActions, IncludeRelationships includeRelationships, String
renditionFilter,
             BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        return super.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
includeRelationships,
-                renditionFilter, maxItems, skipCount, extension);
+        return fDisSvc.query(getCallContext(), repositoryId, statement, searchAllVersions,
includeAllowableActions,
+                includeRelationships, renditionFilter, maxItems, skipCount, extension);
     }
 
     // --- multi filing service ---

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
Fri Apr 23 21:43:56 2010
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-class=org.apache.chemistry.opencmis.inmemory.server.ServiceFactory
+class=org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceFactoryImpl
 
 repository.id=dummy-rep
 repository.name=Dummy Repository

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/main/webapp/WEB-INF/classes/repository.properties
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/main/webapp/WEB-INF/classes/repository.properties?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/main/webapp/WEB-INF/classes/repository.properties
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/main/webapp/WEB-INF/classes/repository.properties
Fri Apr 23 21:43:56 2010
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-class=org.apache.chemistry.opencmis.inmemory.server.ServiceFactory
+class=org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceFactoryImpl
 
 # In Memory Settings
 InMemoryServer.RepositoryId=test

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectVersionIT.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectVersionIT.java?rev=937530&r1=937529&r2=937530&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectVersionIT.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/WriteObjectVersionIT.java
Fri Apr 23 21:43:56 2010
@@ -39,7 +39,7 @@ public class WriteObjectVersionIT extend
         DocumentType dt = (DocumentType) document.getType();
         assertNotNull(dt);
         ObjectId id = null;
-        if (dt.isVersionable()) {
+        if (dt.isVersionable() != null && dt.isVersionable().booleanValue()) {
             id = document.checkOut();
         }
 



Mime
View raw message