use of com.arjuna.wsc11.ContextFactoryMapper in project narayana by jbosstm.
the class ActivationCoordinatorProcessorImpl method createCoordinationContext.
/**
* Create the coordination context.
* @param createCoordinationContext The create coordination context request.
* @param map The addressing context.
*/
public CreateCoordinationContextResponseType createCoordinationContext(final CreateCoordinationContextType createCoordinationContext, final MAP map, final boolean isSecure) {
final ContextFactoryMapper contextFactoryMapper = ContextFactoryMapper.getMapper();
try {
final String coordinationType = createCoordinationContext.getCoordinationType();
final ContextFactory contextFactory = contextFactoryMapper.getContextFactory(coordinationType);
if (contextFactory != null) {
final CoordinationContext coordinationContext;
try {
final Expires expiresElement = createCoordinationContext.getExpires();
final Long expires = (expiresElement == null ? null : new Long(expiresElement.getValue()));
coordinationContext = contextFactory.create(coordinationType, expires, createCoordinationContext.getCurrentContext(), isSecure);
final CreateCoordinationContextResponseType response = new CreateCoordinationContextResponseType();
response.setCoordinationContext(coordinationContext);
return response;
} catch (final InvalidCreateParametersException invalidCreateParametersException) {
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME);
soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_ActivationCoordinatorProcessorImpl_1());
throw new SOAPFaultException(soapFault);
} catch (final Throwable th) {
if (WSCLogger.logger.isTraceEnabled()) {
WSCLogger.logger.tracev("Unexpected exception thrown from create:", th);
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_CREATE_CONTEXT_QNAME);
soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_CREATE_CONTEXT_QNAME).addTextNode(th.getMessage());
throw new SOAPFaultException(soapFault);
}
} else {
if (WSCLogger.logger.isTraceEnabled()) {
WSCLogger.logger.tracev("CreateCoordinationContext called for unknown coordination type: {0}", new Object[] { coordinationType });
}
SOAPFactory factory = SOAPFactory.newInstance();
SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME);
soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_ActivationCoordinatorProcessorImpl_1());
throw new SOAPFaultException(soapFault);
}
} catch (SOAPException se) {
se.printStackTrace(System.err);
throw new ProtocolException(se);
}
}
use of com.arjuna.wsc11.ContextFactoryMapper in project narayana by jbosstm.
the class TestInitialisation method testTeardown.
public static void testTeardown() {
final ContextFactoryMapper contextFactoryMapper = ContextFactoryMapper.getMapper();
contextFactoryMapper.removeContextFactory(TestUtil.COORDINATION_TYPE);
contextFactoryMapper.removeContextFactory(TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE);
final RegistrarMapper registrarMapper = RegistrarMapper.getFactory();
registrarMapper.removeRegistrar(TestUtil.PROTOCOL_IDENTIFIER);
registrarMapper.removeRegistrar(TestUtil.ALREADY_REGISTERED_PROTOCOL_IDENTIFIER);
registrarMapper.removeRegistrar(TestUtil.INVALID_PROTOCOL_PROTOCOL_IDENTIFIER);
registrarMapper.removeRegistrar(TestUtil.INVALID_STATE_PROTOCOL_IDENTIFIER);
registrarMapper.removeRegistrar(TestUtil.NO_ACTIVITY_PROTOCOL_IDENTIFIER);
}
use of com.arjuna.wsc11.ContextFactoryMapper in project narayana by jbosstm.
the class TestInitialisation method testSetup.
public static void testSetup() {
final ContextFactoryMapper contextFactoryMapper = ContextFactoryMapper.getMapper();
final TestContextFactory testContextFactory = new TestContextFactory(TestUtil.COORDINATION_TYPE);
contextFactoryMapper.addContextFactory(TestUtil.COORDINATION_TYPE, testContextFactory);
contextFactoryMapper.addContextFactory(TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE, testContextFactory);
final RegistrarMapper registrarMapper = RegistrarMapper.getFactory();
final TestRegistrar testRegistrar = new TestRegistrar();
registrarMapper.addRegistrar(TestUtil.PROTOCOL_IDENTIFIER, testRegistrar);
registrarMapper.addRegistrar(TestUtil.ALREADY_REGISTERED_PROTOCOL_IDENTIFIER, testRegistrar);
registrarMapper.addRegistrar(TestUtil.INVALID_PROTOCOL_PROTOCOL_IDENTIFIER, testRegistrar);
registrarMapper.addRegistrar(TestUtil.INVALID_STATE_PROTOCOL_IDENTIFIER, testRegistrar);
registrarMapper.addRegistrar(TestUtil.NO_ACTIVITY_PROTOCOL_IDENTIFIER, testRegistrar);
}
Aggregations