[Commits] (morgen) Implemented a byMethod endpoint for BlockEvent -- only "non-global" events

commits at osafoundation.org commits at osafoundation.org
Tue Aug 3 12:53:05 PDT 2004


Commit by: morgen
Modified files:
chandler/parcels/osaf/framework/blocks/Block.py 1.55 1.56
chandler/parcels/osaf/framework/blocks/parcel.xml 1.103 1.104
chandler/repository/schema/Cloud.py 1.11 1.12

Log message:
Implemented a byMethod endpoint for BlockEvent -- only "non-global" events
are copied.  Modified Endpoint.getItems( ) to pass the item itself to 
the byMethod method.


ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/Block.py.diff?r1=text&tr1=1.55&r2=text&tr2=1.56
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/framework/blocks/parcel.xml.diff?r1=text&tr1=1.103&r2=text&tr2=1.104
http://cvs.osafoundation.org/index.cgi/chandler/repository/schema/Cloud.py.diff?r1=text&tr1=1.11&r2=text&tr2=1.12

Index: chandler/parcels/osaf/framework/blocks/Block.py
diff -u chandler/parcels/osaf/framework/blocks/Block.py:1.55 chandler/parcels/osaf/framework/blocks/Block.py:1.56
--- chandler/parcels/osaf/framework/blocks/Block.py:1.55	Tue Jul 20 13:03:29 2004
+++ chandler/parcels/osaf/framework/blocks/Block.py	Tue Aug  3 12:53:03 2004
@@ -1,5 +1,5 @@
-__version__ = "$Revision: 1.55 $"
-__date__ = "$Date: 2004/07/20 20:03:29 $"
+__version__ = "$Revision: 1.56 $"
+__date__ = "$Date: 2004/08/03 19:53:03 $"
 __copyright__ = "Copyright (c) 2003 Open Source Applications Foundation"
 __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -300,6 +300,18 @@
 
     
 class BlockEvent(Event):
-    pass
 
+    def includePolicyMethod(self, items, references, cloudAlias):
+        """ Method for handling an endpoint's byMethod includePolicy """
 
+        # Determine if we are a global event
+        globalEvents = Globals.repository.findPath("//parcels/osaf/framework/blocks/Events/GlobalEvents")
+        for event in globalEvents.subscribeAlwaysEvents:
+            if event is self:
+                # Yes, global: don't copy me
+                references[self.itsUUID] = self
+                return []
+
+        # No, not global: copy me
+        items[self.itsUUID] = self
+        return [self]

Index: chandler/repository/schema/Cloud.py
diff -u chandler/repository/schema/Cloud.py:1.11 chandler/repository/schema/Cloud.py:1.12
--- chandler/repository/schema/Cloud.py:1.11	Tue Aug  3 04:25:02 2004
+++ chandler/repository/schema/Cloud.py	Tue Aug  3 12:53:03 2004
@@ -1,6 +1,6 @@
 
-__revision__  = "$Revision: 1.11 $"
-__date__      = "$Date: 2004/08/03 11:25:02 $"
+__revision__  = "$Revision: 1.12 $"
+__date__      = "$Date: 2004/08/03 19:53:03 $"
 __copyright__ = "Copyright (c) 2002 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -284,7 +284,7 @@
 
         policy = self.includePolicy
         results = []
-        
+
         if policy == 'byValue':
             if not item._uuid in items:
                 items[item._uuid] = item
@@ -298,7 +298,7 @@
             def getItems(cloud):
                 results.extend(cloud.getItems(item, items, references,
                                               cloudAlias))
-                               
+
             cloud = self.getAttributeValue('cloud', default=None,
                                            _attrDict=self._references)
             if cloud is not None:
@@ -317,7 +317,8 @@
             method = self.getAttributeValue('method', default=None,
                                             _attrDict=self._values)
             if method is not None:
-                results.extend(getattr(type(item), method)(items, references,
+                results.extend(getattr(type(item), method)(item, items,
+                                                           references,
                                                            cloudAlias))
 
         else:

Index: chandler/parcels/osaf/framework/blocks/parcel.xml
diff -u chandler/parcels/osaf/framework/blocks/parcel.xml:1.103 chandler/parcels/osaf/framework/blocks/parcel.xml:1.104
--- chandler/parcels/osaf/framework/blocks/parcel.xml:1.103	Tue Aug  3 10:32:57 2004
+++ chandler/parcels/osaf/framework/blocks/parcel.xml	Tue Aug  3 12:53:03 2004
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 
-<!-- $Revision: 1.103 $ -->
-<!-- $Date: 2004/08/03 17:32:57 $ -->
+<!-- $Revision: 1.104 $ -->
+<!-- $Date: 2004/08/03 19:53:03 $ -->
 <!-- Copyright (c) 2003 Open Source Applications Foundation -->
 <!-- License: http://osafoundation.org/Chandler_0.1_license_terms.htm -->
 
@@ -344,16 +344,18 @@
             <cloudAlias value="default"/>
         </Endpoint>
         <endpoints ref="docSchema:Block/DefaultCloud/childrenBlocks"/>
-        <Endpoint itsName="subscribeWhenVisibleEvents">
-            <attribute value="subscribeWhenVisibleEvents"/>
-            <includePolicy value="byRef"/>
-        </Endpoint>
-        <endpoints ref="docSchema:Block/DefaultCloud/subscribeWhenVisibleEvents"/>
         <Endpoint itsName="subscribeAlwaysEvents">
             <attribute value="subscribeAlwaysEvents"/>
-            <includePolicy value="byRef"/>
+            <includePolicy value="byMethod"/>
+            <method value="includePolicyMethod"/>
         </Endpoint>
         <endpoints ref="docSchema:Block/DefaultCloud/subscribeAlwaysEvents"/>
+        <Endpoint itsName="subscribeWhenVisibleEvents">
+            <attribute value="subscribeWhenVisibleEvents"/>
+            <includePolicy value="byMethod"/>
+            <method value="includePolicyMethod"/>
+        </Endpoint>
+        <endpoints ref="docSchema:Block/DefaultCloud/subscribeWhenVisibleEvents"/>
     </Cloud>
     <!-- Link this cloud with the Block kind -->
     <clouds alias="default" ref="docSchema:Block/DefaultCloud"/>



More information about the Commits mailing list