use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class BusinessActivityTerminatorStub method close.
public void close() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
final RequestCallback callback = new RequestCallback();
final TerminationParticipantProcessor terminationParticipantProcessor = TerminationParticipantProcessor.getProcessor();
terminationParticipantProcessor.registerCallback(_id, callback);
try {
TerminationCoordinatorClient.getClient().sendClose(_terminationCoordinator, map, new InstanceIdentifier(_id));
callback.waitUntilTriggered();
} catch (final Throwable th) {
throw new SystemException();
} finally {
terminationParticipantProcessor.removeCallback(_id);
}
if (callback.hasTriggered()) {
if (callback.receivedClosed()) {
return;
}
final SoapFault soapFault = callback.getSoapFault();
if (soapFault != null) {
final QName subcode = soapFault.getSubcode();
if (ArjunaTXConstants.TRANSACTIONROLLEDBACK_ERROR_CODE_QNAME.equals(subcode)) {
throw new TransactionRolledBackException();
} else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode)) {
throw new UnknownTransactionException();
}
}
}
throw new SystemException();
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class CompletionStub method commit.
public void commit() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
completionInitiator.registerCallback(_id, callback);
try {
CompletionCoordinatorClient.getClient().sendCommit(_completionCoordinator, map, new InstanceIdentifier(_id));
callback.waitUntilTriggered();
} catch (final Throwable th) {
th.printStackTrace();
throw new SystemException();
} finally {
completionInitiator.removeCallback(_id);
}
if (callback.hasTriggered()) {
if (callback.receivedCommitted()) {
return;
} else if (callback.receivedAborted()) {
throw new TransactionRolledBackException();
}
final SoapFault soapFault = callback.getSoapFault();
if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
throw new UnknownTransactionException();
}
}
throw new SystemException();
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class CompletionStub method rollback.
public void rollback() throws UnknownTransactionException, SystemException {
final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
completionInitiator.registerCallback(_id, callback);
try {
CompletionCoordinatorClient.getClient().sendRollback(_completionCoordinator, map, new InstanceIdentifier(_id));
callback.waitUntilTriggered();
} catch (final Throwable th) {
th.printStackTrace();
throw new SystemException();
} finally {
completionInitiator.removeCallback(_id);
}
if (callback.hasTriggered()) {
if (callback.receivedAborted()) {
return;
}
final SoapFault soapFault = callback.getSoapFault();
if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
throw new UnknownTransactionException();
}
}
throw new SystemException();
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class RegistrationTest method executeRequest.
private void executeRequest(final String messageId, final InstanceIdentifier instanceIdentifier) throws Exception {
final String protocolIdentifier = "http://foo.example.org/bar";
final W3CEndpointReference participantProtocolEndpoint = TestUtil11.getProtocolParticipantEndpoint("participant");
String identifier = (instanceIdentifier != null ? instanceIdentifier.getInstanceIdentifier() : null);
W3CEndpointReference registerEndpoint = TestUtil11.getRegistrationEndpoint(identifier);
RegisterType registerType = new RegisterType();
registerType.setProtocolIdentifier(protocolIdentifier);
registerType.setParticipantProtocolService(participantProtocolEndpoint);
RegistrationPortType port = WSCOORClient.getRegistrationPort(registerEndpoint, CoordinationConstants.WSCOOR_ACTION_REGISTER, messageId);
port.registerOperation(registerType);
final RegisterDetails details = testRegistrationCoordinatorProcessor.getRegisterDetails(messageId, 10000);
final RegisterType requestRegister = details.getRegister();
final MAP requestMap = details.getMAP();
final ArjunaContext requestArjunaContext = details.getArjunaContext();
assertEquals(requestMap.getTo(), TestUtil11.registrationCoordinatorService);
assertEquals(requestMap.getMessageID(), messageId);
if (instanceIdentifier == null) {
assertNull(requestArjunaContext);
} else {
assertEquals(instanceIdentifier.getInstanceIdentifier(), requestArjunaContext.getInstanceIdentifier().getInstanceIdentifier());
}
assertEquals(protocolIdentifier, requestRegister.getProtocolIdentifier());
}
use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.
the class TerminationParticipantClient method sendSoapFault.
/**
* Send a fault.
* @param endpoint the endpoint reference to notify
* @param map The addressing context.
* @param soapFault The SOAP fault.
* @param identifier The arjuna instance identifier.
* @throws com.arjuna.webservices.SoapFault For any errors.
* @throws java.io.IOException for any transport errors.
*/
public void sendSoapFault(final W3CEndpointReference endpoint, final MAP map, final SoapFault soapFault, final InstanceIdentifier identifier) throws SoapFault, IOException {
// AddressingHelper.installFrom(map, terminationCoordinator, identifier);
AddressingHelper.installNoneReplyTo(map);
final TerminationParticipantPortType port = getPort(endpoint, map, identifier, soapFaultAction);
SoapFault11 soapFault11 = (SoapFault11) soapFault;
Fault fault = soapFault11.toFault();
port.faultOperation(fault);
}
Aggregations