chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r936243 - in /incubator/chemistry/opencmis/trunk: chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/...
Date Wed, 21 Apr 2010 10:13:01 GMT
Author: jens
Date: Wed Apr 21 10:13:00 2010
New Revision: 936243

URL: http://svn.apache.org/viewvc?rev=936243&view=rev
Log:
Adjust thread local storage model for InMemory server to the one used be Fileshare
reenable disabled testAssert

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.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/DataObjectCreator.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java Wed Apr 21 10:13:00 2010
@@ -50,7 +50,7 @@ import org.apache.chemistry.opencmis.inm
  */
 public class DataObjectCreator {
 
-	public static AllowableActions fillAllowableActions(ObjectStore objStore, StoredObject so) {
+	public static AllowableActions fillAllowableActions(ObjectStore objStore, StoredObject so, String user) {
 
 		boolean isFolder = so instanceof Folder;
 		boolean isDocument = so instanceof Content;
@@ -60,7 +60,6 @@ public class DataObjectCreator {
 		boolean isVersioned = so instanceof Version || so instanceof VersionedDocument;
 		boolean hasContent = so instanceof Content && ((Content) so).hasContent();
 
-		String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
 		if (so instanceof Version) {
 			isCheckedOut = ((Version) so).isPwc();
 			canCheckIn = isCheckedOut && ((Version) so).getParentDocument().getCheckedOutBy().equals(user);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.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/InMemoryMultiFilingServiceImpl.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java Wed Apr 21 10:13:00 2010
@@ -66,7 +66,8 @@ public class InMemoryMultiFilingServiceI
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
 				IncludeRelationships.NONE, null, false, false, extension);
 
 		LOG.debug("End addObjectToFolder()");
@@ -92,7 +93,8 @@ public class InMemoryMultiFilingServiceI
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, folder, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
 				IncludeRelationships.NONE, null, false, false, extension);
 
 		LOG.debug("End removeObjectFromFolder()");

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=936243&r1=936242&r2=936243&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 Wed Apr 21 10:13:00 2010
@@ -87,19 +87,20 @@ public class InMemoryNavigationServiceIm
 		else
 			checkRepositoryId(repositoryId);
 
+		String user = context.getUsername();
 		if (null == folderId) {
-			List<VersionedDocument> checkedOuts = fStoreManager.getObjectStore(repositoryId)
-			.getCheckedOutDocuments(orderBy);
+			List<VersionedDocument> checkedOuts = fStoreManager.getObjectStore(repositoryId).getCheckedOutDocuments(
+					orderBy);
 			for (VersionedDocument checkedOut : checkedOuts) {
-				ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, checkedOut, filter,
+				ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, checkedOut, filter, user,
 						includeAllowableActions, includeRelationships, renditionFilter, false, false, extension);
 				fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, checkedOut, objectInfos);
 				odList.add(od);
 			}
 		} else {
 			ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
-					includeAllowableActions, includeRelationships, renditionFilter, false, -1, -1, false,
-					objectInfos);
+					includeAllowableActions, includeRelationships, renditionFilter, false, -1, -1, false, objectInfos,
+					user);
 			for (ObjectInFolderData child : children.getObjects()) {
 				ObjectData obj = child.getObject();
 				StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(obj.getId());
@@ -128,9 +129,10 @@ public class InMemoryNavigationServiceIm
 
 		int maxItemsInt = maxItems == null ? -1 : maxItems.intValue();
 		int skipCountInt = skipCount == null ? -1 : skipCount.intValue();
-		ObjectInFolderList res = getChildrenIntern(repositoryId, folderId, filter, orderBy,
-				includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItemsInt,
-				skipCountInt, false, objectInfos);
+		String user = context.getUsername();
+		ObjectInFolderList res = getChildrenIntern(repositoryId, folderId, filter, orderBy, includeAllowableActions,
+				includeRelationships, renditionFilter, includePathSegment, maxItemsInt, skipCountInt, false,
+				objectInfos, user);
 		LOG.debug("stop getChildren()");
 		return res;
 	}
@@ -154,9 +156,10 @@ public class InMemoryNavigationServiceIm
 			levels = depth.intValue();
 
 		int level = 0;
+		String user = context.getUsername();
 		List<ObjectInFolderContainer> result = getDescendantsIntern(repositoryId, folderId, filter,
 				includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, level, levels,
-				false, objectInfos);
+				false, objectInfos, user);
 
 		LOG.debug("stop getDescendants()");
 		return result;
@@ -200,9 +203,10 @@ public class InMemoryNavigationServiceIm
 
 		int levels = depth == null ? 2 : depth.intValue();
 		int level = 0;
+		String user = context.getUsername();
 		List<ObjectInFolderContainer> result = getDescendantsIntern(repositoryId, folderId, filter,
 				includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, level, levels,
-				true, objectInfos);
+				true, objectInfos, user);
 
 		LOG.debug("stop getFolderTree()");
 		return result;
@@ -243,7 +247,8 @@ public class InMemoryNavigationServiceIm
 
 	private ObjectInFolderList getChildrenIntern(String repositoryId, String folderId, String filter, String orderBy,
 			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includePathSegments, int maxItems, int skipCount, boolean folderOnly, ObjectInfoHolder objectInfos) {
+			Boolean includePathSegments, int maxItems, int skipCount, boolean folderOnly, ObjectInfoHolder objectInfos,
+			String user) {
 
 		ObjectInFolderListImpl result = new ObjectInFolderListImpl();
 		List<ObjectInFolderData> folderList = new ArrayList<ObjectInFolderData>();
@@ -270,7 +275,7 @@ public class InMemoryNavigationServiceIm
 			if (includePathSegments != null && includePathSegments)
 				oifd.setPathSegment(spo.getName());
 			if (includeAllowableActions != null && includeAllowableActions) {
-				AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(fs, spo);
+				AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(fs, spo, user);
 				objectData.setAllowableActions(allowableActions);
 			}
 			if (includeRelationships != null && includeRelationships != IncludeRelationships.NONE) {
@@ -278,9 +283,9 @@ public class InMemoryNavigationServiceIm
 			}
 			if (renditionFilter != null && renditionFilter.length() > 0) {
 				objectData.setRelationships(null /*
-				 * f.getRenditions(renditionFilter
-				 * )
-				 */);
+												 * f.getRenditions(renditionFilter
+												 * )
+												 */);
 			}
 
 			Properties props = PropertyCreationHelper.getPropertiesFromObject(repositoryId, spo, fStoreManager,
@@ -300,7 +305,8 @@ public class InMemoryNavigationServiceIm
 
 	private List<ObjectInFolderContainer> getDescendantsIntern(String repositoryId, String folderId, String filter,
 			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-			Boolean includePathSegments, int level, int maxLevels, boolean folderOnly, ObjectInfoHolder objectInfos) {
+			Boolean includePathSegments, int level, int maxLevels, boolean folderOnly, ObjectInfoHolder objectInfos,
+			String user) {
 
 		// log.info("getDescendantsIntern: " + folderId + ", in level " + level
 		// + ", max levels " + maxLevels);
@@ -310,7 +316,7 @@ public class InMemoryNavigationServiceIm
 			String orderBy = PropertyIds.NAME;
 			ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
 					includeAllowableActions, includeRelationships, renditionFilter, includePathSegments, 1000, 0,
-					folderOnly, objectInfos);
+					folderOnly, objectInfos, user);
 
 			childrenOfFolderId = new ArrayList<ObjectInFolderContainer>();
 			if (null != children) {
@@ -320,7 +326,7 @@ public class InMemoryNavigationServiceIm
 					String childId = child.getObject().getId();
 					List<ObjectInFolderContainer> subChildren = getDescendantsIntern(repositoryId, childId, filter,
 							includeAllowableActions, includeRelationships, renditionFilter, includePathSegments,
-							level + 1, maxLevels, folderOnly, objectInfos);
+							level + 1, maxLevels, folderOnly, objectInfos, user);
 
 					oifc.setObject(child);
 					if (null != subChildren)
@@ -395,7 +401,7 @@ public class InMemoryNavigationServiceIm
 	void copyFilteredProperties(String repositoryId, StoredObject so, String filter, ObjectDataImpl objData) {
 		List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
 		Properties props = PropertyCreationHelper
-		.getPropertiesFromObject(repositoryId, so, fStoreManager, requestedIds);
+				.getPropertiesFromObject(repositoryId, so, fStoreManager, requestedIds);
 		objData.setProperties(props);
 	}
 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.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/InMemoryObjectServiceImpl.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Wed Apr 21 10:13:00 2010
@@ -93,8 +93,9 @@ public class InMemoryObjectServiceImpl e
 		// Attach the CallContext to a thread local context that can be
 		// accessed from everywhere
 
+		String user = context.getUsername();
 		StoredObject so = createDocumentIntern(repositoryId, properties, folderId, contentStream, versioningState,
-				policies, addAces, removeAces, extension);
+				policies, addAces, removeAces, extension, user);
 		LOG.debug("stop createDocument()");
 		return so.getId();
 	}
@@ -139,8 +140,8 @@ public class InMemoryObjectServiceImpl e
 			List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
 		LOG.debug("start createFolder()");
 
-		Folder folder = createFolderIntern(repositoryId, properties, folderId, policies, addAces, removeAces,
-				extension);
+		String user = context.getUsername();
+		Folder folder = createFolderIntern(repositoryId, properties, folderId, policies, addAces, removeAces, extension, user);
 		LOG.debug("stop createFolder()");
 		return folder.getId();
 	}
@@ -163,8 +164,7 @@ public class InMemoryObjectServiceImpl e
 		// TODO to be completed if relationships are implemented
 		LOG.debug("start createRelationship()");
 		checkRepositoryId(repositoryId);
-		StoredObject so = createRelationshipIntern(repositoryId, properties, policies, addAces, removeAces,
-				extension);
+		StoredObject so = createRelationshipIntern(repositoryId, properties, policies, addAces, removeAces, extension);
 		LOG.debug("stop createRelationship()");
 		return so == null ? null : so.getId();
 	}
@@ -191,7 +191,6 @@ public class InMemoryObjectServiceImpl e
 			ContentStream contentStream, VersioningState versioningState, List<String> policies,
 			ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
-
 		if (null == properties || null == properties.getProperties())
 			throw new RuntimeException("Cannot create object, without properties.");
 
@@ -200,7 +199,7 @@ public class InMemoryObjectServiceImpl e
 		String typeId = pd == null ? null : pd.getFirstValue();
 		if (null == typeId)
 			throw new RuntimeException(
-			"Cannot create object, without a type (no property with id CMIS_OBJECT_TYPE_ID).");
+					"Cannot create object, without a type (no property with id CMIS_OBJECT_TYPE_ID).");
 
 		TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
 		if (typeDefC == null)
@@ -209,11 +208,12 @@ public class InMemoryObjectServiceImpl e
 		// check if the given type is a document type
 		BaseTypeId typeBaseId = typeDefC.getTypeDefinition().getBaseTypeId();
 		StoredObject so = null;
+		String user = context.getUsername();
 		if (typeBaseId.equals(InMemoryDocumentTypeDefinition.getRootDocumentType().getBaseTypeId())) {
-			so = createDocumentIntern(repositoryId, properties, folderId, contentStream, versioningState, null,
-					null, null, null);
+			so = createDocumentIntern(repositoryId, properties, folderId, contentStream, versioningState, null, null,
+					null, null, user);
 		} else if (typeBaseId.equals(InMemoryFolderTypeDefinition.getRootFolderType().getBaseTypeId())) {
-			so = createFolderIntern(repositoryId, properties, folderId, null, null, null, null);
+			so = createFolderIntern(repositoryId, properties, folderId, null, null, null, null, user);
 		} else if (typeBaseId.equals(InMemoryPolicyTypeDefinition.getRootPolicyType().getBaseTypeId())) {
 			so = createPolicyIntern(repositoryId, properties, folderId, null, null, null, null);
 		} else if (typeBaseId.equals(InMemoryRelationshipTypeDefinition.getRootRelationshipType().getBaseTypeId())) {
@@ -223,7 +223,7 @@ public class InMemoryObjectServiceImpl e
 
 		// Make a call to getObject to convert the resulting id into an
 		// ObjectData
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false,
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
 				IncludeRelationships.NONE, null, false, false, extension);
 
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
@@ -312,7 +312,8 @@ public class InMemoryObjectServiceImpl e
 		if (so == null)
 			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
 
-		AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(objectStore, so);
+		String user = context.getUsername();
+		AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(objectStore, so, user);
 		LOG.debug("stop getAllowableActions()");
 		return allowableActions;
 	}
@@ -346,7 +347,8 @@ public class InMemoryObjectServiceImpl e
 		if (so == null)
 			throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, filter, includeAllowableActions,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, filter, user, includeAllowableActions,
 				includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
 
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
@@ -368,7 +370,8 @@ public class InMemoryObjectServiceImpl e
 		if (so == null)
 			throw new CmisObjectNotFoundException("Unknown path: " + path);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, filter, includeAllowableActions,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, filter, user, includeAllowableActions,
 				includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
 
 		LOG.debug("stop getObjectByPath()");
@@ -391,8 +394,8 @@ public class InMemoryObjectServiceImpl e
 
 		// build properties collection
 		List<String> requestedIds = FilterParser.getRequestedIdsFromFilter(filter);
-		Properties props = PropertyCreationHelper.getPropertiesFromObject(repositoryId, so, fStoreManager,
-				requestedIds);
+		Properties props = PropertyCreationHelper
+				.getPropertiesFromObject(repositoryId, so, fStoreManager, requestedIds);
 		LOG.debug("stop getProperties()");
 		return props;
 	}
@@ -439,8 +442,7 @@ public class InMemoryObjectServiceImpl e
 		else if (soSource instanceof Folder)
 			sourceFolder = (Folder) soSource;
 		else
-			throw new CmisNotSupportedException("Source " + sourceFolderId
-					+ " of a move operation must be a folder");
+			throw new CmisNotSupportedException("Source " + sourceFolderId + " of a move operation must be a folder");
 
 		boolean foundOldParent = false;
 		for (Folder parent : spo.getParents()) {
@@ -465,7 +467,8 @@ public class InMemoryObjectServiceImpl e
 		// additional information:
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
 				IncludeRelationships.NONE, null, false, false, extension);
 
 		return od;
@@ -490,7 +493,7 @@ public class InMemoryObjectServiceImpl e
 		else if (so instanceof DocumentVersion) {
 			// something that is versionable check the proper status of the
 			// object
-			String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+			String user = context.getUsername();
 			testHasProperCheckedOutStatus(so, user);
 			content = (DocumentVersion) so;
 		} else
@@ -516,7 +519,7 @@ public class InMemoryObjectServiceImpl e
 
 		// if the object is a versionable object it must be checked-out
 		if (so instanceof VersionedDocument || so instanceof DocumentVersion) {
-			String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+			String user = context.getUsername();
 			// VersionedDocument verDoc =
 			// testIsNotCheckedOutBySomeoneElse(so, user);
 			testHasProperCheckedOutStatus(so, user);
@@ -548,18 +551,18 @@ public class InMemoryObjectServiceImpl e
 				if (propDef.isRequired())
 					throw new CmisConstraintException(
 							"updateProperties failed, following property can't be deleted, because it is required: "
-							+ key);
+									+ key);
 				oldProperties.remove(key);
 				hasUpdatedOtherProps = true;
 			} else {
 				if (propDef.getUpdatability().equals(Updatability.WHENCHECKEDOUT) && !isCheckedOut)
 					throw new CmisConstraintException(
 							"updateProperties failed, following property can't be updated, because it is not checked-out: "
-							+ key);
+									+ key);
 				else if (!propDef.getUpdatability().equals(Updatability.READWRITE))
 					throw new CmisConstraintException(
 							"updateProperties failed, following property can't be updated, because it is not writable: "
-							+ key);
+									+ key);
 				oldProperties.put(key, value);
 				hasUpdatedOtherProps = true;
 			}
@@ -577,7 +580,7 @@ public class InMemoryObjectServiceImpl e
 			for (Folder parent : parents) {
 				if (parent.hasChild(newName))
 					throw new CmisConstraintException(
-					"updateProperties failed, cannot rename because path already exists.");
+							"updateProperties failed, cannot rename because path already exists.");
 			}
 			so.rename((String) pd.getFirstValue()); // note: this does
 			// persist
@@ -586,7 +589,7 @@ public class InMemoryObjectServiceImpl e
 
 		if (hasUpdatedOtherProps) {
 			// set user, creation date, etc.
-			String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+			String user = context.getUsername();
 
 			if (user == null)
 				user = "unknown";
@@ -616,7 +619,8 @@ public class InMemoryObjectServiceImpl e
 		// additional information:
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false,
+		String user = context.getUsername();
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
 				IncludeRelationships.NONE, null, false, false, extension);
 
 		LOG.debug("stop updateProperties()");
@@ -629,7 +633,7 @@ public class InMemoryObjectServiceImpl e
 
 	private StoredObject createDocumentIntern(String repositoryId, Properties properties, String folderId,
 			ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addACEs,
-			Acl removeACEs, ExtensionsData extension) {
+			Acl removeACEs, ExtensionsData extension, String user) {
 		checkRepositoryId(repositoryId);
 
 		ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
@@ -670,7 +674,6 @@ public class InMemoryObjectServiceImpl e
 		TypeValidator.validateProperties(typeDef, properties, true);
 
 		// set user, creation date, etc.
-		String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
 		if (user == null)
 			user = "unknown";
 
@@ -712,7 +715,7 @@ public class InMemoryObjectServiceImpl e
 	}
 
 	private Folder createFolderIntern(String repositoryId, Properties properties, String folderId,
-			List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
+			List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension, String user) {
 
 		// Attach the CallContext to a thread local context that can be accessed
 		// from everywhere
@@ -759,7 +762,6 @@ public class InMemoryObjectServiceImpl e
 			ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 			Folder newFolder = objStore.createFolder(folderName);
 			// set default system attributes
-			String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
 			if (user == null)
 				user = "unknown";
 			newFolder.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);

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=936243&r1=936242&r2=936243&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 Wed Apr 21 10:13:00 2010
@@ -73,7 +73,8 @@ public class InMemoryService  extends Ab
 
 	private static final Log LOG = LogFactory.getLog(InMemoryService.class.getName());
 
-	private StoreManager fStoreManager; // singleton root of everything
+	private StoreManager storeManager; // singleton root of everything
+	private CallContext context;
 
 	private InMemoryRepositoryServiceImpl fRepSvc;
 	private InMemoryObjectServiceImpl fObjSvc;
@@ -83,7 +84,7 @@ public class InMemoryService  extends Ab
 	private InMemoryMultiFilingServiceImpl fMultiSvc;
 
 	public StoreManager getStoreManager() {
-		return fStoreManager;
+		return storeManager;
 	}
 
 	public InMemoryService(Map<String, String> parameters) {
@@ -93,16 +94,16 @@ public class InMemoryService  extends Ab
 		if (null == repositoryClassName)
 			repositoryClassName = StoreManagerImpl.class.getName();
 
-		if (null == fStoreManager)
-			fStoreManager = StoreManagerFactory.createInstance(repositoryClassName);
+		if (null == storeManager)
+			storeManager = StoreManagerFactory.createInstance(repositoryClassName);
 
 		String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
 
-		List<String> allAvailableRepositories = fStoreManager.getAllRepositoryIds();
+		List<String> allAvailableRepositories = storeManager.getAllRepositoryIds();
 
 		// init existing repositories
 		for (String existingRepId : allAvailableRepositories)
-			fStoreManager.initRepository(existingRepId);
+			storeManager.initRepository(existingRepId);
 
 		// create repository if configured as a startup parameter
 		if (null != repositoryId) {
@@ -110,7 +111,7 @@ public class InMemoryService  extends Ab
 				LOG.warn("Repostory " + repositoryId + " already exists and will not be created.");
 			else {
 				String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
-				fStoreManager.createAndInitRepository(repositoryId, typeCreatorClassName);
+				storeManager.createAndInitRepository(repositoryId, typeCreatorClassName);
 			}
 		}
 
@@ -121,39 +122,46 @@ public class InMemoryService  extends Ab
 			fillRepositoryIfConfigured(parameters, repositoryId);
 
 		
-		fRepSvc = new InMemoryRepositoryServiceImpl(fStoreManager);
-		fNavSvc = new InMemoryNavigationServiceImpl(fStoreManager);
-		fObjSvc = new InMemoryObjectServiceImpl(fStoreManager);
-		fVerSvc = new InMemoryVersioningServiceImpl(fStoreManager, fObjSvc);
-		fDisSvc = new InMemoryDiscoveryServiceImpl(fStoreManager, fRepSvc, fNavSvc);
-	    fMultiSvc = new InMemoryMultiFilingServiceImpl(fStoreManager);
+		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(null, extension);
+		return fRepSvc.getRepositoryInfos(getCallContext(), extension);
 	}
 
 	public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
-		return fRepSvc.getRepositoryInfo(null, repositoryId, 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(null, repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
+		return fRepSvc.getTypeChildren(getCallContext(), repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
 	}
 
 	public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
-		return fRepSvc.getTypeDefinition(null, repositoryId, typeId, 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(null, repositoryId, typeId, depth, includePropertyDefinitions, extension);
+		return fRepSvc.getTypeDescendants(getCallContext(), repositoryId, typeId, depth, includePropertyDefinitions, extension);
 	}
 
 	// --- navigation service ---
@@ -161,49 +169,42 @@ public class InMemoryService  extends Ab
 	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(null, repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension, null);
+		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(null, repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension, null);
+		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) {
-//		List<ObjectInFolderContainer> res =  super.getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
-		return fNavSvc.getDescendants(null, repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension, null);
-//		return res;
+		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) {
-//		ObjectData res =  super.getFolderParent(repositoryId, folderId, filter, extension);
-		return fNavSvc.getFolderParent(null, repositoryId, folderId, filter, extension, null);
-//		return res;
+		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) {
-//		List<ObjectInFolderContainer> res = super.getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
-		return fNavSvc.getFolderTree(null, repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension, null);
-//		return res;
+		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(null, repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension, null);
+		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) {
-//		super.create(repositoryId, properties, folderId, contentStream, versioningState, policies, extension);
-		ObjectData od = fObjSvc.create(null, repositoryId, properties, folderId, contentStream, versioningState, policies, extension, null);
+		ObjectData od = fObjSvc.create(getCallContext(), repositoryId, properties, folderId, contentStream, versioningState, policies, extension, null);
 		return od.getId();
 
 	}
@@ -211,148 +212,125 @@ public class InMemoryService  extends Ab
 	public String createDocument(String repositoryId, Properties properties, String folderId,
 			ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
 			Acl removeAces, ExtensionsData extension) {
-//		super.createDocument(repositoryId, properties, folderId, contentStream, versioningState, policies, addAces, removeAces, extension);
-		return fObjSvc.createDocument(null, repositoryId, properties, folderId, contentStream, versioningState, policies, addAces, removeAces, 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) {
-//		super.createDocumentFromSource(repositoryId, sourceId, properties, folderId, versioningState, policies, addAces, removeAces, extension);
-		return fObjSvc.createDocumentFromSource(null, repositoryId, sourceId, properties, folderId, versioningState, policies, addAces, removeAces, 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) {
-//		super.createFolder(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-		return fObjSvc.createFolder(null, repositoryId, properties, folderId, policies, addAces, removeAces, 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) {
-//		super.createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-		return fObjSvc.createPolicy(null, repositoryId, properties, folderId, policies, addAces, removeAces, 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) {
-//		super.createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
-		return fObjSvc.createRelationship(null, repositoryId, properties, policies, addAces, removeAces, extension);
+		return fObjSvc.createRelationship(getCallContext(), repositoryId, properties, policies, addAces, removeAces, extension);
 	}
 
 	public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
 			ExtensionsData extension) {
-//		super.deleteContentStream(repositoryId, objectId, changeToken, extension);
-		fObjSvc.deleteContentStream(null, repositoryId, objectId, changeToken, extension);
+		fObjSvc.deleteContentStream(getCallContext(), repositoryId, objectId, changeToken, extension);
 	}
 
 	public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
-//		super.deleteObject(repositoryId, objectId, allVersions, extension);
-		fObjSvc.deleteObjectOrCancelCheckOut(null, repositoryId, objectId, allVersions, extension);
+		fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
 	}
 
 	public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
 			ExtensionsData extension) {
-//		super.deleteObjectOrCancelCheckOut(repositoryId, objectId, allVersions, extension);
-		fObjSvc.deleteObjectOrCancelCheckOut(null, repositoryId, objectId, allVersions, extension);
+		fObjSvc.deleteObjectOrCancelCheckOut(getCallContext(), repositoryId, objectId, allVersions, extension);
 	}
 
 	public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
 			UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
-//		super.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
-		return fObjSvc.deleteTree(null, repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
+		return fObjSvc.deleteTree(getCallContext(), repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
 	}
 
 	public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
-//		super.getAllowableActions(repositoryId, objectId, extension);
-		return fObjSvc.getAllowableActions(null, repositoryId, objectId, extension);
+		return fObjSvc.getAllowableActions(getCallContext(), repositoryId, objectId, extension);
 	}
 
 	public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
 			BigInteger length, ExtensionsData extension) {
-//		super.getContentStream(repositoryId, objectId, streamId, offset, length, extension);
-		return fObjSvc.getContentStream(null, repositoryId, objectId, streamId, offset, length, 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(null, repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
+		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) {
-//		super.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
-		return fObjSvc.getObjectByPath(null, repositoryId, path, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
+		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) {
-//		super.getProperties(repositoryId, objectId, filter, extension);
-		return fObjSvc.getProperties(null, repositoryId, objectId, filter, 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) {
-//		super.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
-		return fObjSvc.getRenditions(null, repositoryId, objectId, renditionFilter, maxItems, skipCount, 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) {
-//		super.moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
-		fObjSvc.moveObject(null, repositoryId, objectId, targetFolderId, sourceFolderId, extension, null);
+		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) {
-//		super.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
-		fObjSvc.setContentStream(null, repositoryId, objectId, overwriteFlag, changeToken, contentStream, 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) {
-//		super.updateProperties(repositoryId, objectId, changeToken, properties, extension);
-		fObjSvc.updateProperties(null, repositoryId, objectId, changeToken, properties, null, extension, null);
+		fObjSvc.updateProperties(getCallContext(), repositoryId, objectId, changeToken, properties, null, extension, null);
 	}
 
 	// --- versioning service ---
 
 	public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
-//		super.cancelCheckOut(repositoryId, objectId, extension);
-		fVerSvc.cancelCheckOut(null, repositoryId, objectId, 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) {
-//		super.checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment, policies, addAces, removeAces, extension);
-		fVerSvc.checkIn(null, repositoryId, objectId, major, properties, contentStream, checkinComment, policies, addAces, removeAces, extension, null);
+		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) {
-//		super.checkOut(repositoryId, objectId, extension, contentCopied);
-		fVerSvc.checkOut(null, repositoryId, objectId, extension, contentCopied, null);
+		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) {
-//		super.getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
-		return fVerSvc.getObjectOfLatestVersion(null, repositoryId, versionSeriesId, major, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension, null);
+		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) {
-//		super.getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter, extension);
-		return fVerSvc.getPropertiesOfLatestVersion(null, repositoryId, versionSeriesId, major, filter, 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) {
-//		super.getAllVersions(repositoryId, objectId, versionSeriesId, filter, includeAllowableActions, extension);
-		return fVerSvc.getAllVersions(null, repositoryId, versionSeriesId, filter, includeAllowableActions, extension, null);
+		return fVerSvc.getAllVersions(getCallContext(), repositoryId, versionSeriesId, filter, includeAllowableActions, extension, null);
 	}
 
 	// --- discovery service ---
@@ -372,13 +350,11 @@ public class InMemoryService  extends Ab
 
 	public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
 			ExtensionsData extension) {
-//		super.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
-		fMultiSvc.addObjectToFolder(null, repositoryId, objectId, folderId, allVersions, extension, null);
+		fMultiSvc.addObjectToFolder(getCallContext(), repositoryId, objectId, folderId, allVersions, extension, null);
 	}
 
 	public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
-//		super.removeObjectFromFolder(repositoryId, objectId, folderId, extension);
-		fMultiSvc.removeObjectFromFolder(null, repositoryId, objectId, folderId, extension, null);
+		fMultiSvc.removeObjectFromFolder(getCallContext(), repositoryId, objectId, folderId, extension, null);
 	}
 
 	// --- relationship service ---
@@ -522,7 +498,7 @@ public class InMemoryService  extends Ab
 		// 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());
+//		RuntimeContext.attachCfg(new DummyCallContext());
 
 		// Build the tree
 		RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null);

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=936243&r1=936242&r2=936243&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 Wed Apr 21 10:13:00 2010
@@ -39,7 +39,8 @@ public class InMemoryServiceFactoryImpl 
 	private static CallContext OVERRIDE_CTX;
 
 	private InMemoryService inMemoryService;
-	private CmisService wrapperService;
+//	private CmisServiceWrapper<InMemoryService> wrapperService;
+	private ThreadLocal<CmisServiceWrapper<InMemoryService>> threadLocalService = new ThreadLocal<CmisServiceWrapper<InMemoryService>>();
 	private boolean fUseOverrideCtx = false;
 	
 	@Override
@@ -48,8 +49,8 @@ public class InMemoryServiceFactoryImpl 
 
 
 		inMemoryService = new InMemoryService(parameters);
-		wrapperService = new CmisServiceWrapper(inMemoryService, DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES,
-				DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
+//		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;
@@ -63,23 +64,34 @@ public class InMemoryServiceFactoryImpl 
 	
 	@Override
 	public CmisService getService(CallContext context) {
-		try {
-			LOG.debug("start getService()");
+		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) {
-				RuntimeContext.attachCfg(OVERRIDE_CTX);
-			} else {
-				RuntimeContext.attachCfg(context);				
-			}
-			LOG.debug("stop getService()");
-			return inMemoryService; //wrapperService;
-			
-		} finally {
-//			RuntimeContext.remove();
+		// 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=936243&r1=936242&r2=936243&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 Wed Apr 21 10:13:00 2010
@@ -63,7 +63,7 @@ public class InMemoryVersioningServiceIm
 	public void cancelCheckOut(CallContext context, String repositoryId, String objectId, ExtensionsData extension) {
 
 		StoredObject so = checkStandardParameters(repositoryId, objectId);
-		String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+		String user = context.getUsername();
 		VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
 		verDoc.cancelCheckOut(user);
@@ -74,7 +74,7 @@ public class InMemoryVersioningServiceIm
 			Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
 		StoredObject so = checkStandardParameters(repositoryId, objectId.getValue());
-		String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+		String user = context.getUsername();
 		VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
 		DocumentVersion pwc = verDoc.getPwc();
@@ -91,8 +91,8 @@ public class InMemoryVersioningServiceIm
 		// additional information:
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false, IncludeRelationships.NONE,
-				null, false, false, extension);
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+				IncludeRelationships.NONE, null, false, false, extension);
 
 		return od;
 	}
@@ -123,7 +123,7 @@ public class InMemoryVersioningServiceIm
 		if (verDoc.isCheckedOut())
 			throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
 
-		String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+		String user = context.getUsername();
 		checkHasUser(user);
 
 		DocumentVersion pwc = verDoc.checkOut(content, user);
@@ -133,8 +133,8 @@ public class InMemoryVersioningServiceIm
 		// additional information:
 		fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfos);
 
-		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, false, IncludeRelationships.NONE,
-				null, false, false, extension);
+		ObjectData od = PropertyCreationHelper.getObjectData(fStoreManager, so, null, user, false,
+				IncludeRelationships.NONE, null, false, false, extension);
 
 		return od;
 	}

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.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/ServiceFactory.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/ServiceFactory.java Wed Apr 21 10:13:00 2010
@@ -261,7 +261,7 @@ public class ServiceFactory extends Abst
 		// 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());
+//		RuntimeContext.attachCfg(new DummyCallContext());
 
 		// Build the tree
 		RepositoryInfo rep = repSvc.getRepositoryInfo(repositoryId, null);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.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/types/PropertyCreationHelper.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Wed Apr 21 10:13:00 2010
@@ -231,7 +231,7 @@ public class PropertyCreationHelper {
 		return props;
 	}
 
-	public static ObjectData getObjectData(StoreManager sm, StoredObject so, String filter,
+	public static ObjectData getObjectData(StoreManager sm, StoredObject so, String filter, String user,
 			Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
 			Boolean includePolicyIds, Boolean includeACL, ExtensionsData extension) {
 
@@ -247,7 +247,7 @@ public class PropertyCreationHelper {
 		// fill output object
 		if (null != includeAllowableActions && includeAllowableActions) {
 			ObjectStore objectStore = sm.getObjectStore(so.getRepositoryId());
-			AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(objectStore, so);
+			AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(objectStore, so, user);
 			od.setAllowableActions(allowableActions);
 		}
 		if (null != includeACL && includeACL)

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTst.java Wed Apr 21 10:13:00 2010
@@ -96,7 +96,7 @@ public class AbstractServiceTst /* exten
 		fTestCallContext = new DummyCallContext();
 		// Attach a standatrd CallContext to a thread before the services are
 		// initialized.
-		RuntimeContext.attachCfg(fTestCallContext);
+//		RuntimeContext.attachCfg(fTestCallContext);
 
 		if (fUseClientProviderInterface)
 			initializeUsingLocalBinding(parameters);

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.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/ReadOnlyObjectIT.java?rev=936243&r1=936242&r2=936243&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java (original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/runtime/ReadOnlyObjectIT.java Wed Apr 21 10:13:00 2010
@@ -67,9 +67,9 @@ public class ReadOnlyObjectIT extends Ab
 		Assert.assertEquals(ObjectType.FOLDER_BASETYPE_ID, folder.getBaseType().getId());
 
 		Assert.assertNotNull(folder.getCreatedBy());
-//		Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getCreatedBy());
+		Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getCreatedBy());
 		Assert.assertNotNull(folder.getLastModifiedBy());
-//		Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getLastModifiedBy());
+		Assert.assertEquals(Fixture.getParamter().get(SessionParameter.USER), folder.getLastModifiedBy());
 		Assert.assertNotNull(folder.getLastModificationDate());
 		Assert.assertNotNull(folder.getCreationDate());
 



Mime
View raw message