Author: remi
Date: 2009-06-09 14:26:04 +0200 (Tue, 09 Jun 2009)
New Revision: 4759
Added:
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreterContext.py
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/PluginCommand.py
Log:
* added the "plugin interpreter context" class
* added some command attributes
* updated the plugin interpretation by contexts
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-09 12:24:30 UTC (rev 4758)
+++
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/Plugin.py
2009-06-09 12:26:04 UTC (rev 4759)
@@ -13,6 +13,7 @@
from interpreters.PluginInterpreter import PluginInterpreter
from interpreters.PluginInterpreterPython import PluginInterpreterPython
from interpreters.PluginInterpreterJava import PluginInterpreterJava
+from interpreters.PluginInterpreterContext import PluginInterpreterContext
from PluginDescription import PluginDescription
from PluginParameter import PluginParameter
from PluginCommand import PluginCommand
@@ -167,12 +168,8 @@
'class' : interpreterClass,
'executable' : dictionary['interpreter']['executable'],
}
- self.__pluginInterpreter = None
+ self.__pluginInterpreterContexts = []
self.__interpreterMutex = threading.Lock()
- # Define Plugin Instance Parameters
- self.__pluginInstanceParameters = {}
- self.__pluginInstanceCommand = ""
- self.__pluginInstanceIsDaemon = False
# Callbacks
self.__onPluginNotificationCallback = None
self.__onPluginMessageCallback = None
@@ -459,10 +456,12 @@
"""Get if the current running instance is in daemon mode or not.
@return: True or False.
"""
- self.__interpreterMutex.acquire()
- isDaemon = self.__pluginInstanceIsDaemon
- self.__interpreterMutex.release()
- return isDaemon
+ print "GET INSTANCE IS DAEMON (from Plugin object)"
+ #if self.__pluginInterpreterContext != None:
+ # isDaemon = self.__pluginInterpreterContext.isDaemon()
+ #else:
+ # isDaemon = False
+ return False
#
==========================================================================
# I18N
@@ -533,7 +532,7 @@
"""Set the plugin notification event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginNotification(plugin, instanceParameters, messageId, *args):
+ def onPluginNotification(pluginInterpreterContext, messageId, *args):
pass
"""
self.__onPluginNotificationCallback = funct
@@ -545,7 +544,7 @@
"""Set the plugin message event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginMessage(plugin, instanceParameters, message):
+ def onPluginMessage(pluginInterpreterContext, message):
pass
"""
self.__onPluginMessageCallback = funct
@@ -557,7 +556,7 @@
"""Set the plugin error event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginError(plugin, instanceParameters, *messagesList):
+ def onPluginError(pluginInterpreterContext, *messagesList):
pass
"""
self.__onPluginErrorCallback = funct
@@ -569,7 +568,7 @@
"""Set the plugin trace event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginTrace(plugin, instanceParameters, *messagesList):
+ def onPluginTrace(pluginInterpreterContext, *messagesList):
pass
"""
self.__onPluginTraceCallback = funct
@@ -581,7 +580,7 @@
"""Set the plugin result event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginResult(plugin, instanceParameters, pluginResult):
+ def onPluginResult(pluginInterpreterContext, pluginResult):
pass
"""
self.__onPluginResultCallback = funct
@@ -593,7 +592,7 @@
"""Set the plugin actuation event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginActuation(plugin, instanceParameters, *messagesList):
+ def onPluginActuation(pluginInterpreterContext, *messagesList):
pass
"""
self.__onPluginActuationCallback = funct
@@ -605,7 +604,7 @@
"""Set the plugin starting event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginStarting(plugin, instanceParameters):
+ def onPluginStarting(pluginInterpreterContext):
pass
"""
self.__onPluginStartingCallback = funct
@@ -617,74 +616,12 @@
"""Set the plugin stopped event callback.
@param funct: Function pointer.
Function prototype:
- def onPluginStopped(plugin, instanceParameters):
+ def onPluginStopped(pluginInterpreterContext):
pass
"""
self.__onPluginStoppedCallback = funct
#
--------------------------------------------------------------------------
- # Event on plugin interpreter started.
- #
--------------------------------------------------------------------------
- def __onInterpreterStarted(self):
- """Event on plugin interpreter started.
- """
- if self.__onPluginStartingCallback != None:
- self.__onPluginStartingCallback(self,
self.__pluginInstanceParameters,
- self.__pluginInstanceCommand, self.__pluginInstanceIsDaemon)
-
- #
--------------------------------------------------------------------------
- # Event on plugin interpreter stopped.
- #
--------------------------------------------------------------------------
- def __onInterpreterStopped(self):
- """Event on plugin interpreter stopped.
- """
- if self.__onPluginStoppedCallback != None:
- self.__onPluginStoppedCallback(self,
self.__pluginInstanceParameters,
- self.__pluginInstanceCommand, self.__pluginInstanceIsDaemon)
-
- #
--------------------------------------------------------------------------
- # Event on plugin interpreter notification.
- #
--------------------------------------------------------------------------
- def __onInterpreterNotification(self, messageId, *args):
- """Event on plugin interpreter notification.
- @param messageId: Message identifiant as string.
- @param args: Arguments of the notification.
- """
- messageId = messageId.lower()
- if messageId == "message":
- language = self.__pluginInstanceParameters['language']
- if self.__onPluginMessageCallback != None:
- self.__onPluginMessageCallback(self,
- self.__pluginInstanceParameters, self.tr2(language, *args))
- elif messageId == "trace":
- if self.__onPluginTraceCallback != None:
- self.__onPluginTraceCallback(self,
- self.__pluginInstanceParameters, *args)
- elif messageId == "error":
- if self.__onPluginErrorCallback != None:
- self.__onPluginErrorCallback(self,
- self.__pluginInstanceParameters, *args)
- elif messageId == "check_result":
- if self.__onPluginResultCallback != None:
- if len(args) > 0:
- if args[0] == "true":
- checkResult = True
- else:
- checkResult = False
- else:
- checkResult = False
- self.__onPluginResultCallback(self,
- self.__pluginInstanceParameters, checkResult)
- elif messageId == "actuation":
- if self.__onPluginActuationCallback != None:
- self.__onPluginActuationCallback(self,
- self.__pluginInstanceParameters, *args)
- else:
- if self.__onPluginNotificationCallback != None:
- self.__onPluginNotificationCallback(self,
- self.__pluginInstanceParameters, messageId, *args)
-
- #
--------------------------------------------------------------------------
# Start this plugin.
#
--------------------------------------------------------------------------
def start(self, command, parameters = {}):
@@ -697,17 +634,27 @@
- If a parameter is wrong the default one is set.
- If a parameter is missing the default one is set.
"""
- self.__interpreterMutex.acquire()
- # Stop the last interpreter
- if self.__pluginInterpreter != None:
- self.__pluginInterpreter.abort()
# Create the interpreter
- self.__pluginInterpreter = self.__interpreterConf['class']()
-
self.__pluginInterpreter.setOnPluginStartedCallback(self.__onInterpreterStarted)
-
self.__pluginInterpreter.setOnPluginStoppedCallback(self.__onInterpreterStopped)
-
self.__pluginInterpreter.setOnNotificationThrowedCallback(self.__onInterpreterNotification)
- self.__pluginInterpreter.setWorkingPath(self.getWorkingPath())
-
self.__pluginInterpreter.setExecutable(self.__interpreterConf['executable'])
+ pluginInterpreterContext = PluginInterpreterContext(self,
+ self.__interpreterConf['class'],
+ self.__interpreterConf['executable'])
+ # Set callbacks
+ pluginInterpreterContext.setOnPluginNotificationCallback(
+ self.__onPluginNotificationCallback)
+ pluginInterpreterContext.setOnPluginMessageCallback(
+ self.__onPluginMessageCallback)
+ pluginInterpreterContext.setOnPluginErrorCallback(
+ self.__onPluginErrorCallback)
+ pluginInterpreterContext.setOnPluginTraceCallback(
+ self.__onPluginTraceCallback)
+ pluginInterpreterContext.setOnPluginResultCallback(
+ self.__onPluginResultCallback)
+ pluginInterpreterContext.setOnPluginActuationCallback(
+ self.__onPluginActuationCallback)
+ pluginInterpreterContext.setOnPluginStartingCallback(
+ self.__onPluginStartingCallback)
+ pluginInterpreterContext.setOnPluginStoppedCallback(
+ self.__onPluginStoppedCallback)
# Fill the parameters
if parameters.has_key('language'):
language = parameters['language']
@@ -725,18 +672,19 @@
parameters[parameterName], language)
continue
pluginParameters[parameterName] = parameters[parameterName]
- self.__pluginInterpreter.setParameters(pluginParameters)
- self.__pluginInstanceParameters = pluginParameters
+ pluginInterpreterContext.setInstanceParameters(pluginParameters)
# Get the command
pluginCommand = self.getCommand(command)
if pluginCommand == None:
pluginCommand = self.getCommands()[0]
- self.__pluginInstanceIsDaemon = pluginCommand.isDaemon()
- self.__pluginInstanceCommand = pluginCommand.getName()
- # Execute the plugin
- self.__pluginInterpreter.run(pluginCommand.getName(),
- pluginCommand.isDaemon())
+
pluginInterpreterContext.setInstanceCommandName(pluginCommand.getName())
+ pluginInterpreterContext.setInstanceIsDaemon(pluginCommand.isDaemon())
+ # Add the interperter context in the list
+ self.__interpreterMutex.acquire()
+ self.__pluginInterpreterContexts.append(pluginInterpreterContext)
self.__interpreterMutex.release()
+ # Execute the plugin instance
+ pluginInterpreterContext.run()
return True
#
--------------------------------------------------------------------------
@@ -746,9 +694,9 @@
"""Stop the plugin.
"""
self.__interpreterMutex.acquire()
- # Stop the last interpreter
- if self.__pluginInterpreter != None:
- self.__pluginInterpreter.abort()
+ for pluginInterpreterContext in self.__pluginInterpreterContexts:
+ pluginInterpreterContext.abort()
+ self.__pluginInterpreterContexts = []
self.__interpreterMutex.release()
#
--------------------------------------------------------------------------
@@ -760,6 +708,6 @@
@eventValues: Event values list.
"""
self.__interpreterMutex.acquire()
- if self.__pluginInterpreter != None:
- self.__pluginInterpreter.sendEvent(eventName, eventValues)
+ for pluginInterpreterContext in self.__pluginInterpreterContexts:
+ pluginInterpreterContext.sendEvent(eventName, eventValues)
self.__interpreterMutex.release()
Modified:
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginCommand.py
===================================================================
---
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginCommand.py
2009-06-09 12:24:30 UTC (rev 4758)
+++
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/PluginCommand.py
2009-06-09 12:26:04 UTC (rev 4759)
@@ -28,6 +28,21 @@
if self.__dictionary.has_key('daemon'):
self.__daemon = self.__dictionary['daemon'].lower()
self.__description = self.__dictionary['description']
+ self.__exclusive = "false"
+ if self.__dictionary.has_key('exclusive'):
+ self.__exclusive = self.__dictionary['exclusive'].lower()
+ self.__critical = "false"
+ if self.__dictionary.has_key('critical'):
+ self.__critical = self.__dictionary['critical'].lower()
+ self.__expiration = "0"
+ if self.__dictionary.has_key('expiration'):
+ self.__expiration = self.__dictionary['expiration'].lower()
+ self.__notifier = "false"
+ if self.__dictionary.has_key('notifier'):
+ self.__notifier = self.__dictionary['notifier'].lower()
+ self.__allUserButtons = "false"
+ if self.__dictionary.has_key('allUserButtons'):
+ self.__allUserButtons = self.__dictionary['allUserButtons'].lower()
#
--------------------------------------------------------------------------
# Get the parent plugin.
@@ -60,6 +75,63 @@
return True
#
--------------------------------------------------------------------------
+ # Get if this plugin command is exclusive or not.
+ #
--------------------------------------------------------------------------
+ def isExclusive(self):
+ """Get if this plugin command is exclusive or not.
+ @return: A boolean.
+ """
+ if self.__exclusive == "false":
+ return False
+ else:
+ return True
+
+ #
--------------------------------------------------------------------------
+ # Get if this plugin command is critical or not.
+ #
--------------------------------------------------------------------------
+ def isCritical(self):
+ """Get if this plugin command is critical or not.
+ @return: A boolean.
+ """
+ if self.__critical == "false":
+ return False
+ else:
+ return True
+
+ #
--------------------------------------------------------------------------
+ # Get the expiration delay of the command.
+ #
--------------------------------------------------------------------------
+ def getExpirationDelay(self):
+ """Get the expiration delay of the command.
+ @return: A boolean.
+ """
+ return int(self.__expiration)
+
+ #
--------------------------------------------------------------------------
+ # Get if this plugin command is a daemon notifier or not.
+ #
--------------------------------------------------------------------------
+ def isNotifier(self):
+ """Get if this plugin command is a daemon notifier or not.
+ @return: A boolean.
+ """
+ if self.__notifier == "false":
+ return False
+ else:
+ return True
+
+ #
--------------------------------------------------------------------------
+ # Get if this plugin command need all user buttons or not.
+ #
--------------------------------------------------------------------------
+ def needAllUserButtons(self):
+ """Get if this plugin command need all user buttons or not.
+ @return: A boolean.
+ """
+ if self.__allUserButtons == "false":
+ return False
+ else:
+ return True
+
+ #
--------------------------------------------------------------------------
# Get the translated name.
#
--------------------------------------------------------------------------
def getTranslatedName(self, language = None):
Added:
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreterContext.py
===================================================================
---
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreterContext.py
(rev 0)
+++
software_suite_v3/smart-core/smart-server/trunk/util/applicationserver/plugin/interpreters/PluginInterpreterContext.py
2009-06-09 12:26:04 UTC (rev 4759)
@@ -0,0 +1,303 @@
+# Copyright (C) 2009 C2ME Sa
+# Remi Jocaille <[email protected]>
+# Distributed under the terms of the GNU General Public License
+# http://www.gnu.org/copyleft/gpl.html
+
+#
------------------------------------------------------------------------------
+# PluginInterpreterContext class.
+#
------------------------------------------------------------------------------
+class PluginInterpreterContext(object):
+ """PluginInterpreterContext class.
+ """
+
+ #
--------------------------------------------------------------------------
+ # Contructor of the class.
+ #
--------------------------------------------------------------------------
+ def __init__(self, parent, interpreterClass, interpreterExecution):
+ """Contructor of the class.
+ @param parent: Parent plugin.
+ @param interpreterClass: Interpreter class.
+ @param interpreterExecution: Interpreter execution.
+ """
+ self.__parentPlugin = parent
+ self.__pluginInterpreter = interpreterClass()
+
self.__pluginInterpreter.setOnPluginStartedCallback(self.__onInterpreterStarted)
+
self.__pluginInterpreter.setOnPluginStoppedCallback(self.__onInterpreterStopped)
+
self.__pluginInterpreter.setOnNotificationThrowedCallback(self.__onInterpreterNotification)
+
self.__pluginInterpreter.setWorkingPath(self.__parentPlugin.getWorkingPath())
+ self.__pluginInterpreter.setExecutable(interpreterExecution)
+ self.__pluginInstanceParameters = {}
+ self.__pluginInstanceCommand = ""
+ self.__pluginInstanceIsDaemon = False
+ # Callbacks
+ self.__onPluginNotificationCallback = None
+ self.__onPluginMessageCallback = None
+ self.__onPluginErrorCallback = None
+ self.__onPluginTraceCallback = None
+ self.__onPluginResultCallback = None
+ self.__onPluginActuationCallback = None
+ self.__onPluginStartingCallback = None
+ self.__onPluginStoppedCallback = None
+
+ #
--------------------------------------------------------------------------
+ # Set the instance parameters.
+ #
--------------------------------------------------------------------------
+ def setInstanceParameters(self, parameters):
+ """Set the instance parameters.
+ @param parameters: Parameters as dictionary.
+ """
+ self.__pluginInstanceParameters = parameters
+ self.__pluginInterpreter.setParameters(parameters)
+
+ #
--------------------------------------------------------------------------
+ # Get the instance parameters.
+ #
--------------------------------------------------------------------------
+ def getInstanceParameters(self):
+ """Get the instance parameters.
+ @return: A dictionary.
+ """
+ return self.__pluginInstanceParameters
+
+ #
--------------------------------------------------------------------------
+ # Get the parent plugin.
+ #
--------------------------------------------------------------------------
+ def getParentPlugin(self):
+ """Get the parent plugin.
+ @return: A Plugin object.
+ """
+ return self.__parentPlugin
+
+ #
--------------------------------------------------------------------------
+ # Get the host uuid.
+ #
--------------------------------------------------------------------------
+ def getHostUuid(self):
+ """Get the host uuid.
+ @return: A string.
+ """
+ if self.__pluginInstanceParameters.has_key('uuid'):
+ return self.__pluginInstanceParameters['uuid']
+ else:
+ return self.__parentPlugin.getDescription().getUuid()
+
+ #
--------------------------------------------------------------------------
+ # Set the instance command name.
+ #
--------------------------------------------------------------------------
+ def setInstanceCommandName(self, command):
+ """Set the instance command name.
+ @param command: Command name.
+ """
+ self.__pluginInstanceCommand = command
+
+ #
--------------------------------------------------------------------------
+ # Get the instance command name.
+ #
--------------------------------------------------------------------------
+ def getInstanceCommandName(self):
+ """Get the instance command name.
+ @return: A string.
+ """
+ return self.__pluginInstanceCommand
+
+ #
--------------------------------------------------------------------------
+ # Set if the instance is a daemon or not.
+ #
--------------------------------------------------------------------------
+ def setInstanceIsDaemon(self, isDaemon):
+ """Set if the instance is a daemon or not.
+ @param isDaemon: Is daemon or not.
+ """
+ self.__pluginInstanceIsDaemon = isDaemon
+
+ #
--------------------------------------------------------------------------
+ # Get if the instance is a daemon or not.
+ #
--------------------------------------------------------------------------
+ def instanceIsDaemon(self):
+ """Get if the instance is a daemon or not.
+ @return: A boolean.
+ """
+ return self.__pluginInstanceIsDaemon
+
+ #
--------------------------------------------------------------------------
+ # Execute the interpreter.
+ #
--------------------------------------------------------------------------
+ def run(self):
+ """Execute the interpreter.
+ """
+ self.__pluginInterpreter.run(self.__pluginInstanceCommand,
+ self.__pluginInstanceIsDaemon)
+
+ #
--------------------------------------------------------------------------
+ # Abort the execution of the interpreter.
+ #
--------------------------------------------------------------------------
+ def abort(self):
+ """Abort the execution of the interpreter.
+ """
+ self.__pluginInterpreter.abort()
+
+ #
--------------------------------------------------------------------------
+ # 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.__pluginInterpreter.sendEvent(eventName, eventValues)
+
+ #
--------------------------------------------------------------------------
+ # Get if the interpreter run or not.
+ #
--------------------------------------------------------------------------
+ def isRun(self):
+ """Get if the interpreter run or not.
+ @return: A boolean.
+ """
+ return self.__pluginInterpreter.isRun()
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin notification event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginNotificationCallback(self, funct):
+ """Set the plugin notification event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginNotification(pluginInterpreterContext, messageId, *args):
+ pass
+ """
+ self.__onPluginNotificationCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin message event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginMessageCallback(self, funct):
+ """Set the plugin message event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginMessage(pluginInterpreterContext, message):
+ pass
+ """
+ self.__onPluginMessageCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin error event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginErrorCallback(self, funct):
+ """Set the plugin error event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginError(pluginInterpreterContext, *messagesList):
+ pass
+ """
+ self.__onPluginErrorCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin trace event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginTraceCallback(self, funct):
+ """Set the plugin trace event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginTrace(pluginInterpreterContext, *messagesList):
+ pass
+ """
+ self.__onPluginTraceCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin result event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginResultCallback(self, funct):
+ """Set the plugin result event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginResult(pluginInterpreterContext, pluginResult):
+ pass
+ """
+ self.__onPluginResultCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin actuation event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginActuationCallback(self, funct):
+ """Set the plugin actuation event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginActuation(pluginInterpreterContext, *messagesList):
+ pass
+ """
+ self.__onPluginActuationCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin starting event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginStartingCallback(self, funct):
+ """Set the plugin starting event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginStarting(pluginInterpreterContext):
+ pass
+ """
+ self.__onPluginStartingCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Set the plugin stopped event callback.
+ #
--------------------------------------------------------------------------
+ def setOnPluginStoppedCallback(self, funct):
+ """Set the plugin stopped event callback.
+ @param funct: Function pointer.
+ Function prototype:
+ def onPluginStopped(pluginInterpreterContext):
+ pass
+ """
+ self.__onPluginStoppedCallback = funct
+
+ #
--------------------------------------------------------------------------
+ # Event on plugin interpreter started.
+ #
--------------------------------------------------------------------------
+ def __onInterpreterStarted(self):
+ """Event on plugin interpreter started.
+ """
+ if self.__onPluginStartingCallback != None:
+ self.__onPluginStartingCallback(self)
+
+ #
--------------------------------------------------------------------------
+ # Event on plugin interpreter stopped.
+ #
--------------------------------------------------------------------------
+ def __onInterpreterStopped(self):
+ """Event on plugin interpreter stopped.
+ """
+ if self.__onPluginStoppedCallback != None:
+ self.__onPluginStoppedCallback(self)
+
+ #
--------------------------------------------------------------------------
+ # Event on plugin interpreter notification.
+ #
--------------------------------------------------------------------------
+ def __onInterpreterNotification(self, messageId, *args):
+ """Event on plugin interpreter notification.
+ @param messageId: Message identifiant as string.
+ @param args: Arguments of the notification.
+ """
+ messageId = messageId.lower()
+ if messageId == "message":
+ language = self.__pluginInstanceParameters['language']
+ if self.__onPluginMessageCallback != None:
+ self.__onPluginMessageCallback(self,
+ self.getParentPlugin().tr2(language, *args))
+ elif messageId == "trace":
+ if self.__onPluginTraceCallback != None:
+ self.__onPluginTraceCallback(self, *args)
+ elif messageId == "error":
+ if self.__onPluginErrorCallback != None:
+ self.__onPluginErrorCallback(self, *args)
+ elif messageId == "check_result":
+ if self.__onPluginResultCallback != None:
+ if len(args) > 0:
+ if args[0] == "true":
+ checkResult = True
+ else:
+ checkResult = False
+ else:
+ checkResult = False
+ self.__onPluginResultCallback(self, checkResult)
+ elif messageId == "actuation":
+ if self.__onPluginActuationCallback != None:
+ self.__onPluginActuationCallback(self, *args)
+ else:
+ if self.__onPluginNotificationCallback != None:
+ self.__onPluginNotificationCallback(self, messageId, *args)
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn