Search in sources :

Example 61 with InstanceIdentifier

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

the class CompletionCoordinatorRPCProcessorImpl method commit.

/**
 * Commit.
 * @param commit The commit notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public boolean commit(final Notification commit, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier);
    {
        try {
            if (participant != null) {
                try {
                    participant.commit();
                } catch (final TransactionRolledBackException trbe) {
                    return false;
                } 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_CompletionCoordinatorProcessorImpl_1());
                    throw new SOAPFaultException(soapFault);
                } catch (final SystemException se) {
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_2());
                    throw new SOAPFaultException(soapFault);
                } catch (final Throwable th) {
                    if (WSTLogger.logger.isTraceEnabled()) {
                        WSTLogger.logger.tracev("Unexpected exception thrown from commit:", th);
                    }
                    SOAPFactory factory = SOAPFactory.newInstance();
                    SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                    soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_2());
                    throw new SOAPFaultException(soapFault);
                }
                return true;
            } else {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Commit 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_CompletionCoordinatorProcessorImpl_5());
                throw new SOAPFaultException(soapFault);
            }
        } catch (SOAPException se) {
            se.printStackTrace(System.err);
            throw new ProtocolException(se);
        }
    }
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) SOAPException(javax.xml.soap.SOAPException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPFault(javax.xml.soap.SOAPFault) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) CompletionCoordinatorParticipant(com.arjuna.wst11.CompletionCoordinatorParticipant) SOAPFactory(javax.xml.soap.SOAPFactory)

Example 62 with InstanceIdentifier

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

the class CompletionCoordinatorRPCProcessorImpl method rollback.

/**
 * Rollback.
 * @param rollback The rollback notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public boolean rollback(final Notification rollback, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CompletionCoordinatorParticipant participant = getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            final String messageId = MessageId.getMessageId();
            try {
                participant.rollback();
                return true;
            } 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_CompletionCoordinatorProcessorImpl_6());
                throw new SOAPFaultException(soapFault);
            } catch (final SystemException se) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_7());
                throw new SOAPFaultException(soapFault);
            } catch (final Throwable th) {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Unexpected exception thrown from commit:", th);
                }
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME);
                soapFault.addDetail().addDetailEntry(ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME).addTextNode(WSTLogger.i18NLogger.get_wst11_messaging_CompletionCoordinatorProcessorImpl_7());
                throw new SOAPFaultException(soapFault);
            }
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Rollback 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_CompletionCoordinatorProcessorImpl_10());
            throw new SOAPFaultException(soapFault);
        }
    } catch (SOAPException se) {
        se.printStackTrace(System.err);
        throw new ProtocolException(se);
    }
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) SOAPException(javax.xml.soap.SOAPException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPFault(javax.xml.soap.SOAPFault) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) CompletionCoordinatorParticipant(com.arjuna.wst11.CompletionCoordinatorParticipant) SOAPFactory(javax.xml.soap.SOAPFactory)

Example 63 with InstanceIdentifier

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

the class CoordinatorCompletionParticipantProcessorImpl 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();
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_3(instanceIdentifier.toString());
        return;
    }
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.cancel(cancel, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_5(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendCancelled(map, arjunaContext);
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 64 with InstanceIdentifier

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

the class CoordinatorCompletionParticipantProcessorImpl method status.

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

Example 65 with InstanceIdentifier

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

the class CoordinatorCompletionParticipantProcessorImpl 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 CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_4(instanceIdentifier.toString());
        return;
    }
    if (participant != null) {
        try {
            participant.complete(complete, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from complete:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_5(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_6(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendFail(map, arjunaContext, State.STATE_ENDED.getValue());
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

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