Hi folks,

attached is a patch proposal to allow the separation of the involved parties. This patch - in fact, it's just a second configuration option - allows the initiator to create a coordination context at a remote coordination service (instead of using the local one). If the config option is empty, the local service is used.
(I renamed the configuration options to make more clear what they mean.)

Also attached is a sample kandula.properties file with sample settings - a "client" service at port 8081, and kandula services at port 8281 (but commented out).

Georg and I set up a test environment with TestSuite1 and Participant services deployed on port 8181, and kandula activiation/registration and protocol services on port 8281 -- yes, that works like a charm! ;-)


The rationale behind this is to allow the initiator application (at this time via the kandula configuration) to use an external coordination service, e.g. when the participants refuse to register at the "local" (initiator) coordination service, which is (from the participant's point of view) untrusted. All transactions could be coordinated by a third party which is trusted by everyone.

Vice versa, the initiating application does not any more have to expose its services to the public. In fact, it does hardly need to expose any service to anyone - there is just one message in the 2PC protocol, the final transaction outcome notification, that originates from the coordinator and hence requires the initiator to expose a service. But even this could easily be overcome by allowing the initiator to query the transaction's status from the coordinator (perhaps we will suggest that to the WS/AT specification authors - any comments on that?!) so that the transaction initiator can be fully firewalled, nat'ted or whatever.


We hope you will find this suggestion useful. :-)


With best regards,

        -hannes

# Service endpoint where the local kandula services can be reached.
# ending '/' required
kandula.localService=http://localhost:8181/axis/services/

# Service endpoint where the activation service to be used for new coordination 
contexts can be reached.
# If this setting is empty or commented out, the kandula.localService endpoint 
is used to create new
# contexts.
# ending '/' required
kandula.preferredCoordinationService=http://localhost:8281/axis/services/
Index: src/conf/kandula.properties
===================================================================
--- src/conf/kandula.properties (revision 374212)
+++ src/conf/kandula.properties (working copy)
@@ -1,4 +1,9 @@
+# Service endpoint where the local kandula services can be reached.
+# ending '/' required
+kandula.localService=http://localhost:8081/axis/services/
 
+# Service endpoint where the activation service to be used for new 
coordination contexts can be reached.
+# If this setting is empty or commented out, the kandula.localService endpoint 
is used to create new
+# contexts.
 # ending '/' required
-
-kandula.context=http://localhost:8081/axis/services/
\ No newline at end of file
+# kandula.preferredCoordinationService=http://localhost:8281/axis/services/
Index: src/java/org/apache/kandula/coordinator/CoordinationService.java
===================================================================
--- src/java/org/apache/kandula/coordinator/CoordinationService.java    
(revision 374212)
+++ src/java/org/apache/kandula/coordinator/CoordinationService.java    
(working copy)
@@ -25,7 +25,8 @@
  */
 public class CoordinationService implements ActivationPortTypeRPC {
 
-       private String context = KandulaConfig.getInstance().getContext();
+       private String contextClient = KandulaConfig.getInstance().getContext();
+       private String contextServices = 
KandulaConfig.getInstance().getKandulaServicesURL();
 
        private static CoordinationService instance = new CoordinationService();
 
@@ -47,38 +48,38 @@
        }
 
        public EndpointReference getActivationCoordinatorService() {
-               return getEndpointReference(context + "activationCoordinator");
+               return getEndpointReference(contextServices + 
"activationCoordinator");
        }
 
        public EndpointReference getCompletionCoordinatorService(ATCoordinator 
c) {
-               return getEndpointReference(context + "completionCoordinator", 
c);
+               return getEndpointReference(contextServices + 
"completionCoordinator", c);
        }
 
        public EndpointReference getCoordinatorService(ATCoordinator c,
                        String participantRef) {
-               EndpointReference epr = getEndpointReference(context + 
"coordinator", c);
+               EndpointReference epr = getEndpointReference(contextServices + 
"coordinator", c);
                epr.getProperties().add(
                        new MessageElement(ATCoordinator.PARTICIPANT_REF, 
participantRef));
                return epr;
        }
 
        public EndpointReference getRegistrationCoordinatorService(Coordinator 
c) {
-               return getEndpointReference(context + 
"registrationCoordinator", c);
+               return getEndpointReference(contextServices + 
"registrationCoordinator", c);
        }
 
        public EndpointReference getCompletionInitiatorService(Callback 
callback,
                        long timeout) {
                CallbackRegistry.getInstance().registerCallback(callback, 
timeout);
-               return getEndpointReference(context + "completionInitiator", 
callback);
+               return getEndpointReference(contextClient + 
"completionInitiator", callback);
        }
 
        public EndpointReference getFaultDispatcherService(Callback callback) {
-               return getEndpointReference(context + "faultDispatcher", 
callback);
+               return getEndpointReference(contextServices + 
"faultDispatcher", callback);
        }
 
        public EndpointReference getFaultDispatcherService(Coordinator callback,
                        String participantRef) {
-               EndpointReference epr = getEndpointReference(context
+               EndpointReference epr = getEndpointReference(contextServices
                                + "faultDispatcher", callback);
                epr.getProperties().add(
                        new MessageElement(ATCoordinator.PARTICIPANT_REF, 
participantRef));
@@ -88,7 +89,7 @@
        public EndpointReference getParticipantService(
                        AbstractParticipant participant, long timeout) {
                CallbackRegistry.getInstance().registerCallback(participant, 
timeout);
-               return getEndpointReference(context + "participant", 
participant);
+               return getEndpointReference(contextClient + "participant", 
participant);
        }
 
        private EndpointReference getEndpointReference(String uri) {
Index: src/java/org/apache/kandula/KandulaConfig.java
===================================================================
--- src/java/org/apache/kandula/KandulaConfig.java      (revision 374212)
+++ src/java/org/apache/kandula/KandulaConfig.java      (working copy)
@@ -16,8 +16,10 @@
 
        private static final String PROPERTY_FILE = "kandula.properties";
 
-       private static final String CONTEXT_PROPERTY = "kandula.context";
+       private static final String LOCAL_SERVICE__PROPERTY = 
"kandula.localService";
 
+       private static final String PREFERRED_SERVICE__PROPERTY = 
"kandula.preferredCoordinationService";
+
        private static KandulaConfig instance = new KandulaConfig();
 
        private Properties properties = null;
@@ -32,8 +34,7 @@
        }
 
        private void loadProperties() {
-               InputStream in = 
getClass().getClassLoader().getResourceAsStream(
-                       PROPERTY_FILE);
+               InputStream in = 
getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE);
 
                try {
                        properties.load(in);
@@ -45,7 +46,15 @@
        }
 
        public String getContext() {
-               return properties.getProperty(CONTEXT_PROPERTY);
+               return properties.getProperty(LOCAL_SERVICE__PROPERTY);
        }
 
+       public String getKandulaServicesURL(){
+               final String externalURL = 
properties.getProperty(PREFERRED_SERVICE__PROPERTY);
+               
+               if (externalURL != null && externalURL.length()>0)
+                       return externalURL;
+
+               return getContext();
+       }
 }
\ No newline at end of file

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

Reply via email to