Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10624
Modified Files:
ChangeLog ObjectStoreCoordinator.py
Log Message:
ObjectStoreCoordinator.objectStoreForEntityName(): added
Index: ObjectStoreCoordinator.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ObjectStoreCoordinator.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** ObjectStoreCoordinator.py 20 Jul 2004 06:21:37 -0000 1.14
--- ObjectStoreCoordinator.py 25 Feb 2006 13:08:08 -0000 1.15
***************
*** 243,246 ****
--- 243,283 ----
self.unlock()
+ def _objectStoreForEntityName(self, entityName):
+ """
+ Private method returning the 1st cooperating store answering positively
+ to message `ownsEntityName`. Called by `objectStoreForEntityName`.
+
+ Note: This method does not lock self. Do not call this by hand in a
+ multi-threaded env.
+
+ """
+ for store in self._cooperatingObjectStores:
+ if store.ownsEntityName(entityName):
+ return store
+ return None
+
+ def objectStoreForEntityName(self, entityName):
+ """
+ Iterates on objectStores and returns the first one who answers positively
+ to message 'ownsEntityName'
+
+ Posts 'CooperatingObjectStoreNeeded' in case no store can be found at
+ first glance, so that listeners get a chance to register an adequate
+ 'CooperatingObjectStore' ; then the requested 'ObjectStore' is returned,
+ or 'None' if it still cannot be found.
+ """
+ self.lock()
+ try:
+ store=self._objectStoreForEntityName(entityName)
+ if store is not None:
+ return store
+ # We need one, let the observers have a chance to register it
+ NC.postNotification(CooperatingObjectStoreNeededNotification,
+ self,
+ {'entityName': entityName})
+ return self._objectStoreForEntityName(entityName)
+ finally:
+ self.unlock()
+
def _objectStoreForGlobalID(self, aGlobalID):
"""
Index: ChangeLog
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ChangeLog,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ChangeLog 3 May 2005 15:12:05 -0000 1.7
--- ChangeLog 25 Feb 2006 13:08:08 -0000 1.8
***************
*** 1,2 ****
--- 1,7 ----
+ 2006-02-25 Sebastien Bigaret <Seb...@en...>
+
+ * ObjectStoreCoordinator.py
+ (ObjectStoreCoordinator.objectStoreForEntityName): added
+
2005-05-03 Sebastien Bigaret <sbi...@us...>
|