cvm.se.communication
Class NegotiationObject

java.lang.Object
  extended by cvm.se.communication.NegotiationObject

public class NegotiationObject
extends java.lang.Object

This object handle all the states of negotiation. This is observed by a negotiation thread.

Author:
Frank Hernandez, Raidel Batista, Eddie Incer

Nested Class Summary
static class NegotiationObject.NEGOTIATION_STATES
           
 
Field Summary
 TestObject test
           
 
Constructor Summary
NegotiationObject(java.lang.String connID)
          Create new negotiation object
 
Method Summary
 void addSchemaReceived(NegotiationSchema schema)
          This function adds a schema to the list, once all the schemas are in the machine moves to the next state of negotiation.
 void AnalyzeSchema()
          Deprecated.  
 java.lang.String GetConnectionID()
           
 ControlSchema getCurrentConnSchema()
           
 NegotiationSchema getNegSchema()
           
 java.util.HashMap<java.lang.String,NegotiationSchema> getNegSchemas()
           
 void handleIncommingNegotiation(NegotiationSchema negSch)
          This function handles the negotiation comming from the CVM, or an outside user.
 void handleNegotiationEnd()
          This method encapsulates must of the operations that must be done at the end of negotiation.
 boolean isBIsAwaitingReply()
           
 void processNegoation()
           
 void queueDataSchema(DataSchema data)
          Deprecated.  
 void ReceivedSchema(NegotiationSchema negSchema)
          Deprecated.  
 void setBIsAwaitingReply(boolean isAwaitingReply)
           
 void setControlSchema(ControlSchema schema)
           
 void setCurrentConnSchema(ControlSchema currentConnSchema)
           
 void setNegotiationState(NegotiationObject.NEGOTIATION_STATES state)
          This function updates the current state of the negotiation.
 void setNegSchema(NegotiationSchema negSchema)
          Set the negotiaotion schema.
 void setNegSchemas(java.util.HashMap<java.lang.String,NegotiationSchema> negSchemas)
          Sets the list of negotiation schemas.
 boolean shouldStartNegotiation(ControlSchema schema)
          This function checks for changes in the schema received in comparison to the previously agreed for the communication and signals whether it should negotiate or renegotiate.
 void signalNegotiationEnd()
          Notify the communication process that negotiation has ended.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

test

public TestObject test
Constructor Detail

NegotiationObject

public NegotiationObject(java.lang.String connID)
Create new negotiation object

Parameters:
connID -
Method Detail

addSchemaReceived

public void addSchemaReceived(NegotiationSchema schema)
This function adds a schema to the list, once all the schemas are in the machine moves to the next state of negotiation.

Parameters:
schema -

AnalyzeSchema

public void AnalyzeSchema()
                   throws java.lang.InterruptedException
Deprecated. 

This function analzes the schema, makes the required changes, and removes any lost participant.

Throws:
java.lang.InterruptedException

GetConnectionID

public java.lang.String GetConnectionID()

getNegSchema

public NegotiationSchema getNegSchema()

getNegSchemas

public java.util.HashMap<java.lang.String,NegotiationSchema> getNegSchemas()

handleIncommingNegotiation

public void handleIncommingNegotiation(NegotiationSchema negSch)
This function handles the negotiation comming from the CVM, or an outside user.

Parameters:
negSch - negotiation schema received.

isBIsAwaitingReply

public boolean isBIsAwaitingReply()

processNegoation

public void processNegoation()
                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

ReceivedSchema

public void ReceivedSchema(NegotiationSchema negSchema)
Deprecated. 

This function registers every schema received only when all the schemas are received, it signals the start of negotiation.

Parameters:
negSchema - Negotiation schema received from other users.

setBIsAwaitingReply

public void setBIsAwaitingReply(boolean isAwaitingReply)

setControlSchema

public void setControlSchema(ControlSchema schema)

setNegotiationState

public void setNegotiationState(NegotiationObject.NEGOTIATION_STATES state)
This function updates the current state of the negotiation.

Parameters:
state - to Set.

setNegSchema

public void setNegSchema(NegotiationSchema negSchema)
Set the negotiaotion schema.

Parameters:
negSchema -

setNegSchemas

public void setNegSchemas(java.util.HashMap<java.lang.String,NegotiationSchema> negSchemas)
Sets the list of negotiation schemas.

Parameters:
negSchemas -

shouldStartNegotiation

public boolean shouldStartNegotiation(ControlSchema schema)
This function checks for changes in the schema received in comparison to the previously agreed for the communication and signals whether it should negotiate or renegotiate.

Parameters:
schema -
Returns:
true if negotiation should be started

signalNegotiationEnd

public void signalNegotiationEnd()
Notify the communication process that negotiation has ended.


queueDataSchema

public void queueDataSchema(DataSchema data)
Deprecated. 

Enqueues the data schemas to be sent after negotiation is complete.

Parameters:
data -

handleNegotiationEnd

public void handleNegotiationEnd()
This method encapsulates must of the operations that must be done at the end of negotiation.


getCurrentConnSchema

public ControlSchema getCurrentConnSchema()

setCurrentConnSchema

public void setCurrentConnSchema(ControlSchema currentConnSchema)