Package com.arjuna.mw.wst11.service

Examples of com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor


    @WebMethod
    public void addValueToSet(String value) throws AlreadyInSetException, SetServiceException {

        System.out.println("[SERVICE] invoked addValueToSet('" + value + "')");

        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();

        /*
         * get the transaction context of this thread:
         */
        String transactionId;
        try {
            transactionId = activityManager.currentTransaction().toString();
        } catch (SystemException e) {
            throw new SetServiceException("Unable to lookup existing BusinesActivity", e);
        }

        /*
         * Lookup existing participant or register new participant
         */
        SetParticipantBA participantBA = SetParticipantBA.getParticipant(transactionId);

        if (participantBA == null) {
            try {
                // enlist the Participant for this service:
                SetParticipantBA participant = new SetParticipantBA(transactionId, value);
                SetParticipantBA.recordParticipant(transactionId, participant);

                System.out.println("[SERVICE] Enlisting a participant into the BA");
                activityManager.enlistForBusinessAgreementWithCoordinatorCompletion(participant, "SetServiceBAImpl:"
                        + UUID.randomUUID());
            } catch (Exception e) {
                System.err.println("Participant enlistment failed");
                throw new SetServiceException("Error enlisting participant", e);
            }
View Full Code Here


        BAParticipantManager participantManager;

        try {
            // enlist the Participant for this service:
            SetParticipantBA participant = new SetParticipantBA(value);
            BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();
            System.out.println("[SERVICE] Enlisting a participant into the BA");
            participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(participant,
                    "SetServiceBAImpl:" + UUID.randomUUID());
        } catch (Exception e) {
            System.err.println("Participant enlistment failed");
            e.printStackTrace(System.err);
            throw new SetServiceException("Error enlisting participant", e);
View Full Code Here

        BAParticipantManager participantManager;

        try {
            // enlist the Participant for this service:
            SetParticipantBA participant = new SetParticipantBA(value);
            BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();
            log.info("[SERVICE] Enlisting a participant into the BA");
            participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(participant,
                    "SetServiceBAImpl:" + new Uid().toString());
        } catch (Exception e) {
            log.error("Participant enlistment failed");
            e.printStackTrace(System.err);
            throw new SetServiceException("Error enlisting participant", e);
View Full Code Here

    @WebMethod
    public void addValueToSet(String value) throws AlreadyInSetException, SetServiceException {

        log.info("[SERVICE] invoked addValueToSet('" + value + "')");

        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();

        /*
         * get the transaction context of this thread:
         */
        String transactionId;
        try {
            transactionId = activityManager.currentTransaction().toString();
        } catch (SystemException e) {
            throw new SetServiceException("Unable to lookup existing BusinesActivity", e);
        }

        /*
         * Lookup existing participant or register new participant
         */
        SetParticipantBA participantBA = SetParticipantBA.getParticipant(transactionId);

        if (participantBA == null) {
            try {
                // enlist the Participant for this service:
                SetParticipantBA participant = new SetParticipantBA(transactionId, value);
                SetParticipantBA.recordParticipant(transactionId, participant);

                log.info("[SERVICE] Enlisting a participant into the BA");
                activityManager.enlistForBusinessAgreementWithCoordinatorCompletion(participant, "SetServiceBAImpl:"
                        + new Uid().toString());
            } catch (Exception e) {
                log.error("Participant enlistment failed");
                throw new SetServiceException("Error enlisting participant", e);
            }
View Full Code Here

     */
    public void saveData(String value, ServiceCommand... serviceCommands) throws TestApplicationException {

        log.info("[BA COORDINATOR COMPL SERVICE] web method saveData('" + value + "')");
        eventLog.foundEventLogName(value);
        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();
       
        // transaction context associated with this thread
        String transactionId;
        try {
            transactionId = activityManager.currentTransaction().toString();
        } catch (SystemException e) {
            throw new RuntimeException("Unable to lookup existing business activity", e);
        }

         // Lookup existing participant or register new participant (
        BACoordinationCompletionParticipant participantBA = BACoordinationCompletionParticipant.getSomeParticipant(transactionId);

        if (participantBA != null && ServiceCommand.isPresent(REUSE_BA_PARTICIPANT, serviceCommands)) {
            log.info("[BA COORDINATOR COMPL SERVICE] Re-using the existing participant, already registered for this BA - command set to: " +
                    REUSE_BA_PARTICIPANT);
        } else {
            try {
                // enlist the Participant for this service:
                participantBA = new BACoordinationCompletionParticipant(serviceCommands, eventLog, transactionId, value);
                BACoordinationCompletionParticipant.recordParticipant(transactionId, participantBA);

                log.info("[BA COORDINATOR COMPL SERVICE] Enlisting a participant into the BA");
                BAParticipantManager baParticipantManager =  activityManager.enlistForBusinessAgreementWithCoordinatorCompletion(participantBA,
                        "BACoordinatorCompletition:" + new Uid().toString());

                if (ServiceCommand.isPresent(CANNOT_COMPLETE, serviceCommands)) {
                    baParticipantManager.cannotComplete();
                    return;
View Full Code Here

        log.info("[BA PARTICIPANT COMPL SERVICE] invoked saveData('" + value + "')");
        eventLog.foundEventLogName(value);
       
        BAParticipantManager participantManager;
        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();
        String txid;
       
        try {
            txid = activityManager.currentTransaction().toString();
        } catch (SystemException se) {
            throw new RuntimeException("Error on getting TX id from BusinessActivityManager", se);
        }
       
        if(participantRegistry.keySet().contains(txid) && ServiceCommand.isPresent(REUSE_BA_PARTICIPANT, serviceCommands)) {
            log.info("[BA PARTICIPANT COMPL SERVICE] Reusing BA participant manager - command: " + REUSE_BA_PARTICIPANT);
            participantManager = participantRegistry.get(txid);
        } else {
            try {
                // Enlist the Participant for this service:
                BAParticipantCompletionParticipant participant = new BAParticipantCompletionParticipant(serviceCommands, eventLog, value);
                log.info("[BA PARTICIPANT COMPL SERVICE] Enlisting a participant into the BA");
                participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(participant,
                        "BAParticipantCompletition:" + new Uid().toString());
                participantRegistry.put(txid, participantManager);
            } catch (Exception e) {
                log.error("[BA PARTICIPANT COMPL SERVICE]  Participant enlistment failed", e);
                throw new RuntimeException("Error enlisting participant", e);
View Full Code Here

    @WebMethod
    public void addValueToSet(String value) throws AlreadyInSetException, SetServiceException {

        System.out.println("[SERVICE] invoked addValueToSet('" + value + "')");

        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();

        /*
         * get the transaction context of this thread:
         */
        String transactionId;
        try {
            transactionId = activityManager.currentTransaction().toString();
        } catch (SystemException e) {
            throw new SetServiceException("Unable to lookup existing BusinesActivity", e);
        }

        /*
         * Lookup existing participant or register new participant
         */
        SetParticipantBA participantBA = SetParticipantBA.getParticipant(transactionId);

        if (participantBA == null) {
            try {
                // enlist the Participant for this service:
                SetParticipantBA participant = new SetParticipantBA(transactionId, value);
                SetParticipantBA.recordParticipant(transactionId, participant);

                System.out.println("[SERVICE] Enlisting a participant into the BA");
                activityManager.enlistForBusinessAgreementWithCoordinatorCompletion(participant, "SetServiceBAImpl:"
                        + UUID.randomUUID());
            } catch (Exception e) {
                System.err.println("Participant enlistment failed");
                throw new SetServiceException("Error enlisting participant", e);
            }
View Full Code Here

        BAParticipantManager participantManager;

        try {
            // enlist the Participant for this service:
            SetParticipantBA participant = new SetParticipantBA(value);
            BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();
            System.out.println("[SERVICE] Enlisting a participant into the BA");
            participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(participant,
                    "SetServiceBAImpl:" + UUID.randomUUID());
        } catch (Exception e) {
            System.err.println("Participant enlistment failed");
            e.printStackTrace(System.err);
            throw new SetServiceException("Error enlisting participant", e);
View Full Code Here

    {
        TheatreView theatreView = TheatreView.getSingletonInstance();
        TheatreManager theatreManager = TheatreManager.getSingletonInstance();

        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();

        // get the transaction context of this thread:
        String transactionId = null;
        try
        {
            transactionId = activityManager.currentTransaction().toString();
        }
        catch (SystemException e)
        {
            System.err.println("bookSeats: unable to obtain a transaction context!");
            e.printStackTrace(System.err);
            return false;
        }

        System.out.println("TheatreServiceBA transaction id =" + transactionId);

        theatreView.addMessage("******************************");

        theatreView.addPrepareMessage("id:" + transactionId + ". Received a theatre booking request for " + how_many + " seats in area " + which_area);
        theatreView.updateFields();

        theatreManager.bookSeats(transactionId, how_many, which_area);

        if (theatreManager.prepareSeats(transactionId))
        {
            theatreView.addMessage("id:" + transactionId + ". Seats prepared, trying to commit and enlist compensation Participant");
            theatreView.updateFields();

            TheatreParticipantBA theatreParticipant = new TheatreParticipantBA(transactionId, how_many, which_area);
            // enlist the Participant for this service:
            BAParticipantManager participantManager = null;
            try
            {
                participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(theatreParticipant, "org.jboss.jbossts.xts-demo:restaurantBA:" + new Uid().toString());
            }
            catch (Exception e)
            {
                theatreView.addMessage("id:" + transactionId + ". Participant enrolement failed");
                theatreManager.cancelSeats(transactionId);
View Full Code Here

            int how_many)
    {
        RestaurantView restaurantView = RestaurantView.getSingletonInstance();
        RestaurantManager restaurantManager = RestaurantManager.getSingletonInstance();

        BusinessActivityManager activityManager = BusinessActivityManagerFactory.businessActivityManager();

        // get the transaction context of this thread:
        String transactionId = null;
        try
        {
            transactionId = activityManager.currentTransaction().toString();
        }
        catch (SystemException e)
        {
            System.err.println("bookSeats: unable to obtain a transaction context!");
            e.printStackTrace(System.err);
            return false;
        }

        // log the event:
        System.out.println("RestaurantServiceBA transaction id =" + transactionId);

        restaurantView.addMessage("******************************");

        restaurantView.addPrepareMessage("id:" + transactionId + ". Received a booking request for one table of " + how_many + " people");
        restaurantView.updateFields();

        // invoke the backend business logic:
        restaurantManager.bookSeats(transactionId, how_many);

        // attempt to finalise the booking
        // (it will be compensated later if necessary)
        if (restaurantManager.prepareSeats(transactionId))
        {
            restaurantView.addMessage("id:" + transactionId + ". Seats prepared, trying to commit and enlist compensation Participant");
            restaurantView.updateFields();

            // it worked, so now we need a participant enlisted in case of compensation:

            RestaurantParticipantBA restaurantParticipant = new RestaurantParticipantBA(transactionId, how_many);
            // enlist the Participant for this service:
            BAParticipantManager participantManager = null;
            try
            {
                participantManager = activityManager.enlistForBusinessAgreementWithParticipantCompletion(restaurantParticipant, "org.jboss.jbossts.xts-demo:restaurantBA:" + new Uid().toString());
            }
            catch (Exception e)
            {
                restaurantView.addMessage("id:" + transactionId + ". Participant enrolement failed");
                restaurantManager.cancelSeats(transactionId);
View Full Code Here

TOP

Related Classes of com.arjuna.mw.wst11.service.JaxBaseHeaderContextProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.