use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class TerminationCoordinatorProcessorImpl 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 = getParticipant(instanceIdentifier);
try {
if (participant != null) {
W3CEndpointReference endpoint = participant.getEndpoint();
final String messageId = MessageId.getMessageId();
try {
participant.cancel();
} catch (final FaultedException fe) {
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
} catch (final UnknownTransactionException ute) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final SystemException se) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2();
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(th);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
}
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendCancelled(endpoint, responseMAP, instanceIdentifier);
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
}
} catch (Throwable throwable) {
throwable.printStackTrace(System.err);
}
}
use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class TerminationCoordinatorProcessorImpl 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 = getParticipant(instanceIdentifier);
try {
if (participant != null) {
W3CEndpointReference endpoint = participant.getEndpoint();
final String messageId = MessageId.getMessageId();
try {
participant.complete();
} catch (final FaultedException fe) {
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
} catch (final UnknownTransactionException ute) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final SystemException se) {
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13();
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from complete:", th);
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
final SoapFault soapFault = new SoapFault11(th);
TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
return;
}
final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
TerminationParticipantClient.getClient().sendCompleted(endpoint, responseMAP, instanceIdentifier);
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
}
final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_16());
TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
}
} catch (Throwable throwable) {
throwable.printStackTrace(System.err);
}
}
use of com.arjuna.wst.FaultedException 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);
}
}
use of com.arjuna.wst.FaultedException 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);
}
}
use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class ParticipantCompletionParticipantEngine method executeCompensate.
/**
* Execute the compensate transition.
*/
private void executeCompensate() {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".executeCompensate. Participant: " + participant);
}
try {
participant.compensate();
} catch (final FaultedException fe) {
WSTLogger.i18NLogger.warn_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_1(fe);
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev(fe, "Faulted exception from participant compensate for WS-BA participant");
}
// fail here because the participant doesn't want to retry the compensate
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
return;
} catch (final Throwable th) {
final State current;
synchronized (this) {
current = state;
if (current == State.STATE_COMPENSATING) {
changeState(State.STATE_COMPLETED);
}
}
if (current == State.STATE_COMPENSATING) {
initiateTimer();
}
WSTLogger.i18NLogger.warn_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_2(th);
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev(th, "Unexpected exception from participant compensate for WS-BA participant");
}
return;
}
final State current;
boolean failRequired = false;
synchronized (this) {
current = state;
if (current == State.STATE_COMPENSATING) {
if (persisted) {
if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
// we have to fail since we don't want to run the compensate method again
WSTLogger.i18NLogger.warn_wst11_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_3(id);
failRequired = true;
changeState(State.STATE_FAILING_COMPENSATING);
}
}
// we will send the compensate after we exit the synchronized block
if (!failRequired) {
ended();
}
}
}
if (failRequired) {
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
} else if (current == State.STATE_COMPENSATING) {
sendCompensated();
}
}
Aggregations