You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kandula-dev@ws.apache.org by da...@apache.org on 2006/01/07 06:34:43 UTC

svn commit: r366673 - in /webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator: CoordinationService.java Coordinator.java RegistrationStub.java

Author: dasarath
Date: Fri Jan  6 21:34:40 2006
New Revision: 366673

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

Modified:
    webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationService.java
    webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/Coordinator.java
    webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationStub.java

Modified: webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationService.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationService.java?rev=366673&r1=366672&r2=366673&view=diff
==============================================================================
--- webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationService.java (original)
+++ webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/CoordinationService.java Fri Jan  6 21:34:40 2006
@@ -8,13 +8,12 @@
 
 import org.apache.axis.message.MessageElement;
 import org.apache.axis.message.addressing.EndpointReference;
-import org.apache.axis.message.addressing.PortType;
 import org.apache.axis.message.addressing.ReferencePropertiesType;
 import org.apache.axis.types.URI.MalformedURIException;
+import org.apache.ws.transaction.KandulaConfig;
 import org.apache.ws.transaction.coordinator.at.ATCoordinator;
 import org.apache.ws.transaction.coordinator.at.ATCoordinatorImpl;
-import org.apache.ws.transaction.utility.CallbackRegistry;
-import org.apache.ws.transaction.utility.EndpointReferenceFactory;
+import org.apache.ws.transaction.coordinator.at.AbstractParticipant;
 import org.apache.ws.transaction.wscoor.ActivationPortTypeRPC;
 import org.apache.ws.transaction.wscoor.CreateCoordinationContextResponseType;
 import org.apache.ws.transaction.wscoor.CreateCoordinationContextType;
@@ -25,23 +24,11 @@
  *  
  */
 public class CoordinationService implements ActivationPortTypeRPC {
-	public static PortType ACTIVATION_SERVICE = new PortType(
-			"http://schemas.xmlsoap.org/ws/2004/10/wscoor",
-			"ActivationPortTypeRPC");
-
-	public static PortType COMPLETION_COORDINATOR_SERVICE = new PortType(
-			"http://schemas.xmlsoap.org/ws/2004/10/wsat",
-			"CompletionCoordinatorPortType");
 
-	public static PortType COORDINATOR_SERVICE = new PortType(
-			"http://schemas.xmlsoap.org/ws/2004/10/wsat", "CoordinatorPortType");
+	private String context = KandulaConfig.getInstance().getContext();
 
 	private static CoordinationService instance = new CoordinationService();
 
-	public static PortType REGISTRATION_SERVICE = new PortType(
-			"http://schemas.xmlsoap.org/ws/2004/10/wscoor",
-			"RegistrationPortTypeRPC");
-
 	public static CoordinationService getInstance() {
 		return instance;
 	}
@@ -54,36 +41,72 @@
 			throws UnsupportedCoordinationTypeException, MalformedURIException {
 		if (!ATCoordinator.COORDINATION_TYPE_ID.equals(coordinationType))
 			throw new UnsupportedCoordinationTypeException();
-		final Coordinator c = new ATCoordinatorImpl();
-		CallbackRegistry.getInstance().registerCallback(c.getID(), c, timeout);
+		Coordinator c = new ATCoordinatorImpl();
+		CallbackRegistry.getInstance().registerCallback(c, timeout);
 		return c.getCoordinationContext();
 	}
 
-	public EndpointReference getActivationService() {
-		return EndpointReferenceFactory.getInstance().getEndpointReference(
-			ACTIVATION_SERVICE, null);
+	public EndpointReference getActivationCoordinatorService() {
+		return getEndpointReference(context + "activationCoordinator");
 	}
 
 	public EndpointReference getCompletionCoordinatorService(ATCoordinator c) {
-		ReferencePropertiesType r = new ReferencePropertiesType();
-		r.add(new MessageElement(CallbackRegistry.COORDINATOR_REF, c.getID()));
-		return EndpointReferenceFactory.getInstance().getEndpointReference(
-			COMPLETION_COORDINATOR_SERVICE, r);
+		return getEndpointReference(context + "completionCoordinator", c);
 	}
 
-	public EndpointReference getCoordinatorService(ATCoordinator c, String ref) {
-		ReferencePropertiesType r = new ReferencePropertiesType();
-		r.add(new MessageElement(CallbackRegistry.COORDINATOR_REF, c.getID()));
-		r.add(new MessageElement(ATCoordinator.PARTICIPANT_REF, ref));
-		return EndpointReferenceFactory.getInstance().getEndpointReference(
-			COORDINATOR_SERVICE, r);
+	public EndpointReference getCoordinatorService(ATCoordinator c,
+			String participantRef) {
+		EndpointReference epr = getEndpointReference(context + "coordinator", c);
+		epr.getProperties().add(
+			new MessageElement(ATCoordinator.PARTICIPANT_REF, participantRef));
+		return epr;
+	}
+
+	public EndpointReference getRegistrationCoordinatorService(Coordinator c) {
+		return getEndpointReference(context + "registrationCoordinator", c);
+	}
+
+	public EndpointReference getCompletionInitiatorService(Callback callback,
+			long timeout) {
+		CallbackRegistry.getInstance().registerCallback(callback, timeout);
+		return getEndpointReference(context + "completionInitiator", callback);
+	}
+
+	public EndpointReference getFaultDispatcherService(Callback callback) {
+		return getEndpointReference(context + "faultDispatcher", callback);
+	}
+
+	public EndpointReference getFaultDispatcherService(Coordinator callback,
+			String participantRef) {
+		EndpointReference epr = getEndpointReference(context
+				+ "faultDispatcher", callback);
+		epr.getProperties().add(
+			new MessageElement(ATCoordinator.PARTICIPANT_REF, participantRef));
+		return epr;
+	}
+
+	public EndpointReference getParticipantService(
+			AbstractParticipant participant, long timeout) {
+		CallbackRegistry.getInstance().registerCallback(participant, timeout);
+		return getEndpointReference(context + "participant", participant);
+	}
+
+	private EndpointReference getEndpointReference(String uri) {
+		try {
+			return new EndpointReference(uri);
+		} catch (MalformedURIException e) {
+			e.printStackTrace();
+			throw new IllegalArgumentException();
+		}
 	}
 
-	public EndpointReference getRegistrationService(Coordinator c) {
+	private EndpointReference getEndpointReference(String uri, Callback callback) {
+		EndpointReference epr = getEndpointReference(uri);
 		ReferencePropertiesType r = new ReferencePropertiesType();
-		r.add(new MessageElement(CallbackRegistry.COORDINATOR_REF, c.getID()));
-		return EndpointReferenceFactory.getInstance().getEndpointReference(
-			REGISTRATION_SERVICE, r);
+		r.add(new MessageElement(CallbackRegistry.CALLBACK_REF,
+				callback.getID()));
+		epr.setProperties(r);
+		return epr;
 	}
 
 	public CreateCoordinationContextResponseType createCoordinationContextOperation(

Modified: webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/Coordinator.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/Coordinator.java?rev=366673&r1=366672&r2=366673&view=diff
==============================================================================
--- webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/Coordinator.java (original)
+++ webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/Coordinator.java Fri Jan  6 21:34:40 2006
@@ -7,7 +7,6 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axis.AxisFault;
-import org.apache.ws.transaction.utility.Callback;
 import org.apache.ws.transaction.wscoor.RegistrationPortTypeRPC;
 
 /**
@@ -32,7 +31,11 @@
 			"The message was invalid for the current state of the activity.",
 			null, null);
 
-	String getID();
+	AxisFault INVALID_PARAMETERS_SOAP_FAULT = new AxisFault(
+			new QName("http://schemas.xmlsoap.org/ws/2004/10/wscoor",
+					"InvalidParameters"),
+			"The message contained invalid parameters and could not be processed.",
+			null, null);
 
 	CoordinationContext getCoordinationContext();
 

Modified: webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationStub.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationStub.java?rev=366673&r1=366672&r2=366673&view=diff
==============================================================================
--- webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationStub.java (original)
+++ webservices/kandula/branches/Kandula_1/src/java/org/apache/ws/transaction/coordinator/RegistrationStub.java Fri Jan  6 21:34:40 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.RegisterType;
@@ -39,7 +40,9 @@
 	public RegistrationStub(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 EndpointReference registerOperation(String p, EndpointReference epr)



---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org