Author: remi
Date: 2009-06-02 10:16:39 +0200 (Tue, 02 Jun 2009)
New Revision: 4719

Modified:
   
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/Gadget.py
   
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
   
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreter.py
   
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
Log:
* added method to send events to the plugins

Modified: 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/Gadget.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/Gadget.py
     2009-06-01 10:27:36 UTC (rev 4718)
+++ 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/gadget/Gadget.py
     2009-06-02 08:16:39 UTC (rev 4719)
@@ -503,3 +503,13 @@
         """Stop the gadget.
         """
         self.__parentPlugin.stop()
+
+    # 
--------------------------------------------------------------------------
+    # Send event to the gadget. (Daemon mode)
+    # 
--------------------------------------------------------------------------
+    def sendEvent(self, eventName, eventValues = []):
+        """Send event to the gadget. (Daemon mode)
+        @eventName: Event name.
+        @eventValues: Event values list.
+        """
+        self.__parentPlugin.sendEvent(eventName, eventValues)

Modified: 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
     2009-06-01 10:27:36 UTC (rev 4718)
+++ 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
     2009-06-02 08:16:39 UTC (rev 4719)
@@ -724,3 +724,16 @@
         if self.__pluginInterpreter != None:
             self.__pluginInterpreter.abort()
         self.__interpreterMutex.release()
+
+    # 
--------------------------------------------------------------------------
+    # Send event to the plugin. (Daemon mode)
+    # 
--------------------------------------------------------------------------
+    def sendEvent(self, eventName, eventValues = []):
+        """Send event to the plugin. (Daemon mode)
+        @eventName: Event name.
+        @eventValues: Event values list.
+        """
+        self.__interpreterMutex.acquire()
+        if self.__pluginInterpreter != None:
+            self.__pluginInterpreter.sendEvent(eventName, eventValues)
+        self.__interpreterMutex.release()

Modified: 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreter.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreter.py
     2009-06-01 10:27:36 UTC (rev 4718)
+++ 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreter.py
     2009-06-02 08:16:39 UTC (rev 4719)
@@ -223,6 +223,25 @@
             killMe()
 
     # 
--------------------------------------------------------------------------
+    # Send event to the plugin. (Daemon mode)
+    # 
--------------------------------------------------------------------------
+    def sendEvent(self, eventName, eventValues = []):
+        """Send event to the plugin. (Daemon mode)
+        @eventName: Event name.
+        @eventValues: Event values list.
+        """
+        if not self.__getRun():
+            return
+        if not self.__daemon:
+            return
+        eventString = "EVENT:"
+        eventString += eventName
+        for value in eventValues:
+            eventString += ":" + str(value)
+        self.__process.stdin.write("%s\n" % eventString)
+        self.__process.stdin.flush()
+
+    # 
--------------------------------------------------------------------------
     # Loop to handling the stdout messages.
     # 
--------------------------------------------------------------------------
     def __stdOutLoop(self):

Modified: 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
===================================================================
--- 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
   2009-06-01 10:27:36 UTC (rev 4718)
+++ 
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/ugc/Ugc.py
   2009-06-02 08:16:39 UTC (rev 4719)
@@ -397,3 +397,13 @@
         """Stop the Ugc.
         """
         self.__parentGadget.stop()
+
+    # 
--------------------------------------------------------------------------
+    # Send event to the UGC. (Daemon mode)
+    # 
--------------------------------------------------------------------------
+    def sendEvent(self, eventName, eventValues = []):
+        """Send event to the UGC. (Daemon mode)
+        @eventName: Event name.
+        @eventValues: Event values list.
+        """
+        self.__parentGadget.sendEvent(eventName, eventValues)


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to