IBM Rational Performance Tester SDK

com.ibm.rational.test.lt.recorder.core.extensibility
Class BaseClientDelegate

java.lang.Object
  extended by com.ibm.rational.test.lt.recorder.core.extensibility.BaseClientDelegate
All Implemented Interfaces:
IClientDelegate, IRecordingComponentDelegate
Direct Known Subclasses:
AbstractExecutableClientDelegate

public abstract class BaseClientDelegate
extends Object
implements IClientDelegate

A base implementation of IClientDelegate. This class provides basic convenience methods and circuitry for implementing a client delegate. However it is not required to extend this class in order to implement IClientDelegate. Sub-classes are responsible of implementing IClientDelegate.start() and IClientDelegate.stop(), may extend BaseClientDelegate.initialize(IClientContext), and should invoke BaseClientDelegate.sendStarted() and BaseClientDelegate.sendStopped(boolean) when appropriate.


Constructor Summary
BaseClientDelegate()
           
 
Method Summary
 IClientContext getContext()
          Returns the client context.
 Object getProperty(String name)
          Gets a runtime property of the delegate.
 void initialize(IClientContext context)
          This method may be overridden if desired, but the overriding method should make sure that the super implementation is invoked.
 void messageReceived(Message message)
          This method is invoked by the context when a message is sent to this delegate.
 void postStop()
          This implementation does nothing.
 boolean preStart()
          This implementation does nothing.
protected  void sendStarted()
           
protected  void sendStopped(boolean failed)
           
 void sendUserMessage(String msg)
           
 void setProperty(String name, Object value)
          Sets the value of a runtime property of the delegate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.rational.test.lt.recorder.core.extensibility.IClientDelegate
kill, start, stop
 

Constructor Detail

BaseClientDelegate

public BaseClientDelegate()
Method Detail

initialize

public void initialize(IClientContext context)
                throws DelegateInitializeException
This method may be overridden if desired, but the overriding method should make sure that the super implementation is invoked. For more details about what this method does, see IClientDelegate.initialize(IClientContext).

Specified by:
initialize in interface IClientDelegate
Parameters:
context - The client context, that provides the client configuration that this instance should conform to, and a mechanism for the delegate to send events to other involved components.
Throws:
DelegateInitializeException - If the delegate cannot be initialized or will not be able to run properly.

getContext

public final IClientContext getContext()
Returns the client context. This can be used to issue log traces and send messages to the user.

Returns:
A client context.

sendStarted

protected final void sendStarted()
See Also:
IClientDelegate.start()

sendStopped

protected final void sendStopped(boolean failed)
See Also:
IClientDelegate.stop()

messageReceived

public void messageReceived(Message message)
Description copied from interface: IRecordingComponentDelegate
This method is invoked by the context when a message is sent to this delegate. If the delegate doesn't know how to understand or handle the message, it should silently ignore it.

Specified by:
messageReceived in interface IRecordingComponentDelegate
Parameters:
message - A message.

getProperty

public Object getProperty(String name)
                   throws UnsupportedPropertyException
Description copied from interface: IRecordingComponentDelegate
Gets a runtime property of the delegate. The meaning of the property and its value is specific to the delegate and part of the interface between the delegate and other recording components. In particular, the time when the value can be read is let to the delegate implementation (for instance, a property may be read only after the component has started).

Specified by:
getProperty in interface IRecordingComponentDelegate
Parameters:
name - The property name
Returns:
The property value
Throws:
UnsupportedPropertyException - If the delegate does not support the property (either because it does not define such a property, or because the property is read at an inappropriate time).

setProperty

public void setProperty(String name,
                        Object value)
                 throws UnsupportedPropertyException
Description copied from interface: IRecordingComponentDelegate
Sets the value of a runtime property of the delegate. The meaning of the property and its value is specific to the delegate and part of the interface between the delegate and other recording components. In particular, the time when the value can be set is defined by the delegate implementation (for instance, a property may be set only before the component is started).

Specified by:
setProperty in interface IRecordingComponentDelegate
Parameters:
name - The property name
Throws:
UnsupportedPropertyException - If the delegate does not support the property (either because it does not define such a property, or because the property is set at an inappropriate time).

sendUserMessage

public void sendUserMessage(String msg)

preStart

public boolean preStart()
This implementation does nothing. Override if necessary.

Specified by:
preStart in interface IClientDelegate
Returns:
Whether the client should continue. A false value indicates that an error has occurred and the client can not start. It is up to the implementation to notify any error using IRecordingComponentContext.getLog().
See Also:
IClientDelegate.postStop()

postStop

public void postStop()
This implementation does nothing. Override if necessary.

Specified by:
postStop in interface IClientDelegate
See Also:
IClientDelegate.preStart()

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.