Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionCoordinatorPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -16,8 +16,8 @@ */ package org.apache.kandula.wsat.completion; -import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.OutOnlyAxisOperation; @@ -32,16 +32,10 @@ AbstractATNotifierStub { public static final String AXIS2_HOME = "."; - /** - * Constructor - * - * @throws AxisFault - */ - public CompletionCoordinatorPortTypeRawXMLStub(String axis2Home, - String axis2Xml, EndpointReference targetEndpoint) - throws AbstractKandulaException { - super(axis2Home, axis2Xml, new AxisService( - "CompletionCoordinatorPortType")); + public CompletionCoordinatorPortTypeRawXMLStub( + ConfigurationContext configurationContext, + EndpointReference targetEndpoint) throws AbstractKandulaException { + super(configurationContext); this.toEPR = targetEndpoint; // creating the operations @@ -52,23 +46,21 @@ operation.setName(new javax.xml.namespace.QName(Constants.WS_AT, "commitOperation")); operations[0] = operation; - service.addOperation(operation); +// service.addOperation(operation); operation = new OutOnlyAxisOperation(); operation.setName(new javax.xml.namespace.QName(Constants.WS_AT, "rollbackOperation")); operations[1] = operation; - service.addOperation(operation); +// service.addOperation(operation); } public void commitOperation() throws AbstractKandulaException { - // TODO must send reply to epr this.notify("Commit", Constants.WS_AT_COMMIT, 0, null); } public void rollbackOperation() throws AbstractKandulaException { - // TODO must send reply to EPR this.notify("Rollback", Constants.WS_AT_ROLLBACK, 1, null); }
Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLSkeleton.java Sat Jul 22 22:41:36 2006 @@ -22,7 +22,7 @@ import org.apache.axis2.wsdl.WSDLConstants; import org.apache.kandula.Constants; import org.apache.kandula.Status; -import org.apache.kandula.context.AbstractContext; +import org.apache.kandula.initiator.InitiatorTransaction; import org.apache.kandula.storage.StorageFactory; /** @@ -36,7 +36,7 @@ this.opContext = opContext; } - public OMElement committedOperation(OMElement requestElement) + public void committedOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -44,13 +44,12 @@ WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope().getHeader(); String requesterID = header.getFirstChildWithName( Constants.REQUESTER_ID_PARAMETER).getText(); - AbstractContext context = (AbstractContext) StorageFactory + InitiatorTransaction transaction = (InitiatorTransaction) StorageFactory .getInstance().getInitiatorStore().get(requesterID); - context.setStatus(Status.ParticipantStatus.STATUS_COMMITED); - return null; + transaction.setStatus(Status.CoordinatorStatus.STATUS_COMMITTING); } - public OMElement abortedOperation(OMElement requestElement) + public void abortedOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -58,9 +57,8 @@ WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope().getHeader(); String requesterID = header.getFirstChildWithName( Constants.REQUESTER_ID_PARAMETER).getText(); - AbstractContext context = (AbstractContext) StorageFactory + InitiatorTransaction transaction = (InitiatorTransaction) StorageFactory .getInstance().getInitiatorStore().get(requesterID); - context.setStatus(Status.ParticipantStatus.STATUS_ABORTED); - return null; + transaction.setStatus(Status.CoordinatorStatus.STATUS_ABORTING); } } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/completion/CompletionInitiatorPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -39,9 +39,8 @@ */ public CompletionInitiatorPortTypeRawXMLStub( EndpointReference targetEndpoint) throws AbstractKandulaException { - super(KandulaConfiguration.getInstance().getCoordinatorRepo(), - KandulaConfiguration.getInstance().getCoordinatorAxis2Conf(), - new AxisService("CompletionInitiatorPortType")); + super(KandulaConfiguration.getInstance() + .getCoordinatorAxis2ConfigurationContext()); this.toEPR = targetEndpoint; // creating the operations Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLSkeleton.java Sat Jul 22 22:41:36 2006 @@ -40,7 +40,7 @@ * @param requestElement * @throws AbstractKandulaException */ - public OMElement preparedOperation(OMElement requestElement) + public void preparedOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -54,18 +54,18 @@ try { coordinator.countVote(activityId, Vote.PREPARED, enlistmentId); } catch (AbstractKandulaException e) { + e.printStackTrace(); AxisFault fault = new AxisFault(e); fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } /** * @param requestElement * @throws AbstractKandulaException */ - public OMElement abortedOperation(OMElement requestElement) + public void abortedOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -83,14 +83,13 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } /** * @param requestElement * @throws AbstractKandulaException */ - public OMElement readOnlyOperation(OMElement requestElement) + public void readOnlyOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -108,14 +107,13 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } /** * @param requestElement * @throws AbstractKandulaException */ - public OMElement committedOperation(OMElement requestElement) + public void committedOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); @@ -133,18 +131,16 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } /** * @param requestElement * @throws AbstractKandulaException */ - public OMElement replayOperation(OMElement requestElement) throws AxisFault { + public void replayOperation(OMElement requestElement) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); System.out.println("Visited Replay operation"); - return null; } } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/CoordinatorPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -36,9 +36,8 @@ */ public CoordinatorPortTypeRawXMLStub(EndpointReference targetEndpoint) throws AbstractKandulaException { - super(KandulaConfiguration.getInstance().getParticipantRepository(), - KandulaConfiguration.getInstance().getParticipantAxis2Conf(), - new AxisService("CoordinatorPortType")); + super(KandulaConfiguration.getInstance() + .getPariticipantAxis2ConfigurationContext()); this.toEPR = targetEndpoint; // creating the operations @@ -76,7 +75,6 @@ } public void preparedOperation() throws AbstractKandulaException { - // must send reply to epr this.notify("Prepared", Constants.WS_AT_PREPARED, 0, null); } @@ -95,7 +93,6 @@ } public void replayOperation() throws AbstractKandulaException { - // must send reply to epr this.notify("Replay", Constants.WS_AT_REPLAY, 4, null); } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLSkeleton.java Sat Jul 22 22:41:36 2006 @@ -38,7 +38,7 @@ this.opContext = opContext; } - public OMElement prepareOperation(OMElement requestEle) throws AxisFault { + public void prepareOperation(OMElement requestEle) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); OMElement header = opContext.getMessageContext( @@ -55,11 +55,10 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } - public OMElement commitOperation(OMElement requestEle) throws AxisFault { + public void commitOperation(OMElement requestEle) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); OMElement header = opContext.getMessageContext( @@ -76,10 +75,9 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } - public OMElement rollbackOperation(OMElement requestEle) throws AxisFault { + public void rollbackOperation(OMElement requestEle) throws AxisFault { StorageFactory.getInstance().setConfigurationContext( opContext.getServiceContext().getConfigurationContext()); OMElement header = opContext.getMessageContext( @@ -96,6 +94,5 @@ fault.setFaultCode(e.getFaultCode()); throw fault; } - return null; } } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wsat/twopc/ParticipantPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -37,9 +37,8 @@ * @throws AbstractKandulaException */ public ParticipantPortTypeRawXMLStub() throws AbstractKandulaException { - super(KandulaConfiguration.getInstance().getCoordinatorRepo(), - KandulaConfiguration.getInstance().getCoordinatorAxis2Conf(), - new AxisService("ParticipantPortType")); + super(KandulaConfiguration.getInstance() + .getCoordinatorAxis2ConfigurationContext()); // creating the operations AxisOperation operation; @@ -66,7 +65,6 @@ public void prepareOperation(EndpointReference targetEndpoint) throws AbstractKandulaException { - // TODO must send reply TO epr this.toEPR = targetEndpoint; this.notify("Prepare", Constants.WS_AT_PREPARE, 0, null); @@ -74,7 +72,6 @@ public void commitOperation(EndpointReference targetEndpoint) throws AbstractKandulaException { - // TODO must send reply to epr this.toEPR = targetEndpoint; this.notify("Commit", Constants.WS_AT_COMMIT, 1, null); @@ -82,7 +79,6 @@ public void rollbackOperation(EndpointReference targetEndpoint) throws AbstractKandulaException { - // TODO must send reply to epr this.toEPR = targetEndpoint; this.notify("Rollback", Constants.WS_AT_ROLLBACK, 2, null); } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationCoordinatorPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -32,11 +32,9 @@ import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; -import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; @@ -48,10 +46,9 @@ import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.kandula.Constants; -import org.apache.kandula.context.AbstractContext; import org.apache.kandula.context.CoordinationContext; -import org.apache.kandula.context.impl.ATActivityContext; import org.apache.kandula.faults.KandulaGeneralException; +import org.apache.kandula.initiator.InitiatorTransaction; import org.apache.kandula.utility.EndpointReferenceFactory; import org.apache.kandula.utility.KandulaListener; @@ -66,8 +63,6 @@ protected AxisService service; - protected ConfigurationContext configurationContext; - protected ServiceContext serviceContext; protected EndpointReference toEPR; @@ -77,47 +72,46 @@ /** * Constructor */ - public ActivationCoordinatorPortTypeRawXMLStub(String axis2Home, - String axis2Xml, EndpointReference targetEndpoint) - throws java.lang.Exception { + public ActivationCoordinatorPortTypeRawXMLStub( + ConfigurationContext configurationContext, + EndpointReference targetEndpoint) throws java.lang.Exception { this.toEPR = targetEndpoint; service = new AxisService("ActivationCoordinatorPortType"); try { - configurationContext = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(axis2Home, - axis2Xml); configurationContext.getAxisConfiguration().addService(service); - } catch (DeploymentException e) { - throw new KandulaGeneralException(e); } catch (AxisFault e1) { throw new KandulaGeneralException(e1); } - ServiceGroupContext sgc = new ServiceGroupContext( - this.configurationContext, (AxisServiceGroup) this.service - .getParent()); + ServiceGroupContext sgc = new ServiceGroupContext(configurationContext, + (AxisServiceGroup) this.service.getParent()); this.serviceContext = new ServiceContext(service, sgc); } - public void createCoordinationContextOperation(AbstractContext context, boolean async) throws IOException, KandulaGeneralException { + public void createCoordinationContextOperation( + InitiatorTransaction initiatorTransaction, boolean async) + throws IOException, KandulaGeneralException { EndpointReference replyToEpr; MessageContext messageContext = new MessageContext(); Options options = new Options(); messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, AddressingConstants.Final.WSA_NAMESPACE); - SOAPEnvelope env = createSOAPEnvelope(context.getCoordinationType()); + SOAPEnvelope env = createSOAPEnvelope(initiatorTransaction + .getCoordinationType()); messageContext.setEnvelope(env); options.setTo(this.toEPR); options.setAction(Constants.WS_COOR_CREATE_COORDINATIONCONTEXT); if (async) { operation = new OutOnlyAxisOperation(); - operation.setName(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor","CreateCoordinationContextOperation")); + operation.setName(new javax.xml.namespace.QName( + "http://schemas.xmlsoap.org/ws/2003/09/wscoor", + "CreateCoordinationContextOperation")); service.addOperation(operation); replyToEpr = setupListener(); EndpointReferenceFactory.addReferenceProperty(replyToEpr, - Constants.REQUESTER_ID_PARAMETER, (String) context - .getProperty(AbstractContext.REQUESTER_ID)); + Constants.REQUESTER_ID_PARAMETER, initiatorTransaction + .getRequesterID()); options.setReplyTo(replyToEpr); OperationClient client = operation.createClient(serviceContext, options); @@ -125,7 +119,9 @@ client.execute(false); } else { operation = new OutInAxisOperation(); - operation.setName(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2003/09/wscoor","CreateCoordinationContextOperation")); + operation.setName(new javax.xml.namespace.QName( + "http://schemas.xmlsoap.org/ws/2003/09/wscoor", + "CreateCoordinationContextOperation")); service.addOperation(operation); OperationClient client = operation.createClient(serviceContext, options); @@ -134,15 +130,20 @@ MessageContext msgContext = client .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); OMElement response = msgContext.getEnvelope().getBody() - .getFirstChildWithName(new QName(Constants.WS_COOR,"CreateCoordinationContextResponse")); - OMElement contextElement = response.getFirstChildWithName(new QName(Constants.WS_COOR,"CoordinationContext")); - if (contextElement!=null) { - CoordinationContext coordinationContext = CoordinationContext.Factory.newContext(contextElement); - context.setCoordinationContext(coordinationContext); - } - else - { - throw new KandulaGeneralException("CoordinationContext was not found in the CreareCoordinationContextResponse Message"); + .getFirstChildWithName( + new QName(Constants.WS_COOR, + "CreateCoordinationContextResponse")); + OMElement contextElement = response + .getFirstChildWithName(new QName(Constants.WS_COOR, + "CoordinationContext")); + if (contextElement != null) { + CoordinationContext coordinationContext = CoordinationContext.Factory + .newContext(contextElement); + initiatorTransaction + .setCoordinationContext(coordinationContext); + } else { + throw new KandulaGeneralException( + "CoordinationContext was not found in the CreareCoordinationContextResponse Message"); } } @@ -190,4 +191,4 @@ listener.start(); return new EndpointReference(listener.getHost() + serviceName); } -} \ No newline at end of file +} Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/ActivationRequesterPortTypeRawXMLSkeleton.java Sat Jul 22 22:41:36 2006 @@ -21,8 +21,8 @@ import org.apache.axis2.context.OperationContext; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.kandula.Constants; -import org.apache.kandula.context.AbstractContext; import org.apache.kandula.context.CoordinationContext; +import org.apache.kandula.initiator.InitiatorTransaction; import org.apache.kandula.storage.StorageFactory; /** @@ -47,9 +47,9 @@ Constants.REQUESTER_ID_PARAMETER).getText(); CoordinationContext coordinationContext = CoordinationContext.Factory .newContext(response); - AbstractContext context = (AbstractContext) StorageFactory + InitiatorTransaction initiatorTransaction = (InitiatorTransaction) StorageFactory .getInstance().getInitiatorStore().get(requesterID); - context.setCoordinationContext(coordinationContext); + initiatorTransaction.setCoordinationContext(coordinationContext); } return null; } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationCoordinatorPortTypeRawXMLStub.java Sat Jul 22 22:41:36 2006 @@ -32,11 +32,9 @@ import org.apache.axis2.client.OperationClient; import org.apache.axis2.client.Options; import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; -import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; @@ -48,10 +46,10 @@ import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.kandula.Constants; -import org.apache.kandula.context.AbstractContext; -import org.apache.kandula.context.impl.ATActivityContext; +import org.apache.kandula.context.impl.ATParticipantContext; import org.apache.kandula.faults.AbstractKandulaException; import org.apache.kandula.faults.KandulaGeneralException; +import org.apache.kandula.initiator.InitiatorTransaction; import org.apache.kandula.storage.StorageFactory; import org.apache.kandula.utility.EndpointReferenceFactory; import org.apache.kandula.utility.KandulaListener; @@ -67,8 +65,6 @@ protected AxisService service; - protected ConfigurationContext configurationContext; - private ServiceContext serviceContext; private EndpointReference toEPR; @@ -78,37 +74,32 @@ /** * Constructor */ - public RegistrationCoordinatorPortTypeRawXMLStub(String axis2Home, - String axis2Xml, EndpointReference targetEndpoint) - throws AbstractKandulaException { + public RegistrationCoordinatorPortTypeRawXMLStub( + ConfigurationContext configurationContext, + EndpointReference targetEndpoint) throws AbstractKandulaException { + configurationContext = configurationContext; this.toEPR = targetEndpoint; - service = new AxisService("RegistrationCoordinatorPortType"); + service = new AxisService("annonService"+this.hashCode()); try { - configurationContext = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(axis2Home, - axis2Xml); configurationContext.getAxisConfiguration().addService(service); - } catch (DeploymentException e) { - throw new KandulaGeneralException(e); } catch (AxisFault e1) { throw new KandulaGeneralException(e1); } - ServiceGroupContext sgc = new ServiceGroupContext( - this.configurationContext, (AxisServiceGroup) this.service - .getParent()); + ServiceGroupContext sgc = new ServiceGroupContext(configurationContext, + (AxisServiceGroup) this.service.getParent()); this.serviceContext = new ServiceContext(service, sgc); } - public void registerOperation(AbstractContext context, - EndpointReference epr, boolean async) throws IOException, KandulaGeneralException { + public void registerOperation(String registrationProtocol, + String requesterID, EndpointReference epr, boolean async) + throws IOException, KandulaGeneralException { EndpointReference replyToEpr; MessageContext messageContext = new MessageContext(); Options options = new Options(); messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, AddressingConstants.Submission.WSA_NAMESPACE); - SOAPEnvelope env = createSOAPEnvelope(context - .getRegistrationProtocol(), epr); + SOAPEnvelope env = createSOAPEnvelope(registrationProtocol, epr); messageContext.setEnvelope(env); options.setTo(this.toEPR); options.setAction(Constants.WS_COOR_REGISTER); @@ -116,13 +107,12 @@ if (async) { operation = new OutOnlyAxisOperation(); operation.setName(new javax.xml.namespace.QName( - "http://schemas.xmlsoap.org/ws/2003/09/wscoor", + Constants.WS_COOR, "RegisterOperation")); service.addOperation(operation); replyToEpr = setupListener(); EndpointReferenceFactory.addReferenceProperty(replyToEpr, - Constants.REQUESTER_ID_PARAMETER, (String) context - .getProperty(AbstractContext.REQUESTER_ID)); + Constants.REQUESTER_ID_PARAMETER, requesterID); options.setReplyTo(replyToEpr); OperationClient client = operation.createClient(serviceContext, options); @@ -141,17 +131,28 @@ MessageContext msgContext = client .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); OMElement response = msgContext.getEnvelope().getBody() - .getFirstChildWithName(new QName(Constants.WS_COOR,"RegisterResponse")); - OMElement serviceElement = response.getFirstChildWithName(new QName(Constants.WS_COOR,"CoordinatorProtocolService")); - if (serviceElement!=null) { + .getFirstChildWithName( + new QName(Constants.WS_COOR, "RegisterResponse")); + OMElement serviceElement = response + .getFirstChildWithName(new QName(Constants.WS_COOR, + "CoordinatorProtocolService")); + if (serviceElement != null) { EndpointReference coordinatorService = EndpointReferenceFactory .endpointFromOM(serviceElement.getFirstElement()); - context.setProperty(ATActivityContext.COORDINATION_EPR, - coordinatorService); - } - else - { - throw new KandulaGeneralException("CoordinatorProtocolService epr was not found in the RegistrationResponse Message"); + // try to avoid following + InitiatorTransaction initiatorTransaction; + initiatorTransaction = (InitiatorTransaction) StorageFactory + .getInstance().getInitiatorStore().get(requesterID); + if (initiatorTransaction == null) { + ATParticipantContext context = (ATParticipantContext) StorageFactory + .getInstance().getStore().get(requesterID); + context.setCoordinationEPR(coordinatorService); + } else { + initiatorTransaction.setCoordinationEPR(coordinatorService); + } + } else { + throw new KandulaGeneralException( + "CoordinatorProtocolService epr was not found in the RegistrationResponse Message"); } } Modified: webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java?rev=424676&r1=424675&r2=424676&view=diff ============================================================================== --- webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java (original) +++ webservices/kandula/trunk/java/src/org/apache/kandula/wscoor/RegistrationRequesterPortTypeRawXMLSkeleton.java Sat Jul 22 22:41:36 2006 @@ -17,15 +17,13 @@ package org.apache.kandula.wscoor; import org.apache.axiom.om.OMElement; -import org.apache.axiom.om.OMException; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.OperationContext; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.kandula.Constants; -import org.apache.kandula.context.AbstractContext; -import org.apache.kandula.context.impl.ATActivityContext; +import org.apache.kandula.context.impl.ATParticipantContext; +import org.apache.kandula.initiator.InitiatorTransaction; import org.apache.kandula.storage.StorageFactory; import org.apache.kandula.utility.EndpointReferenceFactory; @@ -40,28 +38,29 @@ this.opContext = opContext; } - public OMElement registerResponseOperation(OMElement responseElement) throws AxisFault{ + public OMElement registerResponseOperation(OMElement responseElement) + throws AxisFault { OMElement response = responseElement.getFirstElement(); if ("CoordinatorProtocolService".equals(response.getLocalName())) { OMElement header = opContext.getMessageContext( - WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope().getHeader(); + WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope() + .getHeader(); String requesterID = header.getFirstChildWithName( Constants.REQUESTER_ID_PARAMETER).getText(); EndpointReference coordinatorService = EndpointReferenceFactory .endpointFromOM(response.getFirstElement()); - AbstractContext context; - - context = (AbstractContext) StorageFactory.getInstance() - .getInitiatorStore().get(requesterID); - if (context == null) { - context = (AbstractContext) StorageFactory.getInstance() - .getStore().get(requesterID); + InitiatorTransaction initiatorTransaction; + initiatorTransaction = (InitiatorTransaction) StorageFactory + .getInstance().getInitiatorStore().get(requesterID); + if (initiatorTransaction == null) { + ATParticipantContext context = (ATParticipantContext) StorageFactory + .getInstance().getStore().get(requesterID); + context.setCoordinationEPR(coordinatorService); + } else { + initiatorTransaction.setCoordinationEPR(coordinatorService); } - - context.setProperty(ATActivityContext.COORDINATION_EPR, - coordinatorService); } return null; } -} \ No newline at end of file +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
