de.danet.an.workflow.api
Class DefaultRequester

java.lang.Object
  extended byde.danet.an.workflow.api.DefaultRequester
All Implemented Interfaces:
java.util.EventListener, java.io.Serializable, WfAuditHandler, WfObject, WfRequester

public class DefaultRequester
extends java.lang.Object
implements WfRequester, java.io.Serializable

This class provides an implementation of a WfRequester. It class may be used directly if the events that are usually delivered to a requester are of no interest.

If events are to be processed, DefaultRequester must be subclassed with receiveEvent overridden with the event handling code.

As an alternative to subclassing, a handler may be passed to the constructor. Events will then be forwarded to the handler. This is convenient in situation where the implementation of WfAuditHandler already exists and a subclass would only do the forwarding. Note that the reference to the handler is transient.

Version:
$Revision: 1607 $
Author:
See Also:
Serialized Form

Field Summary
(package private) static long serialVersionUID
          Serial version UID.
 
Constructor Summary
  DefaultRequester(WorkflowService wfs)
          Creates a DefaultRequester for use with the given workflow service.
protected DefaultRequester(WorkflowService wfs, boolean register)
          Creates a DefaultRequester for use with the given workflow service.
  DefaultRequester(WorkflowService wfs, WfAuditHandler hdlr)
          Creates a DefaultRequester for use with the given workflow service.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 int hashCode()
          Returns a hash code value for the object.
 boolean isMemberOfPerformers(WfProcess wfProcess)
          Check if the given process is among the performers of this requester.
 java.util.Collection performers()
          Return all performers associated with this requester.
 void receiveEvent(WfAuditEvent wfAuditEvent)
          Called by the workflow engine if an event occurs.
 java.lang.String toString()
          Return a string representation for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
Serial version UID.

See Also:
Constant Field Values
Constructor Detail

DefaultRequester

public DefaultRequester(WorkflowService wfs)
                 throws java.rmi.RemoteException
Creates a DefaultRequester for use with the given workflow service. The created requester will not receive events until registered with a WorkflowService.

Parameters:
wfs - the workflow service.
Throws:
java.rmi.RemoteException - if thrown during requester registration.

DefaultRequester

public DefaultRequester(WorkflowService wfs,
                        WfAuditHandler hdlr)
                 throws java.rmi.RemoteException
Creates a DefaultRequester for use with the given workflow service. The created requester will forward received events to the given handler.

Parameters:
wfs - the workflow service.
hdlr - the event handler.
Throws:
java.rmi.RemoteException - if thrown during requester registration.

DefaultRequester

protected DefaultRequester(WorkflowService wfs,
                           boolean register)
                    throws java.rmi.RemoteException
Creates a DefaultRequester for use with the given workflow service. The created requester is automatically registered at the given WorkflowService.

Parameters:
wfs - the workflow service.
register - if true the requester will be registered at the workflow service.
Throws:
java.rmi.RemoteException - if thrown during requester registration.
Method Detail

performers

public java.util.Collection performers()
                                throws java.rmi.RemoteException
Description copied from interface: WfRequester
Return all performers associated with this requester.

Specified by:
performers in interface WfRequester
Returns:
A collection of associated performers.
Throws:
java.rmi.RemoteException - if a system-level error occurs.

isMemberOfPerformers

public boolean isMemberOfPerformers(WfProcess wfProcess)
                             throws java.rmi.RemoteException
Description copied from interface: WfRequester
Check if the given process is among the performers of this requester.

Specified by:
isMemberOfPerformers in interface WfRequester
Parameters:
wfProcess - the process in question.
Returns:
true if the process is among the performers of this requester.
Throws:
java.rmi.RemoteException - if a system-level error occurs.

receiveEvent

public void receiveEvent(WfAuditEvent wfAuditEvent)
                  throws InvalidPerformerException,
                         java.rmi.RemoteException
Description copied from interface: WfAuditHandler
Called by the workflow engine if an event occurs.

Specified by:
receiveEvent in interface WfAuditHandler
Parameters:
wfAuditEvent - the event.
Throws:
InvalidPerformerException - thrown by the derived WfRequester if it receives an event from a process that is not among its performers.
java.rmi.RemoteException - if a system-level error occurs.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Parameters:
obj - the other object.
Returns:
true if the objects are equal.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
the hash code

toString

public java.lang.String toString()
Return a string representation for debugging purposes.

Returns:
the string representation.