org.jbpm.wire.operation
Class SubscribeOperation

java.lang.Object
  extended by org.jbpm.wire.operation.SubscribeOperation
All Implemented Interfaces:
java.io.Serializable, Operation

public class SubscribeOperation
extends java.lang.Object
implements Operation

subscribes to an observable.

The target object can be a Listener or a specific method to call can be specified (by setMethodName(String))

The event can be filtered by specifying a Context (with setContextName(String)), objects to observe (with setObjectNames(List)) and events to observe (with setEventNames(List)). If the objects or events are not specified, then all objects and events are observed.

The setWireEvents(boolean) specifies if the object or the Descriptor events should be observed.

Author:
Tom Baeyens, Guillaume Porcher (documentation)
See Also:
Serialized Form

Constructor Summary
SubscribeOperation()
           
 
Method Summary
 void apply(java.lang.Object target, WireContext targetWireContext)
          Apply this operation to the specified object, defined in the specified WireContext.
 java.util.List<ArgDescriptor> getArgDescriptors()
          Gets the list of argDescriptor used to create the arguments given to the method (only if a specific method has to be called).
 java.lang.String getContextName()
          Gets the name of the WireContext where the Observable should be found.
 java.util.List<java.lang.String> getEventNames()
          Gets the list of events to listen to.
 java.lang.String getMethodName()
          Gets the name of the method to invoke when an event is received.
 java.util.List<java.lang.String> getObjectNames()
          Gets the list of name of the Observable objects to observe.
 boolean isWireEvents()
          true if the target object will listen to Descriptor related events.
 void setArgDescriptors(java.util.List<ArgDescriptor> argDescriptors)
          Sets the list of argDescriptor used to create the arguments given to the method.
 void setContextName(java.lang.String contextName)
          Sets the name of the WireContext where the Observable should be found.
 void setEventNames(java.util.List<java.lang.String> eventNames)
          Sets the list of events to listen to.
 void setMethodName(java.lang.String methodName)
          Sets the name of the method to invoke when an event is received.
 void setObjectNames(java.util.List<java.lang.String> objectNames)
          Sets the list of name of the Observable objects to observe.
 void setWireEvents(boolean wireEvents)
          Sets if the object should listen to descriptor events or to events fired by the named object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubscribeOperation

public SubscribeOperation()
Method Detail

apply

public void apply(java.lang.Object target,
                  WireContext targetWireContext)
Description copied from interface: Operation
Apply this operation to the specified object, defined in the specified WireContext.

Specified by:
apply in interface Operation
Parameters:
target - object on which the operation should be performed.
targetWireContext - context in which the operation is applied.

getArgDescriptors

public java.util.List<ArgDescriptor> getArgDescriptors()
Gets the list of argDescriptor used to create the arguments given to the method (only if a specific method has to be called).


setArgDescriptors

public void setArgDescriptors(java.util.List<ArgDescriptor> argDescriptors)
Sets the list of argDescriptor used to create the arguments given to the method.


getEventNames

public java.util.List<java.lang.String> getEventNames()
Gets the list of events to listen to.


setEventNames

public void setEventNames(java.util.List<java.lang.String> eventNames)
Sets the list of events to listen to.


getMethodName

public java.lang.String getMethodName()
Gets the name of the method to invoke when an event is received.


setMethodName

public void setMethodName(java.lang.String methodName)
Sets the name of the method to invoke when an event is received.


getContextName

public java.lang.String getContextName()
Gets the name of the WireContext where the Observable should be found.


setContextName

public void setContextName(java.lang.String contextName)
Sets the name of the WireContext where the Observable should be found.


getObjectNames

public java.util.List<java.lang.String> getObjectNames()
Gets the list of name of the Observable objects to observe.


setObjectNames

public void setObjectNames(java.util.List<java.lang.String> objectNames)
Sets the list of name of the Observable objects to observe.


isWireEvents

public boolean isWireEvents()

true if the target object will listen to Descriptor related events.

false if the target object will listen to the object instance events.


setWireEvents

public void setWireEvents(boolean wireEvents)
Sets if the object should listen to descriptor events or to events fired by the named object.

true if the target object will listen to Descriptor related events.

false if the target object will listen to the object instance events.