ws-kandula-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thil...@apache.org
Subject svn commit: r265650 - in /webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context: ActivityContext.java ActivityContextImpl.java ContextFactory.java at/ATActivityContext.java
Date Thu, 01 Sep 2005 05:05:26 GMT
Author: thilina
Date: Wed Aug 31 22:05:13 2005
New Revision: 265650

URL: http://svn.apache.org/viewcvs?rev=265650&view=rev
Log:
Changing Coordination Context to SimpleCoordinationContext

Modified:
    webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java
    webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java
    webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java
    webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java?rev=265650&r1=265649&r2=265650&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java
(original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContext.java
Wed Aug 31 22:05:13 2005
@@ -46,4 +46,6 @@
     
     public abstract CoordinationContext getCoordinationContext();
     
+    public abstract void setCoordinationContext(CoordinationContext context);
+    
 }

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java?rev=265650&r1=265649&r2=265650&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java
(original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ActivityContextImpl.java
Wed Aug 31 22:05:13 2005
@@ -18,14 +18,13 @@
 
 import java.util.HashMap;
 
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.addressing.AnyContentType;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.kandula.Status.CoordinatorStatus;
 import org.apache.kandula.coordinator.CoordinatorUtils;
 import org.apache.kandula.typemapping.CoordinationContext;
-import org.apache.kandula.typemapping.EndPointReference;
-import org.apache.kandula.utility.EndpointReferenceFactory;
-import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl;
-import org.xmlsoap.schemas.ws.x2003.x09.wscoor.impl.CoordinationContextTypeImpl;
 
 /**
  * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
@@ -33,32 +32,40 @@
 public abstract class ActivityContextImpl implements ActivityContext {
 
     private HashMap propertyBag;
-    
-    private String activityID;
-    
+
+    protected String activityID;
+
     private int status = CoordinatorStatus.STATUS_NONE;
 
     private boolean locked = false;
-    
-    protected CoordinationContext coordinationContext;
-    
-    protected ActivityContextImpl(){    
+
+    protected CoordinationContext coordinationContext=null;
+
+    protected ActivityContextImpl() {
+        propertyBag = new HashMap();
     }
-    
+
     public ActivityContextImpl(String coordinationType) {
+        propertyBag = new HashMap();
         activityID = CoordinatorUtils.getRandomStringOf18Characters();
         coordinationContext = CoordinationContext.Factory.newInstance();
         coordinationContext.setActivityID(activityID);
-        coordinationContext.setRegistrationService(EndpointReferenceFactory.getInstance().getRegistrationEndpoint());
+        EndpointReference registrationEpr = new EndpointReference(
+                "http://localhost:8081/axis/services/RegistrationCoordinator");
+        AnyContentType referenceProp = new AnyContentType();
+        referenceProp.addReferenceValue(new QName(
+                "http://webservice.apache.org/~thilina", "myapp", "ID"),
+                activityID);
+        registrationEpr.setReferenceProperties(referenceProp);
+        coordinationContext.setRegistrationService(registrationEpr);
         coordinationContext.setCoordinationType(coordinationType);
     }
- 
+
     public CoordinationContext getCoordinationContext() {
         return coordinationContext;
     }
 
-    protected void setCoordinationContext(CoordinationContext context)
-    {
+    public void setCoordinationContext(CoordinationContext context) {
         this.coordinationContext = context;
     }
 
@@ -101,4 +108,4 @@
     public Object getProperty(Object key) {
         return propertyBag.get(key);
     }
-}
+}
\ No newline at end of file

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java?rev=265650&r1=265649&r2=265650&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java
(original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/ContextFactory.java
Wed Aug 31 22:05:13 2005
@@ -16,6 +16,7 @@
  */
 package org.apache.kandula.coordinator.context;
 
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.kandula.KandulaException;
 import org.apache.kandula.coordinator.context.at.ATActivityContext;
 import org.apache.kandula.typemapping.CoordinationContext;
@@ -34,16 +35,28 @@
             throws KandulaException {
         if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(protocol)) {
             return new ATActivityContext();
-        } else{
+        } else {
             throw new KandulaException(new IllegalArgumentException(
                     "Unsupported Protocol Type"));
         }
     }
 
-    public ActivityContext createActivity(CoordinationContext context) throws KandulaException
{
-        if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(context.getCoordinationType()))
{
+    public ActivityContext createActivity(String protocol,
+            EndpointReference activationEPR) throws KandulaException {
+        if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(protocol)) {
+            return new ATActivityContext(activationEPR);
+        } else {
+            throw new KandulaException(new IllegalArgumentException(
+                    "Unsupported Protocol Type"));
+        }
+    }
+
+    public ActivityContext createActivity(CoordinationContext context)
+            throws KandulaException {
+        if (org.apache.kandula.Constants.WS_AT.equalsIgnoreCase(context
+                .getCoordinationType())) {
             return new ATActivityContext(context);
-        } else{
+        } else {
             throw new KandulaException(new IllegalArgumentException(
                     "Unsupported Protocol Type"));
         }

Modified: webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java
URL: http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java?rev=265650&r1=265649&r2=265650&view=diff
==============================================================================
--- webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java
(original)
+++ webservices/kandula/trunk/java/src/org/apache/kandula/coordinator/context/at/ATActivityContext.java
Wed Aug 31 22:05:13 2005
@@ -26,9 +26,8 @@
 import org.apache.kandula.coordinator.context.ActivityContextImpl;
 import org.apache.kandula.coordinator.context.Participant;
 import org.apache.kandula.typemapping.CoordinationContext;
-import org.apache.kandula.typemapping.EndPointReference;
-import org.apache.kandula.utility.EndpointReferenceFactory;
-
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.om.impl.MIMEOutputUtils;
 /**
  * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
  */
@@ -47,22 +46,44 @@
 
     private boolean subDurableRegistered = false;
 
-    private EndPointReference parentEPR;
-
+    private EndpointReference parentEPR;
+    
+    public static String REQUESTER_ID = "requesterID";
+    
+    public static String ACTIVATION_EPR = "activationEPR";
+    
+
+    /**
+     * Used when creating new activities
+     */
     public ATActivityContext() {
         super(Constants.WS_AT);
         volatileParticipantsTable = new Hashtable();
         durableParticipantsTable = new Hashtable();
     }
 
+    /**
+     * @param context
+     * To be used when coordinator is used as a sub ordinate to an another  cooordinator
+     */
     public ATActivityContext(CoordinationContext context) {
         subOrdinate = true;
         parentEPR = context.getRegistrationService();
-        context.setRegistrationService(EndpointReferenceFactory.getInstance()
-                .getRegistrationEndpoint());
+//        context.setRegistrationService(EndpointReferenceFactory.getInstance()
+//                .getRegistrationEndpoint());
         volatileParticipantsTable = new Hashtable();
         durableParticipantsTable = new Hashtable();
         setCoordinationContext(context);
+    }
+    /**
+     * @param id
+     * To be used when using as the requester
+     */
+    public ATActivityContext(EndpointReference activationEPR)
+    {
+        super();
+        this.setProperty(REQUESTER_ID, MIMEOutputUtils.getRandomStringOf18Characters());
+        this.setProperty(ACTIVATION_EPR, activationEPR);
     }
 
     /**



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


Mime
View raw message