de.cau.cs.kieler.kwebs.client
Class AbstractLayoutServiceClient

java.lang.Object
  extended by de.cau.cs.kieler.kwebs.client.AbstractLayoutServiceClient
All Implemented Interfaces:
ILayoutServiceClient
Direct Known Subclasses:
HttpBasedLayoutServiceClient, JetiClient

public abstract class AbstractLayoutServiceClient
extends Object
implements ILayoutServiceClient

Abstract base implementation of the ILayoutServiceClient interface. This class provides basic infrastructure for managing the connection between a client and the layout service without using a concrete web service architecture. Architecture specific methods still have to be implemented by a concrete web service client.

Rating proposed yellow
(2011-08-02) reviewed by ckru, mri, msp

Constructor Summary
protected AbstractLayoutServiceClient()
          Protected constructor.
protected AbstractLayoutServiceClient(ServerConfigData theserverConfig)
          Creates a new instance.
 
Method Summary
 Throwable getLastError()
          Returns the last error occurred.
 String[] getLastErrorAsStringArray()
          Returns a string array containing the messages of the the last exception occurred.
 ServerConfigData getServerConfig()
          Returns the ServerConfigData this client currently points to.
 boolean isAvailable()
          This base implementation does not really check for availability but always returns true.
 void setLastError(Throwable thelastError)
          Sets the last error occurred.
 void setServerConfig(ServerConfigData theserverConfig)
          Sets a new ServerConfigData this client points to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.cau.cs.kieler.kwebs.client.ILayoutServiceClient
connect, disconnect, getPreviewImage, getServiceData, graphLayout, isConnected
 

Constructor Detail

AbstractLayoutServiceClient

protected AbstractLayoutServiceClient()
Protected constructor.


AbstractLayoutServiceClient

protected AbstractLayoutServiceClient(ServerConfigData theserverConfig)
Creates a new instance. Only to be used by sub classes.

Parameters:
theserverConfig - the ServerConfigData of the layout service to be used
Method Detail

isAvailable

public boolean isAvailable()
This base implementation does not really check for availability but always returns true. The only way to check for availability at this point is to check whether the given server address answers to a ping. Since many fire walls filter a ping this is not an adequate way to check for availability. Protocol specific implementations may override if they have more specific ways to check for availability.

Specified by:
isAvailable in interface ILayoutServiceClient
Returns:
whether the endpoint configured in the server configuration of this client is reachable

getServerConfig

public final ServerConfigData getServerConfig()
Returns the ServerConfigData this client currently points to.

Specified by:
getServerConfig in interface ILayoutServiceClient
Returns:
the server configuration

setServerConfig

public void setServerConfig(ServerConfigData theserverConfig)
Sets a new ServerConfigData this client points to. Resets the state of this client to disconnected.

Specified by:
setServerConfig in interface ILayoutServiceClient
Parameters:
theserverConfig - the new server configuration

getLastErrorAsStringArray

public String[] getLastErrorAsStringArray()
Returns a string array containing the messages of the the last exception occurred.

Specified by:
getLastErrorAsStringArray in interface ILayoutServiceClient
Returns:
string array containing the messages of the last thrown exception or null if everything went fine

getLastError

public Throwable getLastError()
Returns the last error occurred.

Specified by:
getLastError in interface ILayoutServiceClient
Returns:
the last error occurred as throwable or null if everything went fine

setLastError

public void setLastError(Throwable thelastError)
Sets the last error occurred.

Specified by:
setLastError in interface ILayoutServiceClient
Parameters:
thelastError - the last error occurred