FileDocCategorySizeDatePackage
CoordinatorPortTypeImpl.javaAPI DocExample9942Tue May 29 16:57:20 BST 2007com.sun.xml.ws.tx.webservice.member.at

CoordinatorPortTypeImpl

public class CoordinatorPortTypeImpl extends Object implements CoordinatorPortType
Implements WS-AT Coordinator web service.

Proceses notificaions from participants in coordinated atomic transaction activity.

author
Joe.Fialli@Sun.COM
version
$Revision: 1.4.2.1 $
since
1.0

Fields Summary
public static final String
serviceName
public static final String
portName
private static com.sun.xml.ws.developer.StatefulWebServiceManager
manager
private String
activityId
private String
participantId
private WebServiceContext
wsContext
private static final com.sun.xml.ws.tx.common.TxLogger
logger
private com.sun.xml.ws.tx.at.ATCoordinator
coordinator
private EndpointReference
fallbackEPR
Constructors Summary
public CoordinatorPortTypeImpl()


      
    
public CoordinatorPortTypeImpl(String activityId, String participantId)

        this.activityId = activityId;
        this.participantId = participantId;
    
Methods Summary
public voidabortedOperation(Notification parameters)

        final String METHOD_NAME = "abortedOperation";

        initContextFromIncomingMessage();
        if (logger.isLogging(Level.FINER)) {
            logger.entering(METHOD_NAME, getCoordIdPartId());
        }
        if (coordinator != null) {
            coordinator.aborted(participantId);
        } else {
            if (logger.isLogging(Level.SEVERE)) {
                logger.severe("abortedOperation", "unknown coordId or partId " + getCoordIdPartId());
            }
        }
        if (logger.isLogging(Level.FINER)) {
            logger.exiting(METHOD_NAME, getCoordIdPartId());
        }
    
public voidcommittedOperation(Notification parameters)

        final String METHOD_NAME = "committedOperation";

        initContextFromIncomingMessage();
        if (logger.isLogging(Level.FINER)) {
            logger.entering(METHOD_NAME, getCoordIdPartId());
        }
        if (coordinator != null) {
            coordinator.committed(participantId);
        } else {
            // TODO unknown activity id, is logging enough or send something to participant fallbackEPR
            if (logger.isLogging(Level.SEVERE)) {
                logger.severe("committedOperation", "unknown coordId or partId " + getCoordIdPartId());
            }
        }
        if (logger.isLogging(Level.FINER)) {
            logger.exiting(METHOD_NAME, getCoordIdPartId());
        }
    
private java.lang.StringgetCoordIdPartId()

        return "CoorId=" + activityId + " PartId=" + participantId + " ";
    
public static com.sun.xml.ws.developer.StatefulWebServiceManagergetManager()

        return manager;
    
private voidinitContextFromIncomingMessage()

        coordinator = (ATCoordinator) CoordinationManager.getInstance().getCoordinator(activityId);
        if (wsContext != null) {
            MessageContext mc = wsContext.getMessageContext();
            //TODO  start using replyTo EPR if coordinator/participant is unknown or if initial remote 2PC notification
            //      fails one should see if replyTo EPR can get notfication through.
            HeaderList hdrLst = (HeaderList) mc.get(INBOUND_HEADER_LIST_PROPERTY);
            if (hdrLst != null) {
                fallbackEPR = hdrLst.getReplyTo(AddressingVersion.MEMBER, SOAPVersion.SOAP_11).toSpec(MemberSubmissionEndpointReference.class);
            }
        } else {
            if (logger.isLogging(Level.WARNING)) {
                logger.warning("initContextFromIncomingMessage", "wsContext unexpectedly null");
            }
        }

        if (activityId == UNKNOWN_ID) {
            if (logger.isLogging(Level.INFO)) {
                logger.info("Atomic Transaction Coordinator", "handling notification for an unknown transaction");
            }
            coordinator = null;
        } else {
            coordinator = (ATCoordinator) CoordinationManager.getInstance().getCoordinator(activityId);
        }
    
public voidpreparedOperation(Notification parameters)

        final String METHOD_NAME = "preparedOperation";

        initContextFromIncomingMessage();
        if (logger.isLogging(Level.FINER)) {
            logger.entering(METHOD_NAME, getCoordIdPartId());
        }
        if (coordinator != null) {
            coordinator.prepared(participantId);
        } else {
            // TODO unknown activity id, send rollbackOperation to participant
            if (logger.isLogging(Level.SEVERE)) {
                logger.severe("preparedOperation", "unknown coordId or partId " + getCoordIdPartId());
            }
        }
        if (logger.isLogging(Level.FINER)) {
            logger.exiting(METHOD_NAME, getCoordIdPartId());
        }
    
public voidreadOnlyOperation(Notification parameters)

        final String METHOD_NAME = "readonlyOperation";

        initContextFromIncomingMessage();
        if (logger.isLogging(Level.FINER)) {
            logger.entering(METHOD_NAME, getCoordIdPartId());
        }
        if (coordinator != null) {
            coordinator.readonly(participantId);
        } else {
            // TODO unknown activity id, is logging enough or send something to fallback EPR
            if (logger.isLogging(Level.SEVERE)) {
                logger.severe("readonlyOperation", "unknown coordId or partId " + getCoordIdPartId());
            }
        }
        if (logger.isLogging(Level.FINER)) {
            logger.exiting(METHOD_NAME, getCoordIdPartId());
        }
    
public voidreplayOperation(Notification parameters)

        final String METHOD_NAME = "replayOperation";

        initContextFromIncomingMessage();
        if (logger.isLogging(Level.FINER)) {
            logger.entering(METHOD_NAME, getCoordIdPartId());
        }
        if (coordinator != null) {
            coordinator.replay(participantId);
        } else {
            // TODO unknown activity id, is logging enough or send something to participant fallbackEPR
            if (logger.isLogging(Level.SEVERE)) {
                logger.severe("replayOperation", "unknown coordId or partId " + getCoordIdPartId());
            }
        }
        if (logger.isLogging(Level.FINER)) {
            logger.exiting(METHOD_NAME, getCoordIdPartId());
        }
    
public static voidsetManager(com.sun.xml.ws.developer.StatefulWebServiceManager aManager)

        manager = aManager;