public final class ExecutionFallBackManager extends Object implements Plugin, ExecutionListener, ScriptListener, RemoteDesktopServerListener, DisconnectListener
Provides fallback mechanism to handle I/O errors such as for example desktop connection failures experienced at the time of script execution. The class maintains the list of listeners interested in this type of events and notifies them when such a situation is detected. The listeners may then perform any type of custom action, for example to make an attempt to restore the connection or log the failure to a third party logging framework.
The class should not be instantiated directly. Use the static methods instead.
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Constructor and Description |
---|
ExecutionFallBackManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addDisconnectListener(DisconnectListener l)
Add a global disconnect listener which will be notified of a connection
failure in any script executed in this JVM.
|
void |
checkDependencies(PluginManager manager)
Check whether all dependencies are installed.
|
void |
disconnectFallback(ScriptingContext context)
Implementation of the
DisconnectListener interface which performs
the default connection recovery operation. |
void |
executionStarted(ScriptingContext ctx)
Implementation of the
ExecutionListener interface. |
String |
getCode()
Get plugin code.
|
Date |
getDate()
Get plugin release date.
|
String |
getDescription()
Get plugin description to be displayed in the GUI.
|
String |
getDisplayName()
Get short plugin name to be displayed in the GUI.
|
Class |
getImplementedInterface()
Get Class of the exposed functional interface that this plugin implements.
|
int[] |
getLowestSupportedVersion()
Get the lowest required version of T-Plan Robot Enterprise.
|
String |
getMessageAfterInstall()
Get text of a message to be displayed after installation of this plugin.
|
String |
getMessageBeforeInstall()
Get text of a message to be displayed before installation of this plugin.
|
String |
getSupportContact()
Get support contact.
|
String |
getUniqueId()
Get unique ID associated with the plugin.
|
String |
getVendorHomePage()
Get the vendor home page.
|
String |
getVendorName()
Get vendor (provider) name to be displayed in the GUI.
|
int[] |
getVersion()
Get plugin version in form of an integer array.
|
static void |
removeDisconnectListener(DisconnectListener l)
Remove a global disconnect listener.
|
boolean |
requiresRestart()
Indicate whether installation of this plugin requires application restart.
|
void |
scriptEvent(ScriptEvent event)
Implementation of the
ScriptListener interface. |
void |
serverMessageReceived(RemoteDesktopServerEvent evt)
Implementation of the
RemoteDesktopServerListener interface. |
public static void addDisconnectListener(DisconnectListener l)
DisconnectListener
class description for details and examples.l
- a disconnect listener.public static void removeDisconnectListener(DisconnectListener l)
DisconnectListener
class description for details and examples.l
- a disconnect listener.public String getCode()
Plugin
Get plugin code. This string serves as an identifier of the functionality delivered by the plugin. For example, desktop client plugins return protocol name like "RFB" or "RDP" as their code.
Plugin code is used by pluggable instance factories to identify
a particular plugin. It may be used to replace internal plugins with
third party code. For
example if you develop a class which implements this and the
com.tplan.robot.remoteclient.RemoteDesktop
interfaces and the
getCode()
method returns "RFB", it will replace the internal
implementation of the RFB (VNC) client.
public String getDisplayName()
Plugin
getDisplayName
in interface Plugin
public String getDescription()
Plugin
getDescription
in interface Plugin
public String getUniqueId()
Plugin
Get unique ID associated with the plugin. The plugin manager uses the ID together with the version string to identify whether a plugin is already installed and whether a newer version of the same plugin is available.
The unique ID in fact identifies a particular plugin delivered by a particular vendor. Plugin developers are recommended to choose an ID and keep it constant for all versions of one particular plugin. The ID is never displayed in the GUI so it doesn't have to be a readable text. To avoid conflicts with other vendors it is recommended to elaborate vendor or author name and feature description into the ID, for example "custom RFB client implemented by John Doe".
getUniqueId
in interface Plugin
public String getVendorName()
Plugin
getVendorName
in interface Plugin
public String getSupportContact()
Plugin
getSupportContact
in interface Plugin
public int[] getVersion()
Plugin
new int[] { 1, 2, 3 }
.getVersion
in interface Plugin
public Class getImplementedInterface()
Plugin
com.tplan.robot.remoteclient.RemoteDesktopClient.class
.getImplementedInterface
in interface Plugin
public boolean requiresRestart()
Plugin
requiresRestart
in interface Plugin
public String getVendorHomePage()
Plugin
getVendorHomePage
in interface Plugin
public int[] getLowestSupportedVersion()
Plugin
getLowestSupportedVersion
in interface Plugin
public String getMessageBeforeInstall()
Plugin
getMessageBeforeInstall
in interface Plugin
public String getMessageAfterInstall()
Plugin
getMessageAfterInstall
in interface Plugin
public void checkDependencies(PluginManager manager) throws DependencyMissingException
checkDependencies
in interface Plugin
manager
- plugin manager instance.DependencyMissingException
- when one or more required dependencies is not installed.public void executionStarted(ScriptingContext ctx)
ExecutionListener
interface.executionStarted
in interface ExecutionListener
ctx
- context of the newly started script.public void scriptEvent(ScriptEvent event)
ScriptListener
interface.scriptEvent
in interface ScriptListener
event
- a script event.public void serverMessageReceived(RemoteDesktopServerEvent evt)
RemoteDesktopServerListener
interface.serverMessageReceived
in interface RemoteDesktopServerListener
evt
- a desktop server event.public void disconnectFallback(ScriptingContext context)
DisconnectListener
interface which performs
the default connection recovery operation. Automatic recovery is by default
disabled and must be enabled through the Execution panel of Preferences or
at the level of Java code through UserConfiguration.getInstance().setBoolean("scripting.recoverConnections", true)
.disconnectFallback
in interface DisconnectListener
context
- scripting context.