/** * fetch the coordination context type stashed in the current BA context implememtation and use it * to construct an instance of the coordination context extension type we need to send down the * wire to the activation coordinator * * @param current the current AT context implememtation * @return an instance of the coordination context extension type */ private CoordinationContext getContext(TxContextImple current) { CoordinationContextType contextType = getContextType(current); CoordinationContext context = new CoordinationContext(); context.setCoordinationType(contextType.getCoordinationType()); context.setExpires(contextType.getExpires()); context.setIdentifier(contextType.getIdentifier()); context.setRegistrationService(contextType.getRegistrationService()); return context; }
public CreateCoordinationContextResponseType createCoordinationContext( final CreateCoordinationContextType createCoordinationContext, final MAP map, boolean isSecure) { final String messageId = map.getMessageID(); synchronized (messageIdMap) { messageIdMap.put( messageId, new CreateCoordinationContextDetails(createCoordinationContext, map)); messageIdMap.notifyAll(); } String coordinationType = createCoordinationContext.getCoordinationType(); if (TestUtil.INVALID_CREATE_PARAMETERS_COORDINATION_TYPE.equals(coordinationType)) { try { 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("Invalid create parameters"); throw new SOAPFaultException(soapFault); } catch (Throwable th) { throw new ProtocolException(th); } } // we have to return a value so lets cook one up CreateCoordinationContextResponseType createCoordinationContextResponseType = new CreateCoordinationContextResponseType(); CoordinationContext coordinationContext = new CoordinationContext(); coordinationContext.setCoordinationType(coordinationType); coordinationContext.setExpires(createCoordinationContext.getExpires()); String identifier = nextIdentifier(); CoordinationContextType.Identifier identifierInstance = new CoordinationContextType.Identifier(); identifierInstance.setValue(identifier); coordinationContext.setIdentifier(identifierInstance); W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); builder.serviceName(CoordinationConstants.REGISTRATION_SERVICE_QNAME); builder.endpointName(CoordinationConstants.REGISTRATION_ENDPOINT_QNAME); builder.address(TestUtil.PROTOCOL_COORDINATOR_SERVICE); W3CEndpointReference registrationService = builder.build(); coordinationContext.setRegistrationService(TestUtil11.getRegistrationEndpoint(identifier)); createCoordinationContextResponseType.setCoordinationContext(coordinationContext); return createCoordinationContextResponseType; }