Search in sources :

Example 71 with InstanceIdentifier

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

the class ParticipantCompletionCoordinatorProcessorImpl method getStatus.

/**
 * Get Status.
 * @param getStatus The get status notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void getStatus(final NotificationType getStatus, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier);
    if (coordinator != null) {
        try {
            coordinator.getStatus(getStatus, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from getStatus:", th);
            }
        }
    } else if (!areRecoveryLogEntriesAccountedFor()) {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("GetStatus dropped for unknown coordinator completion participant {0} while waiting on recovery scan", new Object[] { instanceIdentifier });
        }
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("GetStatus called on unknown coordinator: {0}", new Object[] { instanceIdentifier });
        }
        // send an invalid state fault
        final String messageId = MessageId.getMessageId();
        final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
        try {
            final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_ParticipantCompletionCoordinatorProcessorImpl_getStatus_4());
            AddressingHelper.installNoneReplyTo(faultMAP);
            ParticipantCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, faultMAP, getFaultAction());
        } catch (final Throwable th) {
            WSTLogger.i18NLogger.info_wst11_messaging_ParticipantCompletionCoordinatorProcessorImpl_getStatus_3(instanceIdentifier.toString(), th);
        }
    }
}
Also used : ParticipantCompletionCoordinatorInboundEvents(com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP)

Example 72 with InstanceIdentifier

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

the class ParticipantCompletionCoordinatorProcessorImpl method exit.

/**
 * Exit.
 * @param exit The exit notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void exit(final NotificationType exit, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier);
    if (coordinator != null) {
        try {
            coordinator.exit(exit, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from exit:", th);
            }
        }
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Exit called on unknown coordinator: {0}", new Object[] { instanceIdentifier });
        }
        sendExited(map, arjunaContext);
    }
}
Also used : ParticipantCompletionCoordinatorInboundEvents(com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier)

Example 73 with InstanceIdentifier

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

the class ParticipantCompletionCoordinatorProcessorImpl method compensated.

/**
 * Compensated.
 * @param compensated The compensated notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void compensated(final NotificationType compensated, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier);
    if (coordinator != null) {
        try {
            coordinator.compensated(compensated, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from compensated:", th);
            }
        }
    } else if (WSTLogger.logger.isTraceEnabled()) {
        WSTLogger.logger.tracev("Compensated called on unknown coordinator: {0}", new Object[] { instanceIdentifier });
    }
}
Also used : ParticipantCompletionCoordinatorInboundEvents(com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier)

Example 74 with InstanceIdentifier

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

the class ParticipantProcessorImpl method sendCommitted.

/**
 * Send a committed message.
 *
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
private void sendCommitted(final MAP map, final ArjunaContext arjunaContext) {
    // KEV add check for recovery
    final String messageId = MessageId.getMessageId();
    final MAP responseMAP = AddressingHelper.createResponseContext(map, messageId);
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    try {
        CoordinatorClient.getClient().sendCommitted(null, responseMAP, instanceIdentifier);
    } catch (final Throwable th) {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Unexpected exception while sending Committed", th);
        }
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Example 75 with InstanceIdentifier

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

the class TerminationCoordinatorRPCProcessorImpl method complete.

/**
 * Complete.
 * @param complete The complete notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void complete(final NotificationType complete, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final BusinessActivityTerminator participant = TerminationCoordinatorProcessor.getProcessor().getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            W3CEndpointReference endpoint = participant.getEndpoint();
            final String messageId = MessageId.getMessageId();
            try {
                participant.complete();
            } 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_12());
                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_13());
                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_13());
                throw new SOAPFaultException(soapFault);
            }
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Complete 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_12());
            throw new SOAPFaultException(soapFault);
        }
    } catch (SOAPException se) {
        se.printStackTrace(System.err);
        throw new ProtocolException(se);
    }
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) SOAPFactory(javax.xml.soap.SOAPFactory) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) BusinessActivityTerminator(com.arjuna.wst11.BusinessActivityTerminator) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) SOAPException(javax.xml.soap.SOAPException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPFault(javax.xml.soap.SOAPFault) FaultedException(com.arjuna.wst.FaultedException)

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