T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1

com.tplan.robot.remoteclient
Class AbstractRemoteDesktopClient

java.lang.Object
  extended by com.tplan.robot.remoteclient.AbstractRemoteDesktopClient
All Implemented Interfaces:
Plugin, Capability, ImageOwner, ServerPropertyCapable, RemoteDesktopClient, PropertyChangeListener, EventListener
Direct Known Subclasses:
AdbClient, ImageClient, LocalJavaClient, RfbClientImpl

public abstract class AbstractRemoteDesktopClient
extends Object
implements RemoteDesktopClient, ImageOwner, ServerPropertyCapable, PropertyChangeListener

Base abstract class for desktop clients which provides common infrastructure for server and client listeners.


T-Plan Robot Enterprise, (C) 2009-2014 T-Plan Limited. All rights reserved.


Field Summary
protected  ListenerHashMapImpl<String,Object> serverProperties
          Map of server properties.
 
Fields inherited from interface com.tplan.robot.remoteclient.RemoteDesktopClient
LOGIN_PARAM_PASSWORD, LOGIN_PARAM_URI, LOGIN_PARAM_USER
 
Constructor Summary
AbstractRemoteDesktopClient()
           
 
Method Summary
 void addClientListener(RemoteDesktopClientListener listener)
          Add a client listener.
 void addServerListener(RemoteDesktopServerListener listener)
          Add a server listener to the client.
 void destroy()
          Destroy the client and make it ready for garbage collection.
protected  void fireRemoteClientEvent(RemoteDesktopClientEvent evt)
          Fire a client event to all registered listeners.
protected  void fireRemoteServerEvent(RemoteDesktopServerEvent evt)
          Fire a server event to all registered listeners.
 Map<String,Object> getServerProperties()
          Implementation of ServerPropertyCapable.getServerProperties().
 boolean isActivelyUpdating()
          The client is by default considered passive (the method returns false).
 boolean isConnectedTo(String connectString)
          Test whether this client is connected to a desktop identified by a particular URL (connect string).
 boolean isStatic()
          The client is by default considered dynamic (the method returns false).
 void propertyChange(PropertyChangeEvent evt)
          Implementation of the PropertyChangeListener to listen to changes of the server property map and fire the RemoteDesktopServerEvent.
 void removeClientListener(RemoteDesktopClientListener listener)
          Remove an object from the list of client listeners.
 void removeServerListener(RemoteDesktopServerListener listener)
          Remove an object from the list of server listeners.
protected  void setServerProperty(String name, String value)
          Add or change a system property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tplan.robot.remoteclient.RemoteDesktopClient
close, connect, getConnectString, getDefaultPort, getDesktopHeight, getDesktopName, getDesktopWidth, getHost, getImage, getLastMouseEvent, getLoginParamsSpecification, getPassword, getPort, getProtocol, getUser, hasSufficientConnectInfo, isConnected, isConnecting, isConsoleMode, isLocalDisplay, sendClientCutText, setConsoleMode, setLoginParams
 
Methods inherited from interface com.tplan.robot.plugin.Plugin
checkDependencies, getCode, getDate, getDescription, getDisplayName, getImplementedInterface, getLowestSupportedVersion, getMessageAfterInstall, getMessageBeforeInstall, getSupportContact, getUniqueId, getVendorHomePage, getVendorName, getVersion, requiresRestart
 

Field Detail

serverProperties

protected ListenerHashMapImpl<String,Object> serverProperties
Map of server properties. See ServerPropertyCapable.

Constructor Detail

AbstractRemoteDesktopClient

public AbstractRemoteDesktopClient()
Method Detail

addServerListener

public void addServerListener(RemoteDesktopServerListener listener)
Add a server listener to the client. Each registered listener will receive an event whenever a server message is received.

Specified by:
addServerListener in interface RemoteDesktopClient
Parameters:
listener - an object implementing the RemoteServerListener interface.

removeServerListener

public void removeServerListener(RemoteDesktopServerListener listener)
Remove an object from the list of server listeners. If the argument object is not registered in the list, the method should do nothing.

Specified by:
removeServerListener in interface RemoteDesktopClient
Parameters:
listener - an object implementing the RemoteDesktopServerListener interface.

fireRemoteServerEvent

protected void fireRemoteServerEvent(RemoteDesktopServerEvent evt)
Fire a server event to all registered listeners.

Parameters:
evt - a server client event

addClientListener

public void addClientListener(RemoteDesktopClientListener listener)
Add a client listener. Each registered listener will receive an event whenever the client sends one of the selected messages to the server, such as PointerEvent, KeyEvent etc.

Specified by:
addClientListener in interface RemoteDesktopClient
Parameters:
listener - an object implementing the RemoteDesktopClientListener interface.

removeClientListener

public void removeClientListener(RemoteDesktopClientListener listener)
Remove an object from the list of client listeners. If the argument object is not registered in the list, the method should do nothing.

Specified by:
removeClientListener in interface RemoteDesktopClient
Parameters:
listener - an object implementing the RemoteDesktopClientListener interface.

fireRemoteClientEvent

protected void fireRemoteClientEvent(RemoteDesktopClientEvent evt)
Fire a client event to all registered listeners.

Parameters:
evt - a desktop client event

destroy

public void destroy()
Destroy the client and make it ready for garbage collection.

Specified by:
destroy in interface RemoteDesktopClient

isConnectedTo

public boolean isConnectedTo(String connectString)
Description copied from interface: RemoteDesktopClient
Test whether this client is connected to a desktop identified by a particular URL (connect string). The method should for example check whether the referred host and port is the same (if applicable). For example, if the client is a VNC one and is connected to "localhost:1", the method should return true when the argument is "rfb://127.0.0.1:5901" because the URL refers to the same host and port.

Specified by:
isConnectedTo in interface RemoteDesktopClient
Parameters:
connectString - an URL (connect string).
Returns:
true if the client is connected to the connect string

isActivelyUpdating

public boolean isActivelyUpdating()
The client is by default considered passive (the method returns false). Override this method for active clients.

Specified by:
isActivelyUpdating in interface ImageOwner
Returns:
false by default.

isStatic

public boolean isStatic()
The client is by default considered dynamic (the method returns false). Override this method for static image clients.

Specified by:
isStatic in interface ImageOwner
Returns:
false by default.

getServerProperties

public Map<String,Object> getServerProperties()
Implementation of ServerPropertyCapable.getServerProperties(). It delivers a generic framework allowing clients to populate variables through the setServerProperty(java.lang.String, java.lang.String) method.

Specified by:
getServerProperties in interface ServerPropertyCapable
Returns:
the map of server properties. It returns null if there is no property.
Since:
3.5.1

setServerProperty

protected void setServerProperty(String name,
                                 String value)
Add or change a system property. This method will trigger a script event of the RemoteDesktopServerEvent.SERVER_PROPERTY_AVAILABLE_EVENT type which makes the underlying framework set or update the variable in the context of the currently executing test script.

Parameters:
name - the property name.
value - the property value.
Since:
3.5.1

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Implementation of the PropertyChangeListener to listen to changes of the server property map and fire the RemoteDesktopServerEvent. See setServerProperty(java.lang.String, java.lang.String) and getServerProperties().

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - an event describing the property name and value.
Since:
3.5.1

T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1