context.arch.comm.clients
Class IndependentCommunication

java.lang.Object
  extended bycontext.arch.comm.clients.IndependentCommunication

public class IndependentCommunication
extends java.lang.Object

This method is used to encapsulate all information used for an independent communication. Before openning the communication, it contains the request to send When the communication is closed, it contains the reply of the request and/or the exceptions occured during it. At the end, this object is contained in an IndependentCommunications object that allows to group several IndependentCommunication objects. An IndependentCommunication object is added to an IndependentCommunications object if the clients that initialized the communication requires a response.

Author:
Agathe
See Also:
BaseObject, context.arch.comm.IndependentCommunications, ClientsPool, Client

Field Summary
protected  java.util.Vector exceptions
          A vector of exceptions occured during the communication.
protected  java.lang.String objectIdentification
          Just to determine the class (baseobject, widget...
 java.lang.Object objectToStore
          An object to store something to keep...
protected  java.lang.Object reply
          The reply of the request.
protected  RequestObject request
          The Request object containing the DataObject to send, the port and the host to send to.
protected  boolean responseRequired
          This boolean says if the client wants to get the reply.
 
Constructor Summary
IndependentCommunication(RequestObject request)
          Creates a new IndependentCommunication with the given RequestObject.
IndependentCommunication(RequestObject request, boolean responseRequired)
           
IndependentCommunication(RequestObject request, DataObject reply, java.util.Vector exceptions, boolean responseRequired)
          The generic IndependentCommunication constructor, that takes the request, reply, exceptions given.
 
Method Summary
 void addException(java.lang.Exception e)
          Adds an exception to the exceptions of this object
 void decodeReply(BaseObject baseObject)
           
 DataObject getDecodedReply()
          Returns the DataObject reply
 java.util.Vector getExceptions()
          Returns the exceptions
 RequestData getNonDecodedReply()
          Returns the non decoded RequestData reply
 java.lang.Object getObjectToStore()
           
 RequestObject getRequest()
          Returns the RequestObject
 boolean getResponseRequired()
          Tests if the communication response need to be sent to the client that initialized it.
 java.lang.String getSenderClassId()
           
 boolean isThereTheException(java.lang.Exception exception)
          Tests if exception is contained in the exceptions of this object
 void setDecodedReply(DataObject reply)
          Sets the reply
 void setExceptions(java.util.Vector e)
          Sets the exceptions object
 void setNonDecodedReply(RequestData reply)
          Sets the reply
 void setObjectToStore(java.lang.Object object)
           
 void setRequest(RequestObject request)
          Sets the request object
 void setResponseRequired(boolean responseRequired)
          Set the response required condition
 void setSenderClassId(java.lang.String id)
           
 boolean thereAreExceptions()
          Tests if some exceptions occured during the communication
 java.lang.String toString()
          Returns a printable version of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

request

protected RequestObject request
The Request object containing the DataObject to send, the port and the host to send to.

See Also:
context.arch.util.RequestObject

reply

protected java.lang.Object reply
The reply of the request. This object is updated during the communication by the Client (thread) in charge of it.


exceptions

protected java.util.Vector exceptions
A vector of exceptions occured during the communication. This object may be updated during the communication by the Client (thread) in charge of it.


responseRequired

protected boolean responseRequired
This boolean says if the client wants to get the reply. True by default (the reply is sent to the client)


objectIdentification

protected java.lang.String objectIdentification
Just to determine the class (baseobject, widget... the reply is intended


objectToStore

public java.lang.Object objectToStore
An object to store something to keep...

Constructor Detail

IndependentCommunication

public IndependentCommunication(RequestObject request,
                                DataObject reply,
                                java.util.Vector exceptions,
                                boolean responseRequired)
The generic IndependentCommunication constructor, that takes the request, reply, exceptions given.

Parameters:
request - The RequestObject containing the request
reply - The reply of the request
exceptions - The vector of exceptions
responseRequired - When set to false, the response is put int the specified IndependentCommunications object, but the base object handleIndependentReply is not called. When set to false, the method is called.

IndependentCommunication

public IndependentCommunication(RequestObject request)
Creates a new IndependentCommunication with the given RequestObject. The reply is set to null and exceptions is a empty vector.

Parameters:
request - The RequestObject containing the request

IndependentCommunication

public IndependentCommunication(RequestObject request,
                                boolean responseRequired)
Method Detail

getRequest

public RequestObject getRequest()
Returns the RequestObject

Returns:
RequestObject

setRequest

public void setRequest(RequestObject request)
Sets the request object

Parameters:
request - The RequestObject

getDecodedReply

public DataObject getDecodedReply()
Returns the DataObject reply

Returns:
DataObject

getNonDecodedReply

public RequestData getNonDecodedReply()
Returns the non decoded RequestData reply

Returns:
RequestData

setNonDecodedReply

public void setNonDecodedReply(RequestData reply)
Sets the reply

Parameters:
reply - The DataObject

setDecodedReply

public void setDecodedReply(DataObject reply)
Sets the reply

Parameters:
reply - The DataObject

decodeReply

public void decodeReply(BaseObject baseObject)

getResponseRequired

public boolean getResponseRequired()
Tests if the communication response need to be sent to the client that initialized it.

Returns:
boolean

setResponseRequired

public void setResponseRequired(boolean responseRequired)
Set the response required condition

Parameters:
responseRequired -

thereAreExceptions

public boolean thereAreExceptions()
Tests if some exceptions occured during the communication

Returns:
boolean True if there are exceptions, false otherwise

getExceptions

public java.util.Vector getExceptions()
Returns the exceptions

Returns:
Vector

addException

public void addException(java.lang.Exception e)
Adds an exception to the exceptions of this object

Parameters:
e - The Exception object

setExceptions

public void setExceptions(java.util.Vector e)
Sets the exceptions object

Parameters:
e - The Vector of exceptions

isThereTheException

public boolean isThereTheException(java.lang.Exception exception)
Tests if exception is contained in the exceptions of this object

Returns:
boolean True if exception is contained, false otherwise

getSenderClassId

public java.lang.String getSenderClassId()

setSenderClassId

public void setSenderClassId(java.lang.String id)

getObjectToStore

public java.lang.Object getObjectToStore()

setObjectToStore

public void setObjectToStore(java.lang.Object object)

toString

public java.lang.String toString()
Returns a printable version of this object

Returns:
String