Search in sources :

Example 76 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class TerminationCoordinatorRPCProcessorImpl method cancel.

/**
 * Cancel.
 * @param cancel The cancel notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void cancel(final NotificationType cancel, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            try {
                participant.cancel();
            } catch (FaultedException fm) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.FAULTED_ERROR_CODE_QNAME);
                throw new SOAPFaultException(soapFault);
            } catch (final UnknownTransactionException ute) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
                throw new SOAPFaultException(soapFault);
            } catch (final SystemException se) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2());
                throw new SOAPFaultException(soapFault);
            } catch (final Throwable th) {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Unexpected exception thrown from close:", th);
                }
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_RECEIVER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2());
                throw new SOAPFaultException(soapFault);
            }
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
            }
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME);
            soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
            throw new SOAPFaultException(soapFault);
        }
    } catch (SOAPException se) {
        se.printStackTrace(System.err);
        throw new ProtocolException(se);
    }
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) BusinessActivityTerminator(com.arjuna.wst11.BusinessActivityTerminator) SOAPException(javax.xml.soap.SOAPException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPFault(javax.xml.soap.SOAPFault) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) FaultedException(com.arjuna.wst.FaultedException) SOAPFactory(javax.xml.soap.SOAPFactory)

Example 77 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class CoordinatorEngine method sendUnknownTransaction.

/**
 * Send the UnknownTransaction message.
 */
private void sendUnknownTransaction(final MAP map, final ArjunaContext arjunaContext) {
    try {
        final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
        final String message = WSTLogger.i18NLogger.get_wst11_messaging_engines_CoordinatorEngine_sendUnknownTransaction_1();
        final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, AtomicTransactionConstants.WSAT_ERROR_CODE_UNKNOWN_TRANSACTION_QNAME, message);
        ParticipantClient.getClient().sendSoapFault(faultMAP, soapFault, instanceIdentifier);
    } catch (final Throwable th) {
        WSTLogger.i18NLogger.warn_wst11_messaging_engines_CoordinatorEngine_sendUnknownTransaction_2(id, th);
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP)

Example 78 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class ParticipantEngine method sendPrepared.

/**
 * Send the prepared message.
 *
 * @param timedOut true if this is in response to a comms timeout
 */
private void sendPrepared(boolean timedOut) {
    final MAP responseAddressingContext = createContext();
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id);
    try {
        CoordinatorClient.getClient().sendPrepared(coordinator, responseAddressingContext, instanceIdentifier);
    } catch (final Throwable th) {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Unexpected exception while sending Prepared", th);
        }
    }
    updateResendPeriod(timedOut);
    initiateTimer();
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Example 79 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class ParticipantEngine method sendAborted.

/**
 * Send the aborted message.
 */
private void sendAborted() {
    final MAP responseAddressingContext = createContext();
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id);
    try {
        CoordinatorClient.getClient().sendAborted(coordinator, responseAddressingContext, instanceIdentifier);
    } catch (final Throwable th) {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Unexpected exception while sending Aborted", th);
        }
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Example 80 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class ParticipantEngine method sendReadOnly.

/**
 * Send the read only message.
 */
private void sendReadOnly() {
    final MAP responseAddressingContext = createContext();
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier(id);
    try {
        CoordinatorClient.getClient().sendReadOnly(coordinator, responseAddressingContext, instanceIdentifier);
    } catch (final Throwable th) {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Unexpected exception while sending ReadOnly", th);
        }
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Aggregations

InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)130 MAP (org.jboss.ws.api.addressing.MAP)83 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)53 Test (org.junit.Test)51 SoapFault11 (com.arjuna.webservices11.SoapFault11)24 SoapFault (com.arjuna.webservices.SoapFault)20 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)13 SystemException (com.arjuna.wst.SystemException)13 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)13 QName (javax.xml.namespace.QName)12 CoordinatorCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)10 ParticipantCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)10 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)10 SoapFaultType (com.arjuna.webservices.SoapFaultType)9 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)9 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)9 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)9 ProtocolException (javax.xml.ws.ProtocolException)9