Author: dasarath
Date: Fri Jan  6 21:34:18 2006
New Revision: 366672

URL: http://svn.apache.org/viewcvs?rev=366672&view=rev
Log: (empty)

Modified:
    
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/ActivationStub.java
    
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationContext.java
    
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinatorImpl.java
    
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationImpl.java

Modified: 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/ActivationStub.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/ActivationStub.java?rev=366672&r1=366671&r2=366672&view=diff
==============================================================================
--- 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/ActivationStub.java
 (original)
+++ 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/ActivationStub.java
 Fri Jan  6 21:34:18 2006
@@ -24,6 +24,7 @@
 import org.apache.axis.message.addressing.EndpointReference;
 import org.apache.axis.types.URI;
 import org.apache.axis.types.URI.MalformedURIException;
+import org.apache.ws.transaction.utility.AddressingHeaders;
 import org.apache.ws.transaction.utility.Service;
 import org.apache.ws.transaction.utility.TCPSnifferHelper;
 import org.apache.ws.transaction.wscoor.ActivationPortTypeRPCBindingStub;
@@ -40,7 +41,9 @@
        public ActivationStub(EndpointReference epr) throws AxisFault,
                        MalformedURLException {
                super(new 
URL(TCPSnifferHelper.redirect(epr.getAddress().toString())),
-                               new Service(epr));
+                               new Service());
+               AddressingHeaders headers = new AddressingHeaders(epr, null);
+               ((Service) service).setAddressingHeaders(headers);
        }
 
        public CoordinationContext createCoordinationContext(String 
coordinationType)

Modified: 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationContext.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationContext.java?rev=366672&r1=366671&r2=366672&view=diff
==============================================================================
--- 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationContext.java
 (original)
+++ 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationContext.java
 Fri Jan  6 21:34:18 2006
@@ -136,4 +136,5 @@
                        throw new RuntimeException(e);
                }
        }
+
 }

Modified: 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinatorImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinatorImpl.java?rev=366672&r1=366671&r2=366672&view=diff
==============================================================================
--- 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinatorImpl.java
 (original)
+++ 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinatorImpl.java
 Fri Jan  6 21:34:18 2006
@@ -4,13 +4,20 @@
  */
 package org.apache.ws.transaction.coordinator;
 
+import java.net.MalformedURLException;
 import java.rmi.RemoteException;
 
+import javax.xml.rpc.ServiceException;
+
 import org.apache.axis.AxisFault;
+import org.apache.axis.MessageContext;
 import org.apache.axis.components.uuid.UUIDGen;
 import org.apache.axis.components.uuid.UUIDGenFactory;
+import org.apache.axis.message.addressing.AddressingHeaders;
+import org.apache.axis.message.addressing.Constants;
 import org.apache.axis.message.addressing.EndpointReference;
 import org.apache.axis.types.URI.MalformedURIException;
+import org.apache.ws.transaction.utility.SoapFaultSender;
 import org.apache.ws.transaction.wscoor.RegisterResponseType;
 import org.apache.ws.transaction.wscoor.RegisterType;
 
@@ -19,16 +26,17 @@
  *  
  */
 public abstract class CoordinatorImpl implements Coordinator {
+       
        private String id;
-
+       
        private CoordinationContext ctx;
 
-       public CoordinatorImpl(String coordinationType)
+       protected CoordinatorImpl(String coordinationType)
                        throws MalformedURIException {
                UUIDGen gen = UUIDGenFactory.getUUIDGen();
                id = "uuid:" + gen.nextUUID();
                CoordinationService cs = CoordinationService.getInstance();
-               EndpointReference epr = cs.getRegistrationService(this);
+               EndpointReference epr = 
cs.getRegistrationCoordinatorService(this);
                ctx = new CoordinationContext(id, coordinationType, epr);
        }
 
@@ -41,16 +49,58 @@
        }
 
        public abstract EndpointReference register(String prot,
-                       EndpointReference pps) throws AxisFault;
+                       EndpointReference pps) throws 
InvalidCoordinationProtocolException;
 
        public synchronized RegisterResponseType registerOperation(
                        RegisterType params) throws RemoteException {
+               
                EndpointReference epr = null;
-               epr = register(params.getProtocolIdentifier().toString(),
-                       new 
EndpointReference(params.getParticipantProtocolService()));
+               try {
+                       epr = 
register(params.getProtocolIdentifier().toString(),
+                               new 
EndpointReference(params.getParticipantProtocolService()));
+                       
+               } catch (InvalidCoordinationProtocolException e) {
+                       throw INVALID_PROTOCOL_SOAP_FAULT;
+                       
+               } catch (IllegalStateException e) {
+                       throw INVALID_STATE_SOAP_FAULT;
+                       
+               } catch (IllegalArgumentException e) {
+                       throw INVALID_PARAMETERS_SOAP_FAULT;
+               }
+               
                RegisterResponseType r = new RegisterResponseType();
                r.setCoordinatorProtocolService(epr);
                return r;
+       }
+
+       protected AddressingHeaders getAddressingHeaders() {
+               return (AddressingHeaders) 
MessageContext.getCurrentContext().getProperty(
+                       Constants.ENV_ADDRESSING_REQUEST_HEADERS);
+       }
+
+       protected EndpointReference getReplyToEpr() {
+               AddressingHeaders headers = getAddressingHeaders();
+               return headers.getReplyTo();
+       }
+
+       protected EndpointReference getFaultToEpr() {
+               AddressingHeaders headers = getAddressingHeaders();
+               return headers.getFaultTo();
+       }
+
+       protected void throwFault(EndpointReference faultTo, AxisFault fault)
+                       throws AxisFault {
+               try {
+                       SoapFaultSender.invoke(faultTo,
+                               fault.getFaultCode().getNamespaceURI() + 
"/fault", fault);
+               } catch (MalformedURLException e) {
+                       e.printStackTrace();
+                       throw new IllegalArgumentException();
+               } catch (ServiceException e) {
+                       e.printStackTrace();
+                       throw new RuntimeException(e);
+               }
        }
 
 }

Modified: 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationImpl.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationImpl.java?rev=366672&r1=366671&r2=366672&view=diff
==============================================================================
--- 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationImpl.java
 (original)
+++ 
webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationImpl.java
 Fri Jan  6 21:34:18 2006
@@ -18,7 +18,6 @@
 
 import java.rmi.RemoteException;
 
-import org.apache.ws.transaction.utility.CallbackRegistry;
 import org.apache.ws.transaction.wscoor.RegisterResponseType;
 import org.apache.ws.transaction.wscoor.RegisterType;
 import org.apache.ws.transaction.wscoor.RegistrationPortTypeRPC;
@@ -28,7 +27,7 @@
        public RegisterResponseType registerOperation(RegisterType params)
                        throws RemoteException {
                Coordinator c = (Coordinator) 
CallbackRegistry.getInstance().correlateMessage(
-                       CallbackRegistry.COORDINATOR_REF, false);
+                       CallbackRegistry.CALLBACK_REF, false);
                return c.registerOperation(params);
        }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to