org.jboss.jbossts.star.service
Class Coordinator

java.lang.Object
  extended by org.jboss.jbossts.star.service.Coordinator

public class Coordinator
extends Object


Field Summary
protected static org.jboss.logging.Logger log
           
 
Constructor Summary
Coordinator()
           
 
Method Summary
 javax.ws.rs.core.Response beginTransaction(javax.ws.rs.core.UriInfo info, javax.ws.rs.core.HttpHeaders headers, String content)
          Performing a POST on Transaction Manager URL @see TxSupport.TX_SEGMENT with no content as shown below will start a new transaction with a default timeout.
 javax.ws.rs.core.Response deleteParticipant(String enlistmentId)
           
 javax.ws.rs.core.Response deleteTransaction(String id)
          Performing a DELETE on the transaction-coordinator URL will return a 403.
 javax.ws.rs.core.Response enlistParticipant(javax.ws.rs.core.UriInfo info, String txId, String content)
          Register a participant in a tx
 javax.ws.rs.core.Response getAllTransactions(javax.ws.rs.core.UriInfo info)
          Performing a GET on the transaction-manager returns a list of all transaction URIs known to the coordinator (active and in recovery) separated by the @see TxSupport.URI_SEPARATOR character
 javax.ws.rs.core.Response getTransactionStatus(String id)
          Performing a GET on the transaction url returns its status
 javax.ws.rs.core.Response getTransactionURIs(javax.ws.rs.core.UriInfo info, String id)
          Obtain the transaction terminator and participant enlistment URIS for the specified transaction id.
 javax.ws.rs.core.Response lookupParticipant(String enlistmentId)
          Get the participant url (registered during enlistParticipant) corresponding to a resource reference if the coordinator crashes - the participant list will be empty but this is ok if commit hasn't been called since the TM uses presumed abort semantics.
 javax.ws.rs.core.Response postParticipant(String enlistmentId)
           
 javax.ws.rs.core.Response replaceParticipant(String enlistmentId, String content)
          PUT /recovery-coordinator// - overwrite the old with (as with JTS, this will also trigger off a recovery attempt on the associated transaction) A participant may use this url to notifiy the coordinator that he has moved to a new location.
 javax.ws.rs.core.Response terminateTransaction(String txId, String fault, String content)
          The client can control the outcome of the transaction by by PUTing to the terminator URL returned as a response to the original transaction create request.
 javax.ws.rs.core.Response tt1(String txId)
           
 javax.ws.rs.core.Response tt2(String txId)
           
 javax.ws.rs.core.Response tt3(String txId)
           
 javax.ws.rs.core.Response tt4(String txId)
           
 javax.ws.rs.core.Response tt5(String txId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log
Constructor Detail

Coordinator

public Coordinator()
Method Detail

getAllTransactions

public javax.ws.rs.core.Response getAllTransactions(@Context
                                                    javax.ws.rs.core.UriInfo info)
Performing a GET on the transaction-manager returns a list of all transaction URIs known to the coordinator (active and in recovery) separated by the @see TxSupport.URI_SEPARATOR character

Parameters:
info - http context of the request
Returns:
JSON representation of active transactions and HTTP status code

getTransactionStatus

public javax.ws.rs.core.Response getTransactionStatus(String id)
Performing a GET on the transaction url returns its status

Parameters:
id - URL template parameter for the id of the transaction
Returns:
content representing the status of the transaction
See Also:
etc for the format of the returned content

deleteTransaction

public javax.ws.rs.core.Response deleteTransaction(String id)
Performing a DELETE on the transaction-coordinator URL will return a 403.

Parameters:
id - transaction id
Returns:
403

tt1

public javax.ws.rs.core.Response tt1(String txId)

tt2

public javax.ws.rs.core.Response tt2(String txId)

tt3

public javax.ws.rs.core.Response tt3(String txId)

tt4

public javax.ws.rs.core.Response tt4(String txId)

tt5

public javax.ws.rs.core.Response tt5(String txId)

beginTransaction

public javax.ws.rs.core.Response beginTransaction(@Context
                                                  javax.ws.rs.core.UriInfo info,
                                                  @Context
                                                  javax.ws.rs.core.HttpHeaders headers,
                                                  String content)
Performing a POST on Transaction Manager URL @see TxSupport.TX_SEGMENT with no content as shown below will start a new transaction with a default timeout. A successful invocation will return 201 and the Location header MUST contain the URI of the newly created transaction resource, which we will refer to as the transaction-coordinator in the rest of this specification. Two related URLs MUST also be returned, one for use by the terminator of the transaction (typically referred to as the client) and one used for registering durable participation in the transaction (typically referred to as the server). These linked URLs can be of arbitrary format. The rel names for the links are:

Parameters:
info - uri context
headers - http headers
content - empty if no transaction timeout is required otherwise the number of milliseconds after which the transaction is eligible for being timed out. The content should have the format
Returns:
http status code
See Also:
and @see TxSupport.PARTICIPANT_LINK

getTransactionURIs

public javax.ws.rs.core.Response getTransactionURIs(@Context
                                                    javax.ws.rs.core.UriInfo info,
                                                    String id)
Obtain the transaction terminator and participant enlistment URIS for the specified transaction id. These are returned in link headers in the same way they were returned when the transaction was started @see Coordinator.beginTransaction

Parameters:
info - request context
id - URL template parameter for the transaction id
Returns:
http response

terminateTransaction

public javax.ws.rs.core.Response terminateTransaction(String txId,
                                                      String fault,
                                                      String content)
The client can control the outcome of the transaction by by PUTing to the terminator URL returned as a response to the original transaction create request. Upon termination, the resource and all associated resources are implicitly deleted. For any subsequent invocation then an implementation MAY return 410 if the implementation records information about transactions that have completed, otherwise it should return 404 (not necessary for presumed rollback semantics) but at a minimum MUST return 401. The invoker can assume this was a rollback. In order for an interested party to know for sure the outcome of a transaction then it MUST be registered as a participant with the transaction coordinator.

Parameters:
txId - URL template component containing the transaction identifier
fault - mechanism for injecting faults TODO use byteman instead
content - body of the request indicating a commit or abort request
Returns:
http response code
See Also:
etc

enlistParticipant

public javax.ws.rs.core.Response enlistParticipant(@Context
                                                   javax.ws.rs.core.UriInfo info,
                                                   String txId,
                                                   String content)
Register a participant in a tx

Parameters:
txId - id of transaction
content - body of request containing URI for driving the participant through completion (the URI should be unique within the scope of txId)
Returns:
unique resource ref for the participant

lookupParticipant

public javax.ws.rs.core.Response lookupParticipant(String enlistmentId)
Get the participant url (registered during enlistParticipant) corresponding to a resource reference if the coordinator crashes - the participant list will be empty but this is ok if commit hasn't been called since the TM uses presumed abort semantics.

Parameters:
enlistmentId - the resource reference
Returns:
the participant url

replaceParticipant

public javax.ws.rs.core.Response replaceParticipant(String enlistmentId,
                                                    String content)
PUT /recovery-coordinator// - overwrite the old with (as with JTS, this will also trigger off a recovery attempt on the associated transaction) A participant may use this url to notifiy the coordinator that he has moved to a new location.

Parameters:
enlistmentId - id by the participant is known
content - http body
Returns:
http status code

postParticipant

public javax.ws.rs.core.Response postParticipant(String enlistmentId)

deleteParticipant

public javax.ws.rs.core.Response deleteParticipant(String enlistmentId)


Copyright © 2011. All Rights Reserved.