org.objectweb.jotm.btp.roles
Class Superior

java.lang.Object
  |
  +--org.objectweb.jotm.btp.axis.WebService
        |
        +--org.objectweb.jotm.btp.roles.Actor
              |
              +--org.objectweb.jotm.btp.roles.Superior
All Implemented Interfaces:
BtpResource
Direct Known Subclasses:
Decider, Node

public abstract class Superior
extends Actor
implements BtpResource

Superior object is the top level of the Superior tree. It extends the Actor object to have utilities methods. This object implements the following methods:

- cancelled
- contextReply
- enrol
- prepareInferiors
- fault
- redirect
- confirmed
- requestStatus
- resign
- status
This object is extended by the Node and Decider objects.


Field Summary
 
Fields inherited from class org.objectweb.jotm.btp.axis.WebService
url_
 
Fields inherited from interface org.objectweb.jotm.btp.roles.BtpResource
VOTE_CANCELLED, VOTE_PREPARED, VOTE_WRONG_STATE
 
Constructor Summary
Superior()
           
 
Method Summary
 String applicationMessage(BtpMessage m)
           
 String applicationMessage(String transactionid, XElement message)
           
 boolean cancel(String transactionid)
           
 BtpMessage cancelled(Cancelled msg)
           
 boolean confirm(String transactionid, boolean onephase)
           
 BtpMessage confirmed(Confirmed msg)
          This message is not received directly but received by the Decider in the confirmTransaction method.
 BtpMessage contextReply(ContextReply msg)
           
 void contradiction(String transactionid)
           
 BtpMessage enrol(Enrol msg)
          enrols a web service into a given transaction.
 void enrolled(String transactionid)
           
 BtpMessage fault(Fault msg)
          tbd
protected  Vector getInferiorsList(String transactionid)
           
protected  Vector listTransactions()
           
abstract  String onMessage(String xml)
           
 int prepare(String transactionid)
           
 BtpMessage prepareInferiors(PrepareInferiors msg)
          prepares all the inferiors from a given object.
 BtpMessage redirect(Redirect msg)
          tbd
 BtpMessage reportFault(String text)
          reports a Fault message with a single text message
 BtpMessage reportUnknownTransaction(String txid)
           
 BtpMessage requestInferiorStatuses(RequestInferiorStatuses msg)
          Possible returned messages: InferiorStatuses, Fault
 BtpMessage requestStatus(RequestStatus msg)
          requests a status to this decider/superior If the target address is itself, then reply the status.
 BtpMessage resign(Resign msg)
          sent from an enrolled inferior to the Superior to remove the inferior from the enrolment.
 BtpMessage status(Status msg)
           
 
Methods inherited from class org.objectweb.jotm.btp.roles.Actor
getLastIncoming, getLastIncoming, getLastOutgoing, getLastOutgoing, getRecentIncoming, getRecentOutgoing, logger, logIncoming, logIncoming, logOutgoing, logOutgoing, messages
 
Methods inherited from class org.objectweb.jotm.btp.axis.WebService
buildURI, buildURI, getTransactionIdentifierFromUri, getUrl, getUrlFromUri, getWsddParameter, isLocalUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Superior

public Superior()
Method Detail

onMessage

public abstract String onMessage(String xml)
Specified by:
onMessage in class Actor

applicationMessage

public String applicationMessage(BtpMessage m)

cancelled

public BtpMessage cancelled(Cancelled msg)

contextReply

public BtpMessage contextReply(ContextReply msg)

enrol

public BtpMessage enrol(Enrol msg)
enrols a web service into a given transaction. The transaction id is contained in the message (superior indentifier). This method registers a new resource (SOAPResource) to the current control object (a transaction).

Parameters:
msg - the received Enrol message
Returns:
an Enrolled message (in case all is OK), or a Fault message if there is a problem.

prepareInferiors

public BtpMessage prepareInferiors(PrepareInferiors msg)
prepares all the inferiors from a given object. The PrepareInferiors message contains an InferiorIdentifiers list. This list is the list of resources which are in the cohesion set.

Parameters:
msg - the received PrepareInferiors message
Returns:
an InferiorStatuses message

reportFault

public BtpMessage reportFault(String text)
reports a Fault message with a single text message

Parameters:
text - a free text to explain the problem
Returns:
a Fault message (with General fault type)

reportUnknownTransaction

public BtpMessage reportUnknownTransaction(String txid)

fault

public BtpMessage fault(Fault msg)
tbd


redirect

public BtpMessage redirect(Redirect msg)
tbd


confirmed

public BtpMessage confirmed(Confirmed msg)
This message is not received directly but received by the Decider in the confirmTransaction method.


requestInferiorStatuses

public BtpMessage requestInferiorStatuses(RequestInferiorStatuses msg)
Possible returned messages: InferiorStatuses, Fault

Parameters:
msg - the RequestInferiorStatuses message to answer
Returns:
an InferiorStatuses message containing the status of the target inferiors, or a FAULT message

requestStatus

public BtpMessage requestStatus(RequestStatus msg)
requests a status to this decider/superior If the target address is itself, then reply the status. Possible returned messages: Status, Fault

Parameters:
msg - the RequestStatus message to answer
Returns:
a STATUS message containing the status of the target identifier, or a FAULT message

resign

public BtpMessage resign(Resign msg)
sent from an enrolled inferior to the Superior to remove the inferior from the enrolment. Be careful, for the moment the Superior does not support the RESIGN message dued to not have a deregister_resource method in the ControlImpl object from JoTM.

Parameters:
msg - a Resign message
Returns:
just return a Resigned method

status

public BtpMessage status(Status msg)

enrolled

public void enrolled(String transactionid)
Specified by:
enrolled in interface BtpResource
Parameters:
transactionid - The transaction ID

prepare

public int prepare(String transactionid)
Specified by:
prepare in interface BtpResource
Parameters:
transactionid - The transaction ID

confirm

public boolean confirm(String transactionid,
                       boolean onephase)
                throws Exception
Specified by:
confirm in interface BtpResource
Parameters:
transactionid - The transaction ID
onephase - true when 1-phase commit, false when 2-phase commit.
Exception

cancel

public boolean cancel(String transactionid)
               throws Exception
Specified by:
cancel in interface BtpResource
Parameters:
transactionid - The transaction ID
Exception

contradiction

public void contradiction(String transactionid)
Specified by:
contradiction in interface BtpResource
Parameters:
transactionid - The transaction ID

applicationMessage

public String applicationMessage(String transactionid,
                                 XElement message)
Specified by:
applicationMessage in interface BtpResource
Parameters:
transactionid - The transaction ID
message - The application message

getInferiorsList

protected Vector getInferiorsList(String transactionid)

listTransactions

protected Vector listTransactions()