org.idoox.wasp.interceptor
Interface InterceptorChain

All Known Subinterfaces:
TransportInterceptorChain

public interface InterceptorChain

Represents a sequence of interceptors. It offers operations for runtime manipulations of particular interceptors - adding, removing, etc. These operations affect communication but they do not have any implications for persistent configuration of the interceptor chain.

Since:
4.0
Component:
Core

Field Summary
static int INTERCEPTOR_DIRECTION_IN
          Interceptor is used for incoming message.
static int INTERCEPTOR_DIRECTION_INOUT
          Interceptor is used both for incoming and outgoing message.
static int INTERCEPTOR_DIRECTION_OUT
          Interceptor is used for outgoing message.
 
Method Summary
 void add(java.lang.String interceptor, int direction)
          Adds an interceptor to the end of the interceptor chain.
 void add(java.lang.String interceptor, int position, int direction)
          Inserts an interceptor to the specified position.
 Interceptor get(int position)
          Returns an interceptor on specified position.
 int getDirection(int position)
          Returns a communication direction of the interceptor residing on specified position within the chain.
 java.lang.String getName(int position)
          Returns an interceptor name on the specified position.
 void load(Configurable config)
          Loads the chain.
 void remove(int position)
          Removes an interceptor residing from the specified position of the chain.
 void setDirection(int position, int direction)
          Sets a communication direction of the interceptor residing on specified position within the chain.
 int size()
          Returns the size (number of interceptors) of the chain.
 

Field Detail

INTERCEPTOR_DIRECTION_IN

public static final int INTERCEPTOR_DIRECTION_IN
Interceptor is used for incoming message.

See Also:
Constant Field Values

INTERCEPTOR_DIRECTION_OUT

public static final int INTERCEPTOR_DIRECTION_OUT
Interceptor is used for outgoing message.

See Also:
Constant Field Values

INTERCEPTOR_DIRECTION_INOUT

public static final int INTERCEPTOR_DIRECTION_INOUT
Interceptor is used both for incoming and outgoing message.

See Also:
Constant Field Values
Method Detail

load

public void load(Configurable config)
Loads the chain.

Parameters:
config - chain's config

get

public Interceptor get(int position)
Returns an interceptor on specified position.

Parameters:
position - interceptor's index within the chain
Returns:
reference to the interceptor on specified position
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

getName

public java.lang.String getName(int position)
Returns an interceptor name on the specified position.

Parameters:
position - interceptor's index within the chain
Returns:
the interceptor name
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

add

public void add(java.lang.String interceptor,
                int position,
                int direction)
Inserts an interceptor to the specified position.

Parameters:
interceptor - interceptor to be inserted
position - interceptor's index within the chain
direction - interceptor's direction
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

add

public void add(java.lang.String interceptor,
                int direction)
Adds an interceptor to the end of the interceptor chain.

Parameters:
interceptor - interceptor to be added
direction - interceptor's direction

remove

public void remove(int position)
Removes an interceptor residing from the specified position of the chain.

Parameters:
position - interceptor's index within the chain
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

getDirection

public int getDirection(int position)
Returns a communication direction of the interceptor residing on specified position within the chain. The direction can be combination of INTERCEPTOR_DIRECTION_IN and INTERCEPTOR_DIRECTION_OUT.

Parameters:
position - specifies the interceptor's position within the chain
Returns:
status of the interceptor's direction
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

setDirection

public void setDirection(int position,
                         int direction)
Sets a communication direction of the interceptor residing on specified position within the chain. The direction can be combination of INTERCEPTOR_DIRECTION_IN and INTERCEPTOR_DIRECTION_OUT.

Parameters:
position - specifies the interceptor's position within the chain
direction - the interceptor's direction
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range

size

public int size()
Returns the size (number of interceptors) of the chain.

Returns:
number of interceptors within the chain