guarana.framework.task
Class Gateway

java.lang.Object
  extended by guarana.framework.task.Gateway
All Implemented Interfaces:
ISource

public class Gateway
extends Object
implements ISource

Represents an entry/exit in a task. The gateway must be bound to as slot.

Since:
Guaranį SDK 1.0.0
Author:
Rafael Z. Frantz

Constructor Summary
Gateway(GatewayType type, Task task)
          Constructs a new gateway without a name, of an specific type and associates it with the given task.
Gateway(String name, GatewayType type, Task task)
          Constructs a new gateway with a given name, type and associates it with the given task.
 
Method Summary
 void bind(Slot slot)
          Binds an slot to this gateway.
 Message<?> getMessage()
          Invoked only on an input gateway and returns a message to be processed.
 String getName()
          Returns the name of this source.
 int getNumber()
          Returns the corresponding number of this gateway.
 Slot getSlot()
          Returns the slot associated with this gateway.
 GatewayType getType()
          Returns the type of this slot.
 void setMessage(Message<?> message)
          Invoked only on an output gateway to set an output message.
 void setName(String name)
          Sets the name of this source.
 void setNumber(int number)
          Sets the corresponding number of this gateway.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gateway

public Gateway(GatewayType type,
               Task task)
Constructs a new gateway without a name, of an specific type and associates it with the given task.

Parameters:
type - The type of this gateway.
task - The task to which this new gateway belongs.

Gateway

public Gateway(String name,
               GatewayType type,
               Task task)
Constructs a new gateway with a given name, type and associates it with the given task.

Parameters:
name - The name of this gateway.
type - The type of this new gateway.
task - The task to which this new gateway belongs.
Method Detail

bind

public void bind(Slot slot)
          throws InvalidParameterException
Binds an slot to this gateway.

Parameters:
slot - The slot.
Throws:
InvalidParameterException - if the slot parameter is null.

getMessage

public Message<?> getMessage()
                      throws NullPointerException
Invoked only on an input gateway and returns a message to be processed.

Returns:
a message to be processed by the task or null if there is no message.
Throws:
NullPointerException - if there is no Slot associated with this Gateway.

setMessage

public void setMessage(Message<?> message)
Invoked only on an output gateway to set an output message.

Parameters:
message - The message to set as output in the output gateway.

setName

public void setName(String name)
Sets the name of this source.

Specified by:
setName in interface ISource
Parameters:
name - The name of this source.

getName

public String getName()
Returns the name of this source.

Specified by:
getName in interface ISource
Returns:
the name of this source.

getSlot

public Slot getSlot()
Returns the slot associated with this gateway.

Returns:
the slot.

getType

public GatewayType getType()
Returns the type of this slot.

Returns:
the type.
See Also:
GatewayType

setNumber

public void setNumber(int number)
Sets the corresponding number of this gateway.

Parameters:
number - The corresponding number.

getNumber

public int getNumber()
Returns the corresponding number of this gateway.

Returns:
the corresponding number.


Guaranį DSL Home