Examples of BusinessActivityManager


Examples of com.arjuna.mw.wst.BusinessActivityManager

  boolean passed = false;
 
  try
  {
      UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
      BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
      com.arjuna.wst.BAParticipantManager bpm1 = null;
      com.arjuna.wst.BAParticipantManager bpm2 = null;
      DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, "1234");
      FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_COMPENSATE, "5678");
     
      uba.begin();
     
      bpm1 = bam.enlistForBusinessAgreementWithParticipantCompletion(p, "1234");
      bpm2 = bam.enlistForBusinessAgreementWithParticipantCompletion(fp, "5678");

      bpm1.completed();
      bpm2.completed();
     
      uba.cancel();
View Full Code Here

Examples of com.arjuna.mw.wst.BusinessActivityManager

            /*
             * There should either be an Atomic Transaction *or* a Business Activity
             * associated with the thread.
             */
            final TransactionManager transactionManager = TransactionManagerFactory.transactionManager() ;
            final BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager() ;

            final Context atContext ;
            if (transactionManager != null)
            {
                final com.arjuna.mwlabs.wst.at.context.TxContextImple txContext =
                    (com.arjuna.mwlabs.wst.at.context.TxContextImple)transactionManager.currentTransaction() ;
                atContext = (txContext == null ? null : txContext.context()) ;
            }
            else
            {
                atContext = null ;
            }

            final Context baContext ;
            if (businessActivityManager != null)
            {
                final com.arjuna.mwlabs.wst.ba.context.TxContextImple txContext =
                    (com.arjuna.mwlabs.wst.ba.context.TxContextImple)businessActivityManager.currentTransaction() ;
                baContext = (txContext == null ? null : txContext.context()) ;
            }
            else
            {
                baContext = null ;
View Full Code Here

Examples of com.arjuna.mw.wst.BusinessActivityManager

  boolean passed = false;
 
  try
  {
      UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
      BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
      com.arjuna.wst.BAParticipantManager bpm = null;
      String participantId = "1234";
      DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.COMPENSATE, participantId);
     
      uba.begin();
     
      bpm = bam.enlistForBusinessAgreementWithParticipantCompletion(p, participantId);

      bpm.completed();
     
      uba.cancel();
View Full Code Here

Examples of com.arjuna.mw.wst.BusinessActivityManager

            /*
             * There should either be an Atomic Transaction *or* a Business Activity
             * associated with the thread.
             */
            final TransactionManager transactionManager = TransactionManagerFactory.transactionManager() ;
            final BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager() ;

            final Context atContext ;
            if (transactionManager != null)
            {
                final com.arjuna.mwlabs.wst.at.context.TxContextImple txContext =
                    (com.arjuna.mwlabs.wst.at.context.TxContextImple)transactionManager.currentTransaction() ;
                atContext = (txContext == null ? null : txContext.context()) ;
            }
            else
            {
                atContext = null ;
            }
           
            final Context baContext ;
            if (businessActivityManager != null)
            {
                final com.arjuna.mwlabs.wst.ba.context.TxContextImple txContext =
                    (com.arjuna.mwlabs.wst.ba.context.TxContextImple)businessActivityManager.currentTransaction() ;
                baContext = (txContext == null ? null : txContext.context()) ;
            }
            else
            {
                baContext = null ;
View Full Code Here

Examples of com.arjuna.mw.wst.BusinessActivityManager

  boolean passed = false;
 
  try
  {
      UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
      BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
      DemoBusinessParticipant p = new DemoBusinessParticipant(DemoBusinessParticipant.CLOSE, "1234");
      FailureBusinessParticipant fp = new FailureBusinessParticipant(FailureBusinessParticipant.FAIL_IN_CLOSE, "5678");
     
      uba.begin();
     
      bam.enlistForBusinessAgreementWithParticipantCompletion(p, null);
      bam.enlistForBusinessAgreementWithParticipantCompletion(fp, null);
     
      uba.close();

      passed = p.passed();
  }
View Full Code Here

Examples of com.arjuna.mw.wst.BusinessActivityManager

  boolean passed = false;
 
  try
  {
      UserBusinessActivity uba = UserBusinessActivity.getUserBusinessActivity();
      BusinessActivityManager bam = BusinessActivityManager.getBusinessActivityManager();
      DemoBusinessParticipantWithComplete p = new DemoBusinessParticipantWithComplete(DemoBusinessParticipantWithComplete.COMPLETE, "1234");
     
      uba.begin();
     
      bam.enlistForBusinessAgreementWithCoordinatorCompletion(p, "1234");

      uba.complete();
     
      uba.cancel();
View Full Code Here

Examples of com.arjuna.mw.wst11.BusinessActivityManager

    @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

Examples of com.arjuna.mw.wst11.BusinessActivityManager

        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

Examples of com.arjuna.mw.wst11.BusinessActivityManager

        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

Examples of com.arjuna.mw.wst11.BusinessActivityManager

    @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
TOP
Copyright © 2018 www.massapi.com. 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.