chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dcaru...@apache.org
Subject svn commit: r936938 [16/29] - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/ chemistry-opencmis-server-bindings/src/main/java/org/apache/chem...
Date Thu, 22 Apr 2010 16:28:00 GMT
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=936938&r1=936937&r2=936938&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 Thu Apr 22 16:27:57 2010
@@ -69,463 +69,489 @@ import org.apache.chemistry.opencmis.uti
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class InMemoryService  extends AbstractCmisService {
+public class InMemoryService extends AbstractCmisService {
 
-	private static final Log LOG = LogFactory.getLog(InMemoryService.class.getName());
+    private static final Log LOG = LogFactory.getLog(InMemoryService.class.getName());
 
-	private StoreManager storeManager; // singleton root of everything
-	private CallContext context;
+    private StoreManager storeManager; // singleton root of everything
+    private CallContext context;
 
-	private InMemoryRepositoryServiceImpl fRepSvc;
-	private InMemoryObjectServiceImpl fObjSvc;
-	private InMemoryNavigationServiceImpl fNavSvc;
-	private InMemoryVersioningServiceImpl fVerSvc;
-	private InMemoryDiscoveryServiceImpl fDisSvc;
-	private InMemoryMultiFilingServiceImpl fMultiSvc;
-
-	public StoreManager getStoreManager() {
-		return storeManager;
-	}
-
-	public InMemoryService(Map<String, String> parameters) {
-
-		// initialize in-memory management
-		String repositoryClassName = (String) parameters.get(ConfigConstants.REPOSITORY_CLASS);
-		if (null == repositoryClassName)
-			repositoryClassName = StoreManagerImpl.class.getName();
-
-		if (null == storeManager)
-			storeManager = StoreManagerFactory.createInstance(repositoryClassName);
-
-		String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
-
-		List<String> allAvailableRepositories = storeManager.getAllRepositoryIds();
-
-		// init existing repositories
-		for (String existingRepId : allAvailableRepositories)
-			storeManager.initRepository(existingRepId);
-
-		// create repository if configured as a startup parameter
-		if (null != repositoryId) {
-			if (allAvailableRepositories.contains(repositoryId))
-				LOG.warn("Repostory " + repositoryId + " already exists and will not be created.");
-			else {
-				String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
-				storeManager.createAndInitRepository(repositoryId, typeCreatorClassName);
-			}
-		}
-
-		// With some special configuration settings fill the repository with
-		// some documents and folders
-		// if is empty
-		if (!allAvailableRepositories.contains(repositoryId))
-			fillRepositoryIfConfigured(parameters, repositoryId);
-
-		
-		fRepSvc = new InMemoryRepositoryServiceImpl(storeManager);
-		fNavSvc = new InMemoryNavigationServiceImpl(storeManager);
-		fObjSvc = new InMemoryObjectServiceImpl(storeManager);
-		fVerSvc = new InMemoryVersioningServiceImpl(storeManager, fObjSvc);
-		fDisSvc = new InMemoryDiscoveryServiceImpl(storeManager, fRepSvc, fNavSvc);
-	    fMultiSvc = new InMemoryMultiFilingServiceImpl(storeManager);
-
-	}
-	
-	public CallContext getCallContext() {
-		return context;
-	}
-
-	public void setCallContext(CallContext context) {
-		this.context = context;
-	}
-
-	// --- repository service ---
-
-	@Override
-	public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
-		return fRepSvc.getRepositoryInfos(getCallContext(), extension);
-	}
-
-	public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
-		return fRepSvc.getRepositoryInfo(getCallContext(), repositoryId, extension);
-	}
-
-	public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		return fRepSvc.getTypeChildren(getCallContext(), repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
-	}
-
-	public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
-		return fRepSvc.getTypeDefinition(getCallContext(), repositoryId, typeId, extension);
-	}
-
-	public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
-			Boolean includePropertyDefinitions, ExtensionsData extension) {
-		return fRepSvc.getTypeDescendants(getCallContext(), repositoryId, typeId, depth, includePropertyDefinitions, extension);
-	}
-
-	// --- navigation service ---
-
-	public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		return fNavSvc.getCheckedOutDocs(getCallContext(), repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension, null);
-	}
-
-	public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		return fNavSvc.getChildren(getCallContext(), repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension, null);
-	}
-
-	public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
-			String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
-		return fNavSvc.getDescendants(getCallContext(), repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension, null);
-	}
-
-	public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
-		return fNavSvc.getFolderParent(getCallContext(), repositoryId, folderId, filter, extension, null);
-	}
-
-	public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
-			String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
-		return fNavSvc.getFolderTree(getCallContext(), repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension, null);
-	}
-
-	public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
-			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includeRelativePathSegment, ExtensionsData extension) {
-		return fNavSvc.getObjectParents(getCallContext(), repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension, null);
-	}
-
-	// --- object service ---
-
-	public String create(String repositoryId, Properties properties, String folderId, ContentStream contentStream,
-			VersioningState versioningState, List<String> policies, ExtensionsData extension) {
-		ObjectData od = fObjSvc.create(getCallContext(), repositoryId, properties, folderId, contentStream, versioningState, policies, extension, null);
-		return od.getId();
-
-	}
-
-	public String createDocument(String repositoryId, Properties properties, String folderId,
-			ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
-			Acl removeAces, ExtensionsData extension) {
-		return fObjSvc.createDocument(getCallContext(), repositoryId, properties, folderId, contentStream, versioningState, policies, addAces, removeAces, extension);
-	}
-
-	public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
-			String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
-			ExtensionsData extension) {
-		return fObjSvc.createDocumentFromSource(getCallContext(), repositoryId, sourceId, properties, folderId, versioningState, policies, addAces, removeAces, extension);
-	}
-
-	public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
-			Acl addAces, Acl removeAces, ExtensionsData extension) {
-		return fObjSvc.createFolder(getCallContext(), repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-	}
-
-	public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
-			Acl addAces, Acl removeAces, ExtensionsData extension) {
-		return fObjSvc.createPolicy(getCallContext(), repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-	}
-
-	public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
-			Acl removeAces, ExtensionsData extension) {
-		return fObjSvc.createRelationship(getCallContext(), repositoryId, properties, policies, addAces, removeAces, extension);
-	}
-
-	public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
-			ExtensionsData extension) {
-		fObjSvc.deleteContentStream(getCallContext(), repositoryId, objectId, changeToken, extension);
-	}
-
-	public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
-		fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
-	}
-
-	public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
-			ExtensionsData extension) {
-		fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
-	}
-
-	public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
-			UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
-		return fObjSvc.deleteTree(getCallContext(), repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
-	}
-
-	public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
-		return fObjSvc.getAllowableActions(getCallContext(), repositoryId, objectId, extension);
-	}
-
-	public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
-			BigInteger length, ExtensionsData extension) {
-		return fObjSvc.getContentStream(getCallContext(), repositoryId, objectId, streamId, offset, length, extension);
-	}
-
-	public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
-			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
-			Boolean includeAcl, ExtensionsData extension) {
-		return fObjSvc.getObject(getCallContext(), repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
-	}
-
-	public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
-			IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
-			Boolean includeAcl, ExtensionsData extension) {
-		return fObjSvc.getObjectByPath(getCallContext(), repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
-	}
-
-	public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
-		return fObjSvc.getProperties(getCallContext(), repositoryId, objectId, filter, extension);
-	}
-
-	public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		return fObjSvc.getRenditions(getCallContext(), repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);		
-	}
-
-	public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
-			ExtensionsData extension) {
-		fObjSvc.moveObject(getCallContext(), repositoryId, objectId, targetFolderId, sourceFolderId, extension, null);
-	}
-
-	public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
-			Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
-		fObjSvc.setContentStream(getCallContext(), repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
-	}
-
-	public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
-			Properties properties, ExtensionsData extension) {
-		fObjSvc.updateProperties(getCallContext(), repositoryId, objectId, changeToken, properties, null, extension, null);
-	}
-
-	// --- versioning service ---
-
-	public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
-		fVerSvc.cancelCheckOut(getCallContext(), repositoryId, objectId, extension);
-	}
-
-	public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
-			ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
-			ExtensionsData extension) {
-		fVerSvc.checkIn(getCallContext(), repositoryId, objectId, major, properties, contentStream, checkinComment, policies, addAces, removeAces, extension, null);
-	}
-
-	public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
-			Holder<Boolean> contentCopied) {
-		fVerSvc.checkOut(getCallContext(), repositoryId, objectId, extension, contentCopied, null);
-	}
-
-	public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-			Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
-		return fVerSvc.getObjectOfLatestVersion(getCallContext(), repositoryId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
-	}
-
-	public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-			Boolean major, String filter, ExtensionsData extension) {
-		return fVerSvc.getPropertiesOfLatestVersion(getCallContext(), repositoryId, versionSeriesId, major, filter, extension);
-	}
-
-	public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
-			Boolean includeAllowableActions, ExtensionsData extension) {
-		return fVerSvc.getAllVersions(getCallContext(), repositoryId, versionSeriesId, filter, includeAllowableActions, extension, null);
-	}
-
-	// --- discovery service ---
-
-	public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
-			String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
-		return super.getContentChanges(repositoryId, changeLogToken, includeProperties, filter, includePolicyIds, includeAcl, maxItems, extension);
-	}
-
-	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);
-	}
-
-	// --- multi filing service ---
-
-	public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
-			ExtensionsData extension) {
-		fMultiSvc.addObjectToFolder(getCallContext(), repositoryId, objectId, folderId, allVersions, extension, null);
-	}
-
-	public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
-		fMultiSvc.removeObjectFromFolder(getCallContext(), repositoryId, objectId, folderId, extension, null);
-	}
-
-	// --- relationship service ---
-
-	public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
-			RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
-			BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-		return super.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes, relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
-	}
-
-	// --- ACL service ---
-
-	public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
-		return super.applyAcl(repositoryId, objectId, aces, aclPropagation);
-	}
-
-	public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
-			AclPropagation aclPropagation, ExtensionsData extension) {
-		return super.applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
-	}
-
-	public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
-		return super.getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
-	}
-
-	// --- policy service ---
-
-	public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
-		super.applyPolicy(repositoryId, policyId, objectId, extension);
-	}
-
-	public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
-			ExtensionsData extension) {
-		return super.getAppliedPolicies(repositoryId, objectId, filter, extension);
-	}
-
-	public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
-		super.removePolicy(repositoryId, policyId, objectId, extension);
-	}
+    private InMemoryRepositoryServiceImpl fRepSvc;
+    private InMemoryObjectServiceImpl fObjSvc;
+    private InMemoryNavigationServiceImpl fNavSvc;
+    private InMemoryVersioningServiceImpl fVerSvc;
+    private InMemoryDiscoveryServiceImpl fDisSvc;
+    private InMemoryMultiFilingServiceImpl fMultiSvc;
+
+    public StoreManager getStoreManager() {
+        return storeManager;
+    }
+
+    public InMemoryService(Map<String, String> parameters) {
+
+        // initialize in-memory management
+        String repositoryClassName = (String) parameters.get(ConfigConstants.REPOSITORY_CLASS);
+        if (null == repositoryClassName)
+            repositoryClassName = StoreManagerImpl.class.getName();
+
+        if (null == storeManager)
+            storeManager = StoreManagerFactory.createInstance(repositoryClassName);
+
+        String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
+
+        List<String> allAvailableRepositories = storeManager.getAllRepositoryIds();
+
+        // init existing repositories
+        for (String existingRepId : allAvailableRepositories)
+            storeManager.initRepository(existingRepId);
+
+        // create repository if configured as a startup parameter
+        if (null != repositoryId) {
+            if (allAvailableRepositories.contains(repositoryId))
+                LOG.warn("Repostory " + repositoryId + " already exists and will not be created.");
+            else {
+                String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
+                storeManager.createAndInitRepository(repositoryId, typeCreatorClassName);
+            }
+        }
+
+        // With some special configuration settings fill the repository with
+        // some documents and folders
+        // if is empty
+        if (!allAvailableRepositories.contains(repositoryId))
+            fillRepositoryIfConfigured(parameters, repositoryId);
+
+        fRepSvc = new InMemoryRepositoryServiceImpl(storeManager);
+        fNavSvc = new InMemoryNavigationServiceImpl(storeManager);
+        fObjSvc = new InMemoryObjectServiceImpl(storeManager);
+        fVerSvc = new InMemoryVersioningServiceImpl(storeManager, fObjSvc);
+        fDisSvc = new InMemoryDiscoveryServiceImpl(storeManager, fRepSvc, fNavSvc);
+        fMultiSvc = new InMemoryMultiFilingServiceImpl(storeManager);
+
+    }
+
+    public CallContext getCallContext() {
+        return context;
+    }
+
+    public void setCallContext(CallContext context) {
+        this.context = context;
+    }
+
+    // --- repository service ---
+
+    @Override
+    public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+        return fRepSvc.getRepositoryInfos(getCallContext(), extension);
+    }
+
+    public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
+        return fRepSvc.getRepositoryInfo(getCallContext(), repositoryId, extension);
+    }
+
+    public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        return fRepSvc.getTypeChildren(getCallContext(), repositoryId, typeId, includePropertyDefinitions, maxItems,
+                skipCount, extension);
+    }
+
+    public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
+        return fRepSvc.getTypeDefinition(getCallContext(), repositoryId, typeId, extension);
+    }
+
+    public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
+            Boolean includePropertyDefinitions, ExtensionsData extension) {
+        return fRepSvc.getTypeDescendants(getCallContext(), repositoryId, typeId, depth, includePropertyDefinitions,
+                extension);
+    }
+
+    // --- navigation service ---
+
+    public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        return fNavSvc.getCheckedOutDocs(getCallContext(), repositoryId, folderId, filter, orderBy,
+                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension, null);
+    }
+
+    public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        return fNavSvc.getChildren(getCallContext(), repositoryId, folderId, filter, orderBy, includeAllowableActions,
+                includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension, null);
+    }
+
+    public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
+            String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
+        return fNavSvc.getDescendants(getCallContext(), repositoryId, folderId, depth, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includePathSegment, extension, null);
+    }
+
+    public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
+        return fNavSvc.getFolderParent(getCallContext(), repositoryId, folderId, filter, extension, null);
+    }
+
+    public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
+            String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
+        return fNavSvc.getFolderTree(getCallContext(), repositoryId, folderId, depth, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includePathSegment, extension, null);
+    }
+
+    public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
+            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+            Boolean includeRelativePathSegment, ExtensionsData extension) {
+        return fNavSvc.getObjectParents(getCallContext(), repositoryId, objectId, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includeRelativePathSegment, extension, null);
+    }
+
+    // --- object service ---
+
+    public String create(String repositoryId, Properties properties, String folderId, ContentStream contentStream,
+            VersioningState versioningState, List<String> policies, ExtensionsData extension) {
+        ObjectData od = fObjSvc.create(getCallContext(), repositoryId, properties, folderId, contentStream,
+                versioningState, policies, extension, null);
+        return od.getId();
+
+    }
+
+    public String createDocument(String repositoryId, Properties properties, String folderId,
+            ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
+            Acl removeAces, ExtensionsData extension) {
+        return fObjSvc.createDocument(getCallContext(), repositoryId, properties, folderId, contentStream,
+                versioningState, policies, addAces, removeAces, extension);
+    }
+
+    public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
+            String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
+            ExtensionsData extension) {
+        return fObjSvc.createDocumentFromSource(getCallContext(), repositoryId, sourceId, properties, folderId,
+                versioningState, policies, addAces, removeAces, extension);
+    }
+
+    public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
+            Acl addAces, Acl removeAces, ExtensionsData extension) {
+        return fObjSvc.createFolder(getCallContext(), repositoryId, properties, folderId, policies, addAces,
+                removeAces, extension);
+    }
+
+    public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
+            Acl addAces, Acl removeAces, ExtensionsData extension) {
+        return fObjSvc.createPolicy(getCallContext(), repositoryId, properties, folderId, policies, addAces,
+                removeAces, extension);
+    }
+
+    public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
+            Acl removeAces, ExtensionsData extension) {
+        return fObjSvc.createRelationship(getCallContext(), repositoryId, properties, policies, addAces, removeAces,
+                extension);
+    }
+
+    public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+            ExtensionsData extension) {
+        fObjSvc.deleteContentStream(getCallContext(), repositoryId, objectId, changeToken, extension);
+    }
+
+    public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
+        fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
+    }
+
+    public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
+            ExtensionsData extension) {
+        fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
+    }
+
+    public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
+            UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
+        return fObjSvc.deleteTree(getCallContext(), repositoryId, folderId, allVersions, unfileObjects,
+                continueOnFailure, extension);
+    }
+
+    public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
+        return fObjSvc.getAllowableActions(getCallContext(), repositoryId, objectId, extension);
+    }
+
+    public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
+            BigInteger length, ExtensionsData extension) {
+        return fObjSvc.getContentStream(getCallContext(), repositoryId, objectId, streamId, offset, length, extension);
+    }
+
+    public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+            Boolean includeAcl, ExtensionsData extension) {
+        return fObjSvc.getObject(getCallContext(), repositoryId, objectId, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
+    }
+
+    public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
+            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
+            Boolean includeAcl, ExtensionsData extension) {
+        return fObjSvc.getObjectByPath(getCallContext(), repositoryId, path, filter, includeAllowableActions,
+                includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
+    }
+
+    public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
+        return fObjSvc.getProperties(getCallContext(), repositoryId, objectId, filter, extension);
+    }
+
+    public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        return fObjSvc.getRenditions(getCallContext(), repositoryId, objectId, renditionFilter, maxItems, skipCount,
+                extension);
+    }
+
+    public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
+            ExtensionsData extension) {
+        fObjSvc.moveObject(getCallContext(), repositoryId, objectId, targetFolderId, sourceFolderId, extension, null);
+    }
+
+    public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
+            Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
+        fObjSvc.setContentStream(getCallContext(), repositoryId, objectId, overwriteFlag, changeToken, contentStream,
+                extension);
+    }
+
+    public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
+            Properties properties, ExtensionsData extension) {
+        fObjSvc.updateProperties(getCallContext(), repositoryId, objectId, changeToken, properties, null, extension,
+                null);
+    }
+
+    // --- versioning service ---
+
+    public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
+        fVerSvc.cancelCheckOut(getCallContext(), repositoryId, objectId, extension);
+    }
+
+    public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
+            ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
+            ExtensionsData extension) {
+        fVerSvc.checkIn(getCallContext(), repositoryId, objectId, major, properties, contentStream, checkinComment,
+                policies, addAces, removeAces, extension, null);
+    }
+
+    public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
+            Holder<Boolean> contentCopied) {
+        fVerSvc.checkOut(getCallContext(), repositoryId, objectId, extension, contentCopied, null);
+    }
+
+    public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+            Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
+        return fVerSvc.getObjectOfLatestVersion(getCallContext(), repositoryId, versionSeriesId, major, filter,
+                includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
+                extension, null);
+    }
+
+    public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
+            Boolean major, String filter, ExtensionsData extension) {
+        return fVerSvc.getPropertiesOfLatestVersion(getCallContext(), repositoryId, versionSeriesId, major, filter,
+                extension);
+    }
+
+    public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
+            Boolean includeAllowableActions, ExtensionsData extension) {
+        return fVerSvc.getAllVersions(getCallContext(), repositoryId, versionSeriesId, filter, includeAllowableActions,
+                extension, null);
+    }
+
+    // --- discovery service ---
+
+    public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
+            String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
+        return super.getContentChanges(repositoryId, changeLogToken, includeProperties, filter, includePolicyIds,
+                includeAcl, maxItems, extension);
+    }
+
+    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);
+    }
+
+    // --- multi filing service ---
+
+    public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
+            ExtensionsData extension) {
+        fMultiSvc.addObjectToFolder(getCallContext(), repositoryId, objectId, folderId, allVersions, extension, null);
+    }
+
+    public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
+        fMultiSvc.removeObjectFromFolder(getCallContext(), repositoryId, objectId, folderId, extension, null);
+    }
+
+    // --- relationship service ---
+
+    public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
+            RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
+            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+        return super.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes, relationshipDirection,
+                typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
+    }
+
+    // --- ACL service ---
+
+    public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
+        return super.applyAcl(repositoryId, objectId, aces, aclPropagation);
+    }
+
+    public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
+            AclPropagation aclPropagation, ExtensionsData extension) {
+        return super.applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
+    }
+
+    public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
+        return super.getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
+    }
+
+    // --- policy service ---
+
+    public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
+        super.applyPolicy(repositoryId, policyId, objectId, extension);
+    }
+
+    public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
+            ExtensionsData extension) {
+        return super.getAppliedPolicies(repositoryId, objectId, filter, extension);
+    }
+
+    public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
+        super.removePolicy(repositoryId, policyId, objectId, extension);
+    }
 
-	////////////////
+    // //////////////
     //	
-	private void fillRepositoryIfConfigured(Map<String, String> parameters, String repositoryId) {
-		class DummyCallContext implements CallContext {
+    private void fillRepositoryIfConfigured(Map<String, String> parameters, String repositoryId) {
+        class DummyCallContext implements CallContext {
 
-			public String get(String key) {
-				return null;
-			}
-
-			public String getBinding() {
-				return null;
-			}
-
-			public boolean isObjectInfoRequired() {
-				return false;
-			}
-
-			public String getRepositoryId() {
-				return null;
-			}
-
-			public String getLocale() {
-				return null;
-			}
-
-			public String getPassword() {
-				return null;
-			}
-
-			public String getUsername() {
-				return null;
-			}
-		}
-
-		String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
-		boolean doFillRepository = doFillRepositoryStr == null ? false : Boolean.parseBoolean(doFillRepositoryStr);
-
-		if (!doFillRepository)
-			return;
-
-		BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
-		NavigationService navSvc = new NavigationServiceImpl(fNavSvc);
-		ObjectService objSvc = new ObjectServiceImpl(fObjSvc);
-		RepositoryService repSvc = new RepositoryServiceImpl(fRepSvc);
-
-		String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
-		int levels = 1;
-		if (null != levelsStr)
-			levels = Integer.parseInt(levelsStr);
-
-		String docsPerLevelStr = parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER);
-		int docsPerLevel = 1;
-		if (null != docsPerLevelStr)
-			docsPerLevel = Integer.parseInt(docsPerLevelStr);
-
-		String childrenPerLevelStr = parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER);
-		int childrenPerLevel = 2;
-		if (null != childrenPerLevelStr)
-			childrenPerLevel = Integer.parseInt(childrenPerLevelStr);
-
-		String documentTypeId = parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID);
-		if (null == documentTypeId)
-			documentTypeId = BaseTypeId.CMIS_DOCUMENT.value();
-
-		String folderTypeId = parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID);
-		if (null == folderTypeId)
-			folderTypeId = BaseTypeId.CMIS_FOLDER.value();
-
-		int contentSizeKB = 0;
-		String contentSizeKBStr = parameters.get(ConfigConstants.FILLER_CONTENT_SIZE);
-		if (null != contentSizeKBStr)
-			contentSizeKB = Integer.parseInt(contentSizeKBStr);
-
-		// Create a hierarchy of folders and fill it with some documents
-		ObjectGenerator gen = new ObjectGenerator(objectFactory, navSvc, objSvc, repositoryId);
-
-		gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);
-
-		// Set the type id for all created documents:
-		gen.setDocumentTypeId(documentTypeId);
-
-		// Set the type id for all created folders:
-		gen.setFolderTypeId(folderTypeId);
-
-		// Set contentSize
-		gen.setContentSizeInKB(contentSizeKB);
-
-		// set properties that need to be filled
-		// set the properties the generator should fill with values for
-		// documents:
-		// Note: must be valid properties in configured document and folder type
-
-		List<String> propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_DOCUMENT_PROPERTY);
-		if (null != propsToSet)
-			gen.setDocumentPropertiesToGenerate(propsToSet);
-
-		propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY);
-		if (null != propsToSet)
-			gen.setFolderPropertiesToGenerate(propsToSet);
-
-		// Simulate a runtime context with configuration parameters
-		// Attach the CallContext to a thread local context that can be accessed
-		// from everywhere
-//		RuntimeContext.attachCfg(new DummyCallContext());
-
-		// Build the tree
-		RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null);
-		String rootFolderId = rep.getRootFolderId();
-
-		try {
-			gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
-			// Dump the tree
-			gen.dumpFolder(rootFolderId, "*");
-		} catch (Exception e) {
-			LOG.error("Could not create folder hierarchy with documents. " + e);
-			e.printStackTrace();
-		}
-
-	}
-
-	private List<String> readPropertiesToSetFromConfig(Map<String, String> parameters, String keyPrefix) {
-		List<String> propsToSet = new ArrayList<String>();
-		for (int i = 0;; ++i) {
-			String propertyKey = keyPrefix + Integer.toString(i);
-			String propertyToAdd = parameters.get(propertyKey);
-			if (null == propertyToAdd)
-				break;
-			else
-				propsToSet.add(propertyToAdd);
-		}
-		return propsToSet;
-	}
+            public String get(String key) {
+                return null;
+            }
+
+            public String getBinding() {
+                return null;
+            }
+
+            public boolean isObjectInfoRequired() {
+                return false;
+            }
+
+            public String getRepositoryId() {
+                return null;
+            }
+
+            public String getLocale() {
+                return null;
+            }
+
+            public String getPassword() {
+                return null;
+            }
+
+            public String getUsername() {
+                return null;
+            }
+        }
+
+        String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
+        boolean doFillRepository = doFillRepositoryStr == null ? false : Boolean.parseBoolean(doFillRepositoryStr);
+
+        if (!doFillRepository)
+            return;
+
+        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
+        NavigationService navSvc = new NavigationServiceImpl(fNavSvc);
+        ObjectService objSvc = new ObjectServiceImpl(fObjSvc);
+        RepositoryService repSvc = new RepositoryServiceImpl(fRepSvc);
+
+        String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
+        int levels = 1;
+        if (null != levelsStr)
+            levels = Integer.parseInt(levelsStr);
+
+        String docsPerLevelStr = parameters.get(ConfigConstants.FILLER_DOCS_PER_FOLDER);
+        int docsPerLevel = 1;
+        if (null != docsPerLevelStr)
+            docsPerLevel = Integer.parseInt(docsPerLevelStr);
+
+        String childrenPerLevelStr = parameters.get(ConfigConstants.FILLER_FOLDERS_PER_FOLDER);
+        int childrenPerLevel = 2;
+        if (null != childrenPerLevelStr)
+            childrenPerLevel = Integer.parseInt(childrenPerLevelStr);
+
+        String documentTypeId = parameters.get(ConfigConstants.FILLER_DOCUMENT_TYPE_ID);
+        if (null == documentTypeId)
+            documentTypeId = BaseTypeId.CMIS_DOCUMENT.value();
+
+        String folderTypeId = parameters.get(ConfigConstants.FILLER_FOLDER_TYPE_ID);
+        if (null == folderTypeId)
+            folderTypeId = BaseTypeId.CMIS_FOLDER.value();
+
+        int contentSizeKB = 0;
+        String contentSizeKBStr = parameters.get(ConfigConstants.FILLER_CONTENT_SIZE);
+        if (null != contentSizeKBStr)
+            contentSizeKB = Integer.parseInt(contentSizeKBStr);
+
+        // Create a hierarchy of folders and fill it with some documents
+        ObjectGenerator gen = new ObjectGenerator(objectFactory, navSvc, objSvc, repositoryId);
+
+        gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);
+
+        // Set the type id for all created documents:
+        gen.setDocumentTypeId(documentTypeId);
+
+        // Set the type id for all created folders:
+        gen.setFolderTypeId(folderTypeId);
+
+        // Set contentSize
+        gen.setContentSizeInKB(contentSizeKB);
+
+        // set properties that need to be filled
+        // set the properties the generator should fill with values for
+        // documents:
+        // Note: must be valid properties in configured document and folder type
+
+        List<String> propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_DOCUMENT_PROPERTY);
+        if (null != propsToSet)
+            gen.setDocumentPropertiesToGenerate(propsToSet);
+
+        propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY);
+        if (null != propsToSet)
+            gen.setFolderPropertiesToGenerate(propsToSet);
+
+        // Simulate a runtime context with configuration parameters
+        // Attach the CallContext to a thread local context that can be accessed
+        // from everywhere
+        // RuntimeContext.attachCfg(new DummyCallContext());
+
+        // Build the tree
+        RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null);
+        String rootFolderId = rep.getRootFolderId();
+
+        try {
+            gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
+            // Dump the tree
+            gen.dumpFolder(rootFolderId, "*");
+        } catch (Exception e) {
+            LOG.error("Could not create folder hierarchy with documents. " + e);
+            e.printStackTrace();
+        }
+
+    }
+
+    private List<String> readPropertiesToSetFromConfig(Map<String, String> parameters, String keyPrefix) {
+        List<String> propsToSet = new ArrayList<String>();
+        for (int i = 0;; ++i) {
+            String propertyKey = keyPrefix + Integer.toString(i);
+            String propertyToAdd = parameters.get(propertyKey);
+            if (null == propertyToAdd)
+                break;
+            else
+                propsToSet.add(propertyToAdd);
+        }
+        return propsToSet;
+    }
 
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.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/InMemoryServiceFactoryImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java Thu Apr 22 16:27:57 2010
@@ -31,67 +31,68 @@ import org.apache.commons.logging.LogFac
 
 public class InMemoryServiceFactoryImpl extends AbstractServiceFactory {
 
-	private static final Log LOG = LogFactory.getLog(InMemoryServiceFactoryImpl.class.getName());
-	private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(1000);
-	private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(100);
-	private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(2);
-	private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
-	private static CallContext OVERRIDE_CTX;
-
-	private InMemoryService inMemoryService;
-//	private CmisServiceWrapper<InMemoryService> wrapperService;
-	private ThreadLocal<CmisServiceWrapper<InMemoryService>> threadLocalService = new ThreadLocal<CmisServiceWrapper<InMemoryService>>();
-	private boolean fUseOverrideCtx = false;
-	
-	@Override
-	public void init(Map<String, String> parameters) {
-		LOG.info("Initializing in-memory repository...");
-
-
-		inMemoryService = new InMemoryService(parameters);
-//		wrapperService = new CmisServiceWrapper<InMemoryService>(inMemoryService, DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
-//				DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
-		String overrideCtx = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
-		if (null != overrideCtx)
-			fUseOverrideCtx = true;
-
-		LOG.info("...initialized in-memory repository.");
-	}
-
-	public static void setOverrideCallContext(CallContext ctx) {
-		OVERRIDE_CTX = ctx;
-	}
-	
-	@Override
-	public CmisService getService(CallContext context) {
-		LOG.debug("start getService()");
-
-		// Attach the CallContext to a thread local context that can be
-		// accessed from everywhere
-		// Some unit tests set their own context. So if we find one then we use
-		// this one and ignore the provided one. Otherwise we set a new context.
-		if (fUseOverrideCtx && null != OVERRIDE_CTX) {
-			context = OVERRIDE_CTX;
-		}
-		
-		CmisServiceWrapper<InMemoryService> wrapperService = threadLocalService.get();
-		if (wrapperService == null) {
-			wrapperService = new CmisServiceWrapper<InMemoryService>(inMemoryService, DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
-					DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
-			threadLocalService.set(wrapperService);
-		}
-
-		wrapperService.getWrappedService().setCallContext(context);
-
-		LOG.debug("stop getService()");
-		return inMemoryService; //wrapperService;
-			
-	}
-	
-	@Override
-	public void destroy() {
-		threadLocalService = null;
-//		RuntimeContext.remove();
-	}
-	
+    private static final Log LOG = LogFactory.getLog(InMemoryServiceFactoryImpl.class.getName());
+    private static final BigInteger DEFAULT_MAX_ITEMS_OBJECTS = BigInteger.valueOf(1000);
+    private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(100);
+    private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(2);
+    private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
+    private static CallContext OVERRIDE_CTX;
+
+    private InMemoryService inMemoryService;
+    // private CmisServiceWrapper<InMemoryService> wrapperService;
+    private ThreadLocal<CmisServiceWrapper<InMemoryService>> threadLocalService = new ThreadLocal<CmisServiceWrapper<InMemoryService>>();
+    private boolean fUseOverrideCtx = false;
+
+    @Override
+    public void init(Map<String, String> parameters) {
+        LOG.info("Initializing in-memory repository...");
+
+        inMemoryService = new InMemoryService(parameters);
+        // wrapperService = new
+        // CmisServiceWrapper<InMemoryService>(inMemoryService,
+        // DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
+        // DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+        String overrideCtx = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
+        if (null != overrideCtx)
+            fUseOverrideCtx = true;
+
+        LOG.info("...initialized in-memory repository.");
+    }
+
+    public static void setOverrideCallContext(CallContext ctx) {
+        OVERRIDE_CTX = ctx;
+    }
+
+    @Override
+    public CmisService getService(CallContext context) {
+        LOG.debug("start getService()");
+
+        // Attach the CallContext to a thread local context that can be
+        // accessed from everywhere
+        // Some unit tests set their own context. So if we find one then we use
+        // this one and ignore the provided one. Otherwise we set a new context.
+        if (fUseOverrideCtx && null != OVERRIDE_CTX) {
+            context = OVERRIDE_CTX;
+        }
+
+        CmisServiceWrapper<InMemoryService> wrapperService = threadLocalService.get();
+        if (wrapperService == null) {
+            wrapperService = new CmisServiceWrapper<InMemoryService>(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
+                    DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+            threadLocalService.set(wrapperService);
+        }
+
+        wrapperService.getWrappedService().setCallContext(context);
+
+        LOG.debug("stop getService()");
+        return inMemoryService; // wrapperService;
+
+    }
+
+    @Override
+    public void destroy() {
+        threadLocalService = null;
+        // RuntimeContext.remove();
+    }
+
 }

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.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/InMemoryVersioningServiceImpl.java?rev=936938&r1=936937&r2=936938&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java Thu Apr 22 16:27:57 2010
@@ -48,170 +48,170 @@ import org.apache.commons.logging.LogFac
 
 public class InMemoryVersioningServiceImpl extends InMemoryAbstractServiceImpl implements CmisVersioningService {
 
-	private static final Log LOG = LogFactory.getLog(InMemoryVersioningServiceImpl.class.getName());
+    private static final Log LOG = LogFactory.getLog(InMemoryVersioningServiceImpl.class.getName());
 
-	InMemoryObjectServiceImpl fObjectService; // real implementation of the
-	// service
-	AtomLinkInfoProvider fAtomLinkProvider;
+    InMemoryObjectServiceImpl fObjectService; // real implementation of the
+    // service
+    AtomLinkInfoProvider fAtomLinkProvider;
 
-	public InMemoryVersioningServiceImpl(StoreManager storeManager, InMemoryObjectServiceImpl objectService) {
-		super(storeManager);
-		fObjectService = objectService;
-		fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
-	}
+    public InMemoryVersioningServiceImpl(StoreManager storeManager, InMemoryObjectServiceImpl objectService) {
+        super(storeManager);
+        fObjectService = objectService;
+        fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
+    }
 
-	public void cancelCheckOut(CallContext context, String repositoryId, String objectId, ExtensionsData extension) {
+    public void cancelCheckOut(CallContext context, String repositoryId, String objectId, ExtensionsData extension) {
 
-		StoredObject so = checkStandardParameters(repositoryId, objectId);
-		String user = context.getUsername();
-		VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
+        StoredObject so = checkStandardParameters(repositoryId, objectId);
+        String user = context.getUsername();
+        VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
-		verDoc.cancelCheckOut(user);
-	}
+        verDoc.cancelCheckOut(user);
+    }
 
-	public ObjectData checkIn(CallContext context, String repositoryId, Holder<String> objectId, Boolean major,
-			Properties properties, ContentStream contentStream, String checkinComment, List<String> policies,
-			Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    public ObjectData checkIn(CallContext context, String repositoryId, Holder<String> objectId, Boolean major,
+            Properties properties, ContentStream contentStream, String checkinComment, List<String> policies,
+            Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
-		StoredObject so = checkStandardParameters(repositoryId, objectId.getValue());
-		String user = context.getUsername();
-		VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
+        StoredObject so = checkStandardParameters(repositoryId, objectId.getValue());
+        String user = context.getUsername();
+        VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
-		DocumentVersion pwc = verDoc.getPwc();
+        DocumentVersion pwc = verDoc.getPwc();
 
-		if (null != contentStream)
-			pwc.setContent(contentStream, false);
+        if (null != contentStream)
+            pwc.setContent(contentStream, false);
 
-		if (null != properties && null != properties.getProperties())
-			pwc.setCustomProperties(properties.getProperties());
+        if (null != properties && null != properties.getProperties())
+            pwc.setCustomProperties(properties.getProperties());
 
-		verDoc.checkIn(major, checkinComment, user);
+        verDoc.checkIn(major, checkinComment, user);
 
-		// To be able to provide all Atom links in the response we need
-		// additional information:
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        // To be able to provide all Atom links in the response we need
+        // additional information:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
-				IncludeRelationships.NONE, null, false, false, extension);
+        ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+                IncludeRelationships.NONE, null, false, false, extension);
 
-		return od;
-	}
+        return od;
+    }
 
-	public ObjectData checkOut(CallContext context, String repositoryId, Holder<String> objectId,
-			ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
+    public ObjectData checkOut(CallContext context, String repositoryId, Holder<String> objectId,
+            ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
 
-		StoredObject so = checkStandardParameters(repositoryId, objectId.getValue());
-		TypeDefinition typeDef = getTypeDefinition(repositoryId, so);
-		if (!typeDef.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT))
-			throw new CmisNotSupportedException("Only documents can be checked-out.");
-		else if (!((DocumentTypeDefinition) typeDef).isVersionable())
-			throw new CmisNotSupportedException("Object can't be checked-out, type is not versionable.");
+        StoredObject so = checkStandardParameters(repositoryId, objectId.getValue());
+        TypeDefinition typeDef = getTypeDefinition(repositoryId, so);
+        if (!typeDef.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT))
+            throw new CmisNotSupportedException("Only documents can be checked-out.");
+        else if (!((DocumentTypeDefinition) typeDef).isVersionable())
+            throw new CmisNotSupportedException("Object can't be checked-out, type is not versionable.");
 
-		checkIsVersionableObject(so);
+        checkIsVersionableObject(so);
 
-		VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
+        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
 
-		ContentStream content = null;
+        ContentStream content = null;
 
-		if (so instanceof DocumentVersion) {
-			// get document the version is contained in to c
-			content = ((DocumentVersion) so).getContent(0, -1);
-		} else {
-			content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
-		}
+        if (so instanceof DocumentVersion) {
+            // get document the version is contained in to c
+            content = ((DocumentVersion) so).getContent(0, -1);
+        } else {
+            content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
+        }
 
-		if (verDoc.isCheckedOut())
-			throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
+        if (verDoc.isCheckedOut())
+            throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
 
-		String user = context.getUsername();
-		checkHasUser(user);
+        String user = context.getUsername();
+        checkHasUser(user);
 
-		DocumentVersion pwc = verDoc.checkOut(content, user);
-		objectId.setValue(pwc.getId()); // return the id of the created pwc
+        DocumentVersion pwc = verDoc.checkOut(content, user);
+        objectId.setValue(pwc.getId()); // return the id of the created pwc
 
-		// To be able to provide all Atom links in the response we need
-		// additional information:
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        // To be able to provide all Atom links in the response we need
+        // additional information:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
-				IncludeRelationships.NONE, null, false, false, extension);
+        ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+                IncludeRelationships.NONE, null, false, false, extension);
 
-		return od;
-	}
+        return od;
+    }
 
-	public List<ObjectData> getAllVersions(CallContext context, String repositoryId, String versionSeriesId,
-			String filter, Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    public List<ObjectData> getAllVersions(CallContext context, String repositoryId, String versionSeriesId,
+            String filter, Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
-		StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
+        StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
 
-		if (!(so instanceof VersionedDocument))
-			throw new RuntimeException("Object is not instance of a VersionedDocument (version series)");
+        if (!(so instanceof VersionedDocument))
+            throw new RuntimeException("Object is not instance of a VersionedDocument (version series)");
 
-		VersionedDocument verDoc = (VersionedDocument) so;
-		List<ObjectData> res = new ArrayList<ObjectData>();
-		List<DocumentVersion> versions = verDoc.getAllVersions();
-		for (DocumentVersion version : versions) {
-			ObjectData objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions,
-					extension, objectInfos);
-			res.add(objData);
-		}
+        VersionedDocument verDoc = (VersionedDocument) so;
+        List<ObjectData> res = new ArrayList<ObjectData>();
+        List<DocumentVersion> versions = verDoc.getAllVersions();
+        for (DocumentVersion version : versions) {
+            ObjectData objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions,
+                    extension, objectInfos);
+            res.add(objData);
+        }
 
-		// provide information for Atom links for version series:
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        // provide information for Atom links for version series:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		return res;
-	}
+        return res;
+    }
 
-	public ObjectData getObjectOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
-			Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-			String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension,
-			ObjectInfoHolder objectInfos) {
+    public ObjectData getObjectOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
+            Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
+            String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension,
+            ObjectInfoHolder objectInfos) {
 
-		StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
-		ObjectData objData = null;
+        StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
+        ObjectData objData = null;
 
-		if (so instanceof VersionedDocument) {
-			VersionedDocument verDoc = (VersionedDocument) so;
-			DocumentVersion latestVersion = verDoc.getLatestVersion(major);
-			objData = getObject(context, repositoryId, latestVersion.getId(), filter, includeAllowableActions,
-					extension, objectInfos);
-		} else if (so instanceof Document) {
-			objData = getObject(context, repositoryId, so.getId(), filter, includeAllowableActions, extension,
-					objectInfos);
-		} else
-			throw new RuntimeException("Object is not instance of a document (version series)");
+        if (so instanceof VersionedDocument) {
+            VersionedDocument verDoc = (VersionedDocument) so;
+            DocumentVersion latestVersion = verDoc.getLatestVersion(major);
+            objData = getObject(context, repositoryId, latestVersion.getId(), filter, includeAllowableActions,
+                    extension, objectInfos);
+        } else if (so instanceof Document) {
+            objData = getObject(context, repositoryId, so.getId(), filter, includeAllowableActions, extension,
+                    objectInfos);
+        } else
+            throw new RuntimeException("Object is not instance of a document (version series)");
 
-		// provide information for Atom links for version series:
-		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
+        // provide information for Atom links for version series:
+        fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		return objData;
-	}
+        return objData;
+    }
 
-	public Properties getPropertiesOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
-			Boolean major, String filter, ExtensionsData extension) {
+    public Properties getPropertiesOfLatestVersion(CallContext context, String repositoryId, String versionSeriesId,
+            Boolean major, String filter, ExtensionsData extension) {
 
-		StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
-		StoredObject latestVersionObject = null;
+        StoredObject so = checkStandardParameters(repositoryId, versionSeriesId);
+        StoredObject latestVersionObject = null;
 
-		if (so instanceof VersionedDocument) {
-			VersionedDocument verDoc = (VersionedDocument) so;
-			latestVersionObject = verDoc.getLatestVersion(major);
-		} else if (so instanceof Document) {
-			latestVersionObject = so;
-		} else
-			throw new RuntimeException("Object is not instance of a document (version series)");
+        if (so instanceof VersionedDocument) {
+            VersionedDocument verDoc = (VersionedDocument) so;
+            latestVersionObject = verDoc.getLatestVersion(major);
+        } else if (so instanceof Document) {
+            latestVersionObject = so;
+        } else
+            throw new RuntimeException("Object is not instance of a document (version series)");
 
-		List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
-		Properties props = PropertyCreationHelper.getPropertiesFromObject(repositoryId, latestVersionObject,
-				fStoreManager, requestedIds);
+        List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
+        Properties props = PropertyCreationHelper.getPropertiesFromObject(repositoryId, latestVersionObject,
+                fStoreManager, requestedIds);
 
-		return props;
-	}
+        return props;
+    }
 
-	private ObjectData getObject(CallContext context, String repositoryId, String objectId, String filter,
-			Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
+    private ObjectData getObject(CallContext context, String repositoryId, String objectId, String filter,
+            Boolean includeAllowableActions, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
-		return fObjectService.getObject(context, repositoryId, objectId, filter, includeAllowableActions,
-				IncludeRelationships.NONE, null, false, includeAllowableActions, extension, objectInfos);
-	}
+        return fObjectService.getObject(context, repositoryId, objectId, filter, includeAllowableActions,
+                IncludeRelationships.NONE, null, false, includeAllowableActions, extension, objectInfos);
+    }
 }



Mime
View raw message