com.vii.brillien.kernel.axiom
Interface Aspirer<C extends Communication,R>

All Superinterfaces:
Callable<R>
All Known Subinterfaces:
CharacteristicFunction<P,C,R>, Commander<P,C,R>, Context<P,C,R>, EquivalenceRelation<P,C,R>, Flow<P,C,R>, OrderRelation<P,C,R>, Presence<C,R>, Presence<C,R>, PresenceBoard<P,C>, PresenceManager<P,C>, Unit<P,C,R>

public interface Aspirer<C extends Communication,R>
extends Callable<R>

Brillien represents the probelms of real world as a free communications' flow. Components have 3 roles basically: start, receive communication and alter during communications This interface define all behaviors which belongs to actor part of its roles. Every actor action should be defined in the execution thread dedicated to this component by the Liaison object


Method Summary
 void activateCallable()
          Activates the callable activity.
 R getResult()
          Returns the result of the activity if it exists
 boolean hasActivity()
          Tells whether this Presence has callable activity
 boolean isWaitingForInputData()
          Tells whether this Aspirer is waiting for input data to be activated.
 boolean isWaitingForResponse()
          Tells whether this Aspirer is waiting an answer to a redirected get-like message sent earlier.
 void passivateCallable()
          Passivates the callable activity.
 void plan()
          After having all input parameters set, this method is called by the instantiation manager instance to make the Aspirer to activate itself
 void sendAGet(String to, String apiVersion, String message, String redirectMessage, Map<String,Object> parameters)
          Sends a get-like message to the given recipient.
 void sendDelegatedSet(String to, String apiVersion, String message, String redirectEntityName, String redirectMessage, Map<String,Object> parameters)
          Sends a get-like message to the given recipient.
 void sendError(C c, int errorCode, String message)
          Sends an error message to a previously received message.
 void sendError(C c, int errorCode, String message, Object value)
          Sends an error message to a previously received message.
 void sendError(C c, String message)
          Sends an error message to a previously received message.
 C sendGet(long timeout, String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a get-like message to the given recipient.
 C sendGet(String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a get-like message to the given recipient.
 void sendResponse(C c, Object response)
          Sends a response to a previously received message.
 void sendSet(String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a set-like message to the given recipient.
 void sendUnitAGet(String to, String apiVersion, String message, String redirectMessage, Map<String,Object> parameters)
          Sends a unit-wide get-like message to the given recipient.
 void sendUnitDelegatedSet(String to, String apiVersion, String message, String redirectEntityName, String redirectMessage, Map<String,Object> parameters)
          Sends a unit-wide get-like message to the given recipient.
 C sendUnitGet(int timeout, String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a unit-wide get-like message to the given recipient.
 C sendUnitGet(String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a unit-wide get-like message to the given recipient.
 void sendUnitSet(String to, String apiVersion, String message, Map<String,Object> parameters)
          Sends a unit-wide set-like message to the given recipient.
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Method Detail

plan

void plan()
          throws BrillienException
After having all input parameters set, this method is called by the instantiation manager instance to make the Aspirer to activate itself

Throws:
BrillienException

isWaitingForInputData

boolean isWaitingForInputData()
Tells whether this Aspirer is waiting for input data to be activated. Will be automatically false after the execution of method setCallableInputData.


activateCallable

void activateCallable()
                      throws BrillienException
Activates the callable activity. Should be called once during the lifetime of the Aspirer object.

Throws:
BrillienException

passivateCallable

void passivateCallable()
                       throws BrillienException
Passivates the callable activity. Can be called if the working Aspirer is required to stop.

Throws:
BrillienException

hasActivity

boolean hasActivity()
Tells whether this Presence has callable activity


getResult

R getResult()
Returns the result of the activity if it exists


sendGet

C sendGet(String to,
          String apiVersion,
          String message,
          Map<String,Object> parameters)
                                throws BrillienException
Sends a get-like message to the given recipient. The method will not return until the response is arrived or a timeout event occured. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
parameters - parameters of the message
Returns:
reponse message
Throws:
BrillienException

sendGet

C sendGet(long timeout,
          String to,
          String apiVersion,
          String message,
          Map<String,Object> parameters)
                                throws BrillienException
Sends a get-like message to the given recipient. The method will not return until the response is arrived or a timeout event occured. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
timeout - timout of the waiting
to - name of the recipient
message - message text
parameters - parameters of the message
Throws:
BrillienException

sendAGet

void sendAGet(String to,
              String apiVersion,
              String message,
              String redirectMessage,
              Map<String,Object> parameters)
              throws BrillienException
Sends a get-like message to the given recipient. The method will return immediately after having sent the message. The response will sent to this Aspirer through the given redirectMessage. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
redirectMessage -
parameters - parameters of the message
Throws:
BrillienException

sendDelegatedSet

void sendDelegatedSet(String to,
                      String apiVersion,
                      String message,
                      String redirectEntityName,
                      String redirectMessage,
                      Map<String,Object> parameters)
                      throws BrillienException
Sends a get-like message to the given recipient. The method will return immediately after having sent the message. The response will sent to this Aspirer through the given redirectMessage. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
redirectEntityName - name of the recivient who will be sent the message for
redirectMessage - redirection message name
parameters - parameters of the message
Throws:
BrillienException

sendSet

void sendSet(String to,
             String apiVersion,
             String message,
             Map<String,Object> parameters)
             throws BrillienException
Sends a set-like message to the given recipient. The method will return immediately after having sent the message, no response is expected. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
parameters - parameters of the message
Throws:
BrillienException

sendResponse

void sendResponse(C c,
                  Object response)
                  throws BrillienException
Sends a response to a previously received message. The response will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
c - previously received message
response - response object
Throws:
BrillienException

sendError

void sendError(C c,
               String message)
               throws BrillienException
Sends an error message to a previously received message.

Parameters:
c - previously received message
message - error message
Throws:
BrillienException

sendError

void sendError(C c,
               int errorCode,
               String message)
               throws BrillienException
Sends an error message to a previously received message.

Parameters:
c - previously received message
message - error message
Throws:
BrillienException

sendError

void sendError(C c,
               int errorCode,
               String message,
               Object value)
               throws BrillienException
Sends an error message to a previously received message.

Parameters:
c - previously received message
message - error message
Throws:
BrillienException

isWaitingForResponse

boolean isWaitingForResponse()
Tells whether this Aspirer is waiting an answer to a redirected get-like message sent earlier.


sendUnitGet

C sendUnitGet(String to,
              String apiVersion,
              String message,
              Map<String,Object> parameters)
                                    throws BrillienException
Sends a unit-wide get-like message to the given recipient. The method will not return until the response is arrived or a timeout event occured. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
parameters - parameters of the message
Returns:
reponse messages
Throws:
BrillienException

sendUnitGet

C sendUnitGet(int timeout,
              String to,
              String apiVersion,
              String message,
              Map<String,Object> parameters)
                                    throws BrillienException
Sends a unit-wide get-like message to the given recipient. The method will not return until the response is arrived or a timeout event occured. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
timeout - timout of the waiting
to - name of the recipient
message - message text
parameters - parameters of the message
Returns:
reponse messages
Throws:
BrillienException

sendUnitAGet

void sendUnitAGet(String to,
                  String apiVersion,
                  String message,
                  String redirectMessage,
                  Map<String,Object> parameters)
                  throws BrillienException
Sends a unit-wide get-like message to the given recipient. The method will return immediately after having sent the message. The response will sent to this Aspirer through the given redirectMessage. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
redirectMessage -
parameters - parameters of the message
Throws:
BrillienException

sendUnitDelegatedSet

void sendUnitDelegatedSet(String to,
                          String apiVersion,
                          String message,
                          String redirectEntityName,
                          String redirectMessage,
                          Map<String,Object> parameters)
                          throws BrillienException
Sends a unit-wide get-like message to the given recipient. The method will return immediately after having sent the message. The response will sent to this Aspirer through the given redirectMessage. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
redirectEntityName - name of the recivient who will be sent the message for
redirectMessage - redirection message name
parameters - parameters of the message
Throws:
BrillienException

sendUnitSet

void sendUnitSet(String to,
                 String apiVersion,
                 String message,
                 Map<String,Object> parameters)
                 throws BrillienException
Sends a unit-wide set-like message to the given recipient. The method will return immediately after having sent the message, no response is expected. The parameters will be converted to Json format. In case of unsuccessful conversion, an exception will be thrown.

Parameters:
to - name of the recipient
message - message text
parameters - parameters of the message
Throws:
BrillienException


Copyright © 2012. All Rights Reserved.