You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ra...@apache.org on 2007/02/05 05:06:26 UTC

svn commit: r503543 - in /webservices/axis2/branches/java/clustering: ./ etc/ modules/cluster/ modules/cluster/src/ modules/cluster/src/org/ modules/cluster/src/org/apache/ modules/cluster/src/org/apache/axis2/ modules/cluster/src/org/apache/axis2/clus...

Author: rajith
Date: Sun Feb  4 20:06:24 2007
New Revision: 503543

URL: http://svn.apache.org/viewvc?view=rev&rev=503543
Log:
initial checkin of cluster code

Added:
    webservices/axis2/branches/java/clustering/modules/cluster/
    webservices/axis2/branches/java/clustering/modules/cluster/maven.xml
    webservices/axis2/branches/java/clustering/modules/cluster/project.properties
    webservices/axis2/branches/java/clustering/modules/cluster/project.xml
    webservices/axis2/branches/java/clustering/modules/cluster/src/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeOne.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeThree.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeTwo.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/aop.xml
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/ServiceContextInterceptor.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/CommandConstants.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/ContextManager.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesChannelInfo.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesMemberInfo.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesCommandMessage.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesInfoWebService.java
    webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesMapEntryMessage.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/NullClusterManager.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
Modified:
    webservices/axis2/branches/java/clustering/etc/project.properties
    webservices/axis2/branches/java/clustering/maven.xml
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/OperationContext.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceContext.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
    webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java

Modified: webservices/axis2/branches/java/clustering/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/etc/project.properties?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/etc/project.properties (original)
+++ webservices/axis2/branches/java/clustering/etc/project.properties Sun Feb  4 20:06:24 2007
@@ -79,7 +79,8 @@
 modules/jaxbri/project.xml,\
 modules/jaxws/project.xml,\
 modules/jaxws-api/project.xml,\
-modules/json/project.xml
+modules/json/project.xml,\
+modules/cluster/project.xml
 
 # -------------------------------------------------------------------
 #                JUnit

Modified: webservices/axis2/branches/java/clustering/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/maven.xml?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/maven.xml (original)
+++ webservices/axis2/branches/java/clustering/maven.xml Sun Feb  4 20:06:24 2007
@@ -453,6 +453,10 @@
             <ant:copy toDir="target/temp/war/lib">
                 <ant:fileset file="modules/jaxbri/target/axis2-jaxbri-${pom.currentVersion}.jar"/>
             </ant:copy>
+             
+            <ant:copy toDir="target/temp/war/lib">
+                <ant:fileset file="modules/cluster/target/axis2-cluster-${pom.currentVersion}.jar"/>
+            </ant:copy>
         </j:if>
 
         <!-- Copy the soapmonitor jar - the servlet classes -->
@@ -770,6 +774,7 @@
                 <ant:include name="**/modules/samples/**"/>
                 <ant:include name="**/modules/soapmonitor/**"/>
                 <ant:include name="**/modules/spring/**"/>
+                <ant:include name="**/modules/cluster/**"/>
                 <ant:include name="**/modules/tool/**"/>
                 <ant:exclude name="**/SameServiceAddingTest.java"/>
                 <!-- TODO: This is failing in the distros. Must Fix it. -->
@@ -925,6 +930,7 @@
                 <!--ant:pathelement location="modules/jaxws/src"/-->
                 <ant:pathelement location="modules/soapmonitor/src"/>
                 <ant:pathelement location="modules/spring/src"/>
+                <ant:pathelement location="modules/cluster/src"/>
                 <ant:pathelement location="modules/xmlbeans/src"/>
             </ant:sourcepath>
             <ant:classpath>

Added: webservices/axis2/branches/java/clustering/modules/cluster/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/maven.xml?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/maven.xml (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/maven.xml Sun Feb  4 20:06:24 2007
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->
+
+<project default="jar"
+    xmlns:j="jelly:core"
+    xmlns:u="jelly:util"
+    xmlns:maven="jelly:maven"
+    xmlns:deploy="deploy"
+    xmlns:ant="jelly:ant">
+    <preGoal name="itest:compile">
+        <u:file var="file" name="${maven.itest.src}"/>
+        <j:if test="${!file.exists()}">
+            <j:expr value="${context.setVariable('maven.itest.skip', 'true')}"/>
+        </j:if>
+    </preGoal>
+    <preGoal name="jar:jar">
+        <ant:copy toDir="target/classes/META-INF" overwrite="true" file="src/org/apache/axis2/cluster/aop.xml" />
+    </preGoal>
+</project>

Added: webservices/axis2/branches/java/clustering/modules/cluster/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/project.properties?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/project.properties (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/project.properties Sun Feb  4 20:06:24 2007
@@ -0,0 +1,38 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar
+
+# -------------------------------------------------------------------
+#                JUnit
+# -------------------------------------------------------------------
+maven.junit.jvmargs=-Xmx256m -Djava.awt.headless=true -Dbuild.repository=./target/test-classes
+maven.junit.fork=true
+
+# -------------------------------------------------------------------
+#                Test
+# -------------------------------------------------------------------
+#maven.test.failure.ignore=true
+
+# -------------------------------------------------------------------
+#                Compile
+# -------------------------------------------------------------------
+maven.compile.optimize=false
+maven.compile.fork=true
+maven.compile.target=1.5
+maven.compile.source=1.5
+
+jaxws.version=${pom.currentVersion}

Added: webservices/axis2/branches/java/clustering/modules/cluster/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/project.xml?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/project.xml (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/project.xml Sun Feb  4 20:06:24 2007
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+<project>
+    <pomVersion>3</pomVersion>
+    <extend>../../etc/project.xml</extend>
+
+    <name>Apache Axis 2.0 - Cluster</name>
+    <id>axis2-cluster</id>
+    <groupId>org.apache.axis2</groupId>
+    <description>Cluster Support for Axis 2.0</description>
+
+    <dependencies>
+
+       <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-api</artifactId>
+            <version>${axiom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>axiom-impl</artifactId>
+            <version>${axiom.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+         <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-adb</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>        
+        <!-- external JARs -->
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>${commons.logging.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+	  <!-- added for the QName -->	
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>${stax.api.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>aspectj</groupId>
+            <artifactId>aspectjrt</artifactId>
+            <version>1.5.3</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+         <dependency>
+            <groupId>tribes</groupId>
+            <artifactId>apache-tribes</artifactId>
+             <version>0.9.5.2</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>        
+    </dependencies>
+    <build/>
+    <reports/>
+</project>

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeOne.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeOne.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeOne.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeOne.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,66 @@
+package org.apache.axis2.cluster;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.tribes.ContextManager;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.catalina.tribes.tipis.ReplicatedMap;
+
+public class NodeOne {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		String path = "/usr/share/tomcat5/webapps/axis2/WEB-INF";
+		
+		try {
+			ConfigurationContext ctx = ConfigurationContextFactory
+			.createConfigurationContextFromFileSystem(
+					path, path + "/conf/axis2.xml");
+			SimpleHTTPServer server = new SimpleHTTPServer(ctx,10500);
+			server.start();
+		} catch (AxisFault e) {
+			e.printStackTrace();
+		}
+		
+		/*
+		Channel channel = new GroupChannel();
+		try {			
+			channel.start(Channel.DEFAULT);
+			
+			ReplicatedMap map = new ReplicatedMap(NodeOne.class, 
+                    channel,
+                    1000,
+                    "NodeMap",
+                    new ClassLoader[]{Thread.currentThread().getContextClassLoader()}
+                    );
+			
+			Thread.sleep(1000);
+			
+			map.put("name","rajith");
+			map.replicate("name", true);
+			
+			Thread.sleep(1000);
+			
+			map.put("age","23");
+			map.replicate("age", true);
+			
+			while(true){
+				Thread.sleep(2000);
+				map.replicate(true);
+				System.out.println("Replicating");
+			}
+			
+		} catch (Exception e) {
+			System.out.println("Error starting Tribes channel");
+			e.printStackTrace();
+		}*/
+
+	}
+
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeThree.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeThree.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeThree.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeThree.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,87 @@
+package org.apache.axis2.cluster;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.tribes.ContextManager;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.catalina.tribes.tipis.ReplicatedMap;
+
+public class NodeThree {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		String path = "/usr/share/tomcat5/webapps/axis2/WEB-INF";
+		
+		try {
+			ConfigurationContext ctx = ConfigurationContextFactory
+			.createConfigurationContextFromFileSystem(
+					path, path + "/conf/axis2.xml");
+			SimpleHTTPServer server = new SimpleHTTPServer(ctx,10700);
+			server.start();
+		} catch (AxisFault e) {
+			e.printStackTrace();
+		}
+		
+		try {
+			ConfigurationContext ctx = ConfigurationContextFactory
+			.createConfigurationContextFromFileSystem(
+					path, path + "/conf/axis2.xml");
+			SimpleHTTPServer server = new SimpleHTTPServer(ctx,10800);
+			server.start();
+		} catch (AxisFault e) {
+			e.printStackTrace();
+		}
+		
+		try {
+			ConfigurationContext ctx = ConfigurationContextFactory
+			.createConfigurationContextFromFileSystem(
+					path, path + "/conf/axis2.xml");
+			SimpleHTTPServer server = new SimpleHTTPServer(ctx,10900);
+			server.start();
+		} catch (AxisFault e) {
+			e.printStackTrace();
+		}
+		
+		
+		/*
+		Channel channel = new GroupChannel();
+		try {			
+			channel.start(Channel.DEFAULT);
+			
+			ReplicatedMap map = new ReplicatedMap(NodeOne.class, 
+                    channel,
+                    1000,
+                    "NodeMap",
+                    new ClassLoader[]{Thread.currentThread().getContextClassLoader()}
+                    );
+			
+			Thread.sleep(1000);
+			
+			map.put("name","rajith");
+			map.replicate("name", true);
+			
+			Thread.sleep(1000);
+			
+			map.put("age","23");
+			map.replicate("age", true);
+			
+			while(true){
+				Thread.sleep(2000);
+				map.replicate(true);
+				System.out.println("Replicating");
+			}
+			
+		} catch (Exception e) {
+			System.out.println("Error starting Tribes channel");
+			e.printStackTrace();
+		}*/
+
+	}
+
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeTwo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeTwo.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeTwo.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/NodeTwo.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,57 @@
+package org.apache.axis2.cluster;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.catalina.tribes.tipis.ReplicatedMap;
+
+public class NodeTwo {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		String path = "/usr/share/tomcat5/webapps/axis2/WEB-INF";
+		
+		try {
+			ConfigurationContext ctx2 = ConfigurationContextFactory
+			.createConfigurationContextFromFileSystem(
+					path, path + "/conf/axis2.xml");
+			SimpleHTTPServer server2 = new SimpleHTTPServer(ctx2,10600);
+			server2.start();
+		} catch (AxisFault e) {
+			e.printStackTrace();
+		}
+		
+		/*Channel channel = new GroupChannel();
+		try {			
+			channel.start(Channel.DEFAULT);
+			
+			ReplicatedMap map = new ReplicatedMap(NodeOne.class, 
+                    channel,
+                    1000,
+                    "NodeMap",
+                    new ClassLoader[]{Thread.currentThread().getContextClassLoader()}
+                    );
+			
+			Thread.sleep(5000);
+			
+			System.out.println(map);
+			              
+			while(true){
+			  Thread.sleep(3000);
+			  System.out.println(map);
+			}
+			
+		} catch (Exception e) {
+			System.out.println("Error starting Tribes channel");
+			e.printStackTrace();
+		}*/
+
+
+	}
+
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/aop.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/aop.xml?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/aop.xml (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/aop.xml Sun Feb  4 20:06:24 2007
@@ -0,0 +1,9 @@
+<aspectj>
+   <aspects>
+      <aspect name="org.apache.axis2.cluster.interceptor.ServiceContextInterceptor"/>
+   </aspects>
+
+   <weaver options="-verbose">
+   </weaver>
+</aspectj>
+

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/ServiceContextInterceptor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/ServiceContextInterceptor.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/ServiceContextInterceptor.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/interceptor/ServiceContextInterceptor.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,54 @@
+package org.apache.axis2.cluster.interceptor;
+
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+public class ServiceContextInterceptor {
+
+	SimpleDateFormat dateFormatter = new SimpleDateFormat("HH:mm:ss.SSSZ");
+	
+	@Pointcut("(execution(ServiceContext.new(AxisService,ServiceGroupContext)" +
+			" && this(ctx)")
+	public void createContext(ServiceContext ctx) {
+	}
+	
+	@Pointcut("(execution(ServiceContext.setProperties(Map)" +
+			  " && this(ctx) && args(map)")
+    public void setProperties(ServiceContext ctx, Map map) {
+    }
+	
+	@Pointcut("(execution(ServiceContext.setProperty(String, Object)" +
+	          " && this(ctx) && args(key,value)")
+	public void setProperty(ServiceContext ctx, String key, Object value) {
+	}
+
+	@AfterReturning ("createContext(ctx)")
+	public void afterCreateContext(ServiceContext ctx) {
+		System.out.println("[" + getTimeStamp() + "] Service Context was created" + ctx);
+	}
+		
+	@AfterReturning ("setProperties(ctx,map)")
+	public void afterSetProperties(ServiceContext ctx, Map map) {
+		System.out.println("[" + getTimeStamp() + "] Setting properties in Service Context " + map );		
+	}
+	
+	@AfterReturning ("setProperties(ctx,key,value)")
+	public void afterSetProperty(ServiceContext ctx, String key, Object value) {
+		System.out.println("[" + getTimeStamp() + "] Setting property in Service Context key " + key+ " value " + value );		
+	}	
+	
+	private String getTimeStamp(){
+		return dateFormatter.format(new Date(System.currentTimeMillis()));
+	}
+	
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/CommandConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/CommandConstants.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/CommandConstants.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/CommandConstants.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,18 @@
+package org.apache.axis2.cluster.tribes;
+
+public interface CommandConstants {
+	
+	public static String CREATE_SERVICE_CONTEXT = "CREATE_SERVICE_CONTEXT";
+	
+	public static String CREATE_SERVICE_GROUP_CONTEXT = "CREATE_SERVICE_GROUP_CONTEXT";
+
+	public static String REMOVE_SERVICE_CONTEXT = "REMOVE_SERVICE_CONTEXT";
+	
+	public static String REMOVE_SERVICE_GROUP_CONTEXT = "REMOVE_SERVICE_GROUP_CONTEXT";
+	
+	public static String UPDATE_STATE = "UPDATE_STATE";
+	
+	public static String UPDATE_STATE_MAP_ENTRY = "UPDATE_STATE_MAP_ENTRY";
+	
+	public static String SEPERATOR = ",";
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/ContextManager.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/ContextManager.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/ContextManager.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,240 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.catalina.tribes.Channel;
+//import org.apache.catalina.tribes.tipis.ReplicatedMap;
+
+public class ContextManager {
+	
+	private Channel channel;
+    private long timeout = 1000;
+	private ClassLoader classLoader;
+    
+	private Map<String, HashMap> serviceCtxProps = new HashMap<String, HashMap>(); 
+	private Map<String, HashMap> serviceGrpCtxProps = new HashMap<String, HashMap>();
+	
+	public ContextManager(Channel channel, long timeout, ClassLoader classLoader){
+		this.channel = channel;
+		this.timeout = timeout;
+		this.classLoader = classLoader;
+	}
+	
+	
+	public void addServiceContext(String parentId, String serviceCtxName){
+		String key = parentId + "_" + serviceCtxName;
+		/*serviceCtxProps.put(key,new ReplicatedMap(this, 
+				                                  channel,
+				                                  timeout,
+				                                  key,
+				                                  new ClassLoader[]{classLoader}
+		                                          ));*/
+		                                      
+		serviceCtxProps.put(key,new HashMap());
+	}
+	
+	public void addServiceGroupContext(String groupId){
+		String key = groupId;
+		/*serviceGrpCtxProps.put(key,new ReplicatedMap(this, 
+				                                  channel,
+				                                  timeout,
+				                                  key,
+				                                  new ClassLoader[]{classLoader}
+		                                          ));*/
+		serviceGrpCtxProps.put(key,new HashMap());
+	}
+	
+	public void removeServiceContext(String parentId, String serviceCtxName){
+		String key = parentId + "_" + serviceCtxName;
+		HashMap map = (HashMap)serviceCtxProps.get(key);
+		//map.breakdown();
+		serviceCtxProps.remove(key);
+	}
+	
+	public void removeServiceGroupContext(String groupId){
+		String key = groupId;
+		HashMap map = (HashMap)serviceGrpCtxProps.get(key);
+		//map.breakdown();
+		serviceGrpCtxProps.remove(key);
+	}
+	
+	public void addPropToServiceContext(String parentId, String serviceCtxName,String propName, Object value){
+		String key = parentId + "_" + serviceCtxName;
+		HashMap map = (HashMap)serviceCtxProps.get(key);
+		map.put(propName, value);
+	}
+	
+	public void addPropToServiceGroupContext(String groupId,String propName, Object value){
+		String key = groupId;
+		HashMap map = (HashMap)serviceGrpCtxProps.get(key);
+		map.put(propName, value);
+	}
+	
+	public void removePropFromServiceContext(String parentId, String serviceCtxName,String propName){
+		String key = parentId + "_" + serviceCtxName;
+		HashMap map = (HashMap)serviceCtxProps.get(key);
+		map.remove(propName);
+	}
+	
+	public void removePropFromServiceGroupContext(String groupId,String propName){
+		String key = groupId;
+		HashMap map = (HashMap)serviceGrpCtxProps.get(key);
+		map.remove(propName);
+	}
+
+	public void updatePropOnServiceContext(String parentId, String serviceCtxName,String propName, Object value){
+		String key = parentId + "_" + serviceCtxName;
+		HashMap map = (HashMap)serviceCtxProps.get(key);
+		map.put(propName, value);
+	}
+	
+	public void updatePropOnServiceGroupContext(String groupId,String propName, Object value){
+		String key = groupId;
+		HashMap map = (HashMap)serviceGrpCtxProps.get(key);
+		map.put(propName, value);
+	}
+	
+	public Map getServiceGroupProps(String groupId){
+		return serviceGrpCtxProps.get(groupId);
+	}
+
+	public Map getServiceProps(String parentId, String serviceCtxName){
+		String key = parentId + "_" + serviceCtxName;
+		return serviceCtxProps.get(key);
+	}
+	
+	public List updateStateOnServiceContext(String parentId, String serviceCtxName,Map<String,?> newProps){
+		String key = parentId + "_" + serviceCtxName;
+		HashMap oldProps = (HashMap)serviceCtxProps.get(key);
+		List<TribesMapEntryMessage> commandList = new ArrayList<TribesMapEntryMessage>();
+		
+        try {
+			// using set operations to figure out the diffs
+        	
+        	// figuring out entries to remove
+			Set<String> diffForRemove = new HashSet<String>();  
+			diffForRemove.addAll(oldProps.keySet()); 
+			diffForRemove.removeAll(newProps.keySet());
+			
+			// figuring out new entires
+			Set<String> diffForAddOrUpdate = new HashSet<String>(); 
+			diffForAddOrUpdate.addAll(newProps.keySet()); 
+			diffForAddOrUpdate.removeAll(oldProps.keySet());
+				
+			// figuring out entries to update
+			for(String paramKey: newProps.keySet()){
+				Object oldValue = oldProps.get(paramKey);
+				Object newValue = newProps.get(paramKey);
+				
+				if(oldValue != null && !oldValue.equals(newValue)){
+					diffForAddOrUpdate.add(paramKey);
+				}
+			}
+			
+			for (String paramKey : diffForAddOrUpdate) {
+				Object value = newProps.get(paramKey);
+				if(value instanceof Serializable){	
+					oldProps.put(paramKey, value);
+					commandList.add(new TribesMapEntryMessage(CommandConstants.UPDATE_STATE_MAP_ENTRY,
+							                                  parentId,
+							                                  serviceCtxName,
+							                                  serviceCtxName,
+                                                              paramKey,
+                                                              (Serializable)value,
+                                                              TribesMapEntryMessage.SERVICE_CONTEXT,
+                                                              TribesMapEntryMessage.ADD_OR_UPDATE_ENTRY));
+					//oldProps.replicate(paramKey, true);
+				}
+			}
+			
+			for (String paramKey : diffForRemove){
+				oldProps.remove(paramKey);
+				commandList.add(new TribesMapEntryMessage(CommandConstants.UPDATE_STATE_MAP_ENTRY,
+                        parentId,
+                        serviceCtxName,
+                        serviceCtxName,
+                        paramKey,
+                        "",
+                        TribesMapEntryMessage.SERVICE_CONTEXT,
+                        TribesMapEntryMessage.REMOVE_ENTRY));
+
+				//oldProps.replicate(paramKey, true);
+			}
+		} catch (RuntimeException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		return commandList;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List updateStateOnServiceGroupContext(String ctxId,Map<String,?> newProps){
+		HashMap oldProps = (HashMap)serviceGrpCtxProps.get(ctxId);
+		List<TribesMapEntryMessage> commandList = new ArrayList<TribesMapEntryMessage>();
+		
+        try {
+			// using set operations to figure out the diffs
+        	
+        	// figuring out entries to remove
+        	Set<String> diffForRemove = new HashSet<String>();  
+			diffForRemove.addAll(oldProps.keySet());  
+			diffForRemove.removeAll(newProps.keySet());
+			
+            // figuring out entries to update
+			Set<String> diffForAddOrUpdate = new HashSet<String>(); 
+			diffForAddOrUpdate.addAll(newProps.keySet()); 
+			diffForAddOrUpdate.removeAll(oldProps.keySet());
+				
+			// figuring out entries to update
+			for(String paramKey: newProps.keySet()){
+				Object oldValue = oldProps.get(paramKey);
+				Object newValue = newProps.get(paramKey);
+				
+				if(oldValue != null && !oldValue.equals(newValue)){
+					diffForAddOrUpdate.add(paramKey);
+				}
+			}
+			
+			for (String paramKey : diffForAddOrUpdate){
+				Object value = newProps.get(paramKey);
+				if(value instanceof Serializable){	
+					oldProps.put(paramKey, value);
+					commandList.add(new TribesMapEntryMessage(CommandConstants.UPDATE_STATE_MAP_ENTRY,
+								                            "",
+								                            ctxId,
+								                            ctxId,
+								                            paramKey,
+								                            (Serializable)value,
+								                            TribesMapEntryMessage.SERVICE_GROUP_CONTEXT,
+								                            TribesMapEntryMessage.ADD_OR_UPDATE_ENTRY));
+					//oldProps.replicate(paramKey, true); // map.replicate(true) will replicate all					
+				}
+			}
+			
+			for (String paramKey : diffForRemove){
+				commandList.add(new TribesMapEntryMessage(CommandConstants.UPDATE_STATE_MAP_ENTRY,
+									                        "",
+									                        ctxId,
+									                        ctxId,
+									                        paramKey,
+									                        "",
+									                        TribesMapEntryMessage.SERVICE_GROUP_CONTEXT,
+									                        TribesMapEntryMessage.REMOVE_ENTRY));
+				//oldProps.remove(paramKey);
+			}
+		} catch (RuntimeException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		return commandList;
+	}
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesChannelInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesChannelInfo.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesChannelInfo.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesChannelInfo.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,67 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+
+import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.Member;
+
+public class TransientTribesChannelInfo implements ChannelListener{
+
+	private long messageCount = 0;
+    private long grpCtxCreationCount = 0;
+    private long srvCtxCreationCount = 0;
+    private long grpCtxRemoveCount = 0;
+    private long srvCtxRemoveCount = 0;
+    private long updateStateCount = 0;
+    
+	public boolean accept(Serializable msg, Member sender) {
+		return msg instanceof String;
+	}
+
+	public void messageReceived(Serializable msg, Member sender) {
+		messageCount++;
+
+		System.out.println("Tribes message " + msg);
+		
+		if (msg instanceof TribesCommandMessage){
+			TribesCommandMessage comMsg =  (TribesCommandMessage)msg;
+			
+			if(comMsg.getCommandName().equals(CommandConstants.CREATE_SERVICE_GROUP_CONTEXT)){
+				grpCtxCreationCount ++;
+			}else if(comMsg.getCommandName().equals(CommandConstants.CREATE_SERVICE_CONTEXT)){
+				srvCtxCreationCount ++;
+			}else if(comMsg.getCommandName().equals(CommandConstants.REMOVE_SERVICE_GROUP_CONTEXT)){
+				grpCtxRemoveCount ++;
+			}else if(comMsg.getCommandName().equals(CommandConstants.REMOVE_SERVICE_CONTEXT)){
+				srvCtxRemoveCount ++;
+			}else if(comMsg.getCommandName().equals(CommandConstants.UPDATE_STATE)){
+				updateStateCount ++;
+			}
+		}
+	}
+
+	public long getGrpCtxCreationCount() {
+		return grpCtxCreationCount;
+	}
+
+	public long getGrpCtxRemoveCount() {
+		return grpCtxRemoveCount;
+	}
+
+	public long getMessageCount() {
+		return messageCount;
+	}
+
+	public long getSrvCtxCreationCount() {
+		return srvCtxCreationCount;
+	}
+
+	public long getSrvCtxRemoveCount() {
+		return srvCtxRemoveCount;
+	}
+
+	public long getUpdateStateCount() {
+		return updateStateCount;
+	}
+
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesMemberInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesMemberInfo.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesMemberInfo.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TransientTribesMemberInfo.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,32 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.MembershipListener;
+
+public class TransientTribesMemberInfo implements MembershipListener {
+
+	private List <Member> liveNodes = new ArrayList <Member>();
+	private List <Member> deadNodes = new ArrayList <Member>();
+    	
+	
+	public void memberAdded(Member member) {
+		liveNodes.add(member);
+		deadNodes.remove(member);
+	}
+
+	public void memberDisappeared(Member member) {
+		liveNodes.remove(member);
+		deadNodes.add(member);
+	}
+	
+	public List <Member> getLiveNodes(){
+		return liveNodes;
+	}
+	
+	public List <Member> getDeadNodes(){
+		return deadNodes;
+	}
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,306 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.ClusterManager;
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
+import org.apache.catalina.tribes.Channel;
+import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.group.GroupChannel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class TribesClusterManager implements ClusterManager, ChannelListener {
+
+	private static final Log log = LogFactory.getLog(TribesClusterManager.class);	
+	private ConfigurationContext configContext;
+	private Channel channel;
+	private ContextManager ctxManager;
+	private long timeout = 1000L; // this should be configured in the axis2.xml
+	private Map<String, List> orphanedServiceCtxs = new HashMap <String, List>();
+	private Map<String, String> duplicateServiceGrps = new HashMap <String, String>();
+	private Map<String, String> duplicateServiceCtxs = new HashMap <String, String>();
+	
+	public void init(ConfigurationContext context) {
+		log.debug("initializing tibes");
+		
+		this.configContext = context;
+		
+		TransientTribesChannelInfo channelInfo = new TransientTribesChannelInfo();
+		TransientTribesMemberInfo memberInfo = new TransientTribesMemberInfo();
+		
+		configContext.setProperty("MEMBER_INFO", memberInfo);
+		configContext.setProperty("CHANNEL_INFO", channelInfo);
+		
+		channel = new GroupChannel();
+		try {
+			channel.addChannelListener(this);
+			channel.addChannelListener(channelInfo);
+			channel.addMembershipListener(memberInfo);
+			channel.start(Channel.DEFAULT);
+			ctxManager = new ContextManager(channel,timeout,context.getAxisConfiguration().getSystemClassLoader());
+		} catch (ChannelException e) {
+			log.error("Error starting Tribes channel", e);
+		}
+		
+		registerTribesInfoService(configContext);
+	}	
+	
+	
+	private void registerTribesInfoService(ConfigurationContext configContext2) {				
+		try {
+			AxisService service = AxisService.createService(
+					"org.apache.axis2.cluster.tribes.TribesInfoWebService",
+					configContext.getAxisConfiguration(), RPCMessageReceiver.class);
+			
+			configContext.getAxisConfiguration().addService(service);
+		} catch (AxisFault e) {
+			log.error("Unable to create Tribes info web service",e);
+		}		
+	}
+
+	public void addContext(String contextId, String parentContextId, AbstractContext context) {
+		TribesCommandMessage comMsg = null;
+		
+		// The ServiceContex does not define a contextId
+		// therefore the service name is used
+		if (context instanceof ServiceContext){
+			
+			if (duplicateServiceCtxs.get(parentContextId + contextId) != null){
+				return; // this is a duplicate replication request
+			}
+			
+			if(ctxManager.getServiceGroupProps(parentContextId) != null){	
+				ctxManager.addServiceContext(parentContextId, contextId);
+				comMsg = new TribesCommandMessage(CommandConstants.CREATE_SERVICE_CONTEXT,
+						parentContextId,contextId,contextId);
+				send(comMsg);
+			}else{
+				// put in the queue until the service group context is created with an id
+				comMsg = new TribesCommandMessage(CommandConstants.CREATE_SERVICE_CONTEXT,
+						parentContextId,contextId,contextId);
+				
+				AxisServiceGroup serviceGroupDesc = ((ServiceContext)context).getServiceGroupContext().getDescription();
+				List<TribesCommandMessage> list = (List)orphanedServiceCtxs.get(serviceGroupDesc.getServiceGroupName());
+				if (list == null){
+					list = new ArrayList <TribesCommandMessage>();
+					orphanedServiceCtxs.put(serviceGroupDesc.getServiceGroupName(), list);
+				}
+				list.add(comMsg);				
+			}
+		}else if (context instanceof ServiceGroupContext){
+			
+			if (duplicateServiceGrps.get(contextId) != null){
+				return; // this is a duplicate replication request
+			}		
+			
+			
+			ServiceGroupContext srvGrpCtx = (ServiceGroupContext)context; 
+			
+			// The new serialization code sets the service group name as it's id initially
+			if(srvGrpCtx.getId().equals(srvGrpCtx.getDescription().getServiceGroupName())){
+				return;
+			}
+			
+			ctxManager.addServiceGroupContext(contextId);
+			comMsg = new TribesCommandMessage(CommandConstants.CREATE_SERVICE_GROUP_CONTEXT,
+                    "",contextId,srvGrpCtx.getDescription().getServiceGroupName());
+			
+			send(comMsg);
+			
+			// now iterate through the list of service contexts and replicate them
+			List<TribesCommandMessage> list = orphanedServiceCtxs.get(srvGrpCtx.getDescription().getServiceGroupName());
+			for(TribesCommandMessage command : list){				
+				ctxManager.addServiceContext(contextId, command.getContextId());
+				command.setParentId(contextId);
+				send(command);				
+			}
+			
+			orphanedServiceCtxs.remove(srvGrpCtx.getDescription().getServiceGroupName());
+		}		
+	    	
+	}
+     
+	/*
+	public void addProperty(AbstractContext ctx,String contextId, String parentId, String propertyName, Object propertyValue) {
+        if (ctx instanceof ServiceContext){
+			ctxManager.addPropToServiceContext(parentId, contextId, propertyName, propertyValue);
+		}else{
+			ctxManager.addPropToServiceGroupContext(contextId, propertyName, propertyValue);
+		}
+	}*/
+
+	public void removeContext(String contextId, String parentContextId, AbstractContext context) {
+		TribesCommandMessage comMsg = null;
+		if (context instanceof ServiceContext){
+			ctxManager.removeServiceContext(parentContextId, contextId);
+			comMsg = new TribesCommandMessage(CommandConstants.CREATE_SERVICE_GROUP_CONTEXT,
+		                                      parentContextId,contextId, contextId);
+		}else if (context instanceof ServiceGroupContext){
+	     	ctxManager.removeServiceGroupContext(contextId);
+	     	comMsg = new TribesCommandMessage(CommandConstants.REMOVE_SERVICE_GROUP_CONTEXT,
+		                                      "",contextId,
+		                                      ((ServiceGroupContext)context).getDescription().getServiceGroupName());
+		}
+		
+		send(comMsg);
+	}
+
+	/*
+	public void removeProperty(AbstractContext ctx, String contextId, String parentId, String propertyName) {
+		if (ctx instanceof ServiceContext){
+			ctxManager.removePropFromServiceContext(parentId, contextId, propertyName);			
+		}else{
+			ctxManager.removePropFromServiceGroupContext(contextId, propertyName);
+		}
+	}*/
+	
+	public void updateState(ServiceContext ctx) {
+		
+		String parentId = ctx.getServiceGroupContext().getId();
+		String contextId = ctx.getAxisService().getName();
+		Map props = ctx.getProperties();
+
+		List<TribesMapEntryMessage> mapEntryMsgs = ctxManager.updateStateOnServiceContext(parentId, contextId, props);
+
+		for(TribesMapEntryMessage msg : mapEntryMsgs){
+			send(msg);
+		}
+		
+		Map serviceGrpProps = ctx.getServiceGroupContext().getProperties();
+		mapEntryMsgs = ctxManager.updateStateOnServiceGroupContext(parentId,serviceGrpProps);		
+
+		for(TribesMapEntryMessage msg : mapEntryMsgs){
+			send(msg);
+		}
+		
+		TribesCommandMessage comMsg = new TribesCommandMessage(
+				CommandConstants.UPDATE_STATE, parentId, contextId, contextId);
+
+		send(comMsg);
+	}
+
+	public boolean accept(Serializable msg, Member sender) {
+		//return msg instanceof TribesCommandMessage;
+		return true;
+	}
+
+	public void messageReceived(Serializable msg, Member sender) {
+			
+		if (!(msg instanceof TribesCommandMessage)){
+			return;
+		}
+		
+		System.out.println("msg received " + msg);
+				
+		TribesCommandMessage comMsg =  (TribesCommandMessage)msg;
+		
+		// TODO make sure to remove from the duplicate lists when remove is requested for both service group and service contexts
+		
+		if(comMsg.getCommandName().equals(CommandConstants.CREATE_SERVICE_GROUP_CONTEXT)){
+			// add to the duplicate list to prevent cyclic replication			
+			duplicateServiceGrps.put(comMsg.getContextId(),comMsg.getContextId());
+			ctxManager.addServiceGroupContext(comMsg.getContextId());
+			AxisServiceGroup axisServiceGroup = configContext.getAxisConfiguration().getServiceGroup(comMsg.getAxisDescriptionName());
+			ServiceGroupContext ctx = new ServiceGroupContext(configContext,axisServiceGroup);
+			ctx.setId(comMsg.getContextId());
+			configContext.registerServiceGroupContext(ctx);
+			
+		}else if(comMsg.getCommandName().equals(CommandConstants.CREATE_SERVICE_CONTEXT)){
+			try {
+				// add to the duplicate list to prevent cyclic replication			
+				duplicateServiceCtxs.put(comMsg.getParentId() + comMsg.getContextId(), comMsg.getContextId());
+				ctxManager.addServiceContext(comMsg.getParentId(), comMsg.getContextId());
+				AxisService axisService = configContext.getAxisConfiguration().getService(comMsg.getContextId());
+				ServiceGroupContext srvGrpCtx = configContext.getServiceGroupContext(comMsg.getParentId(),null);
+				// This will create service context if one is not available
+				srvGrpCtx.getServiceContext(axisService);
+			} catch (AxisFault e) {
+				log.error("Unable to find the service " + comMsg, e);
+			}
+			
+		}else if(comMsg.getCommandName().equals(CommandConstants.UPDATE_STATE)){
+			ServiceGroupContext srvGrpCtx = configContext.getServiceGroupContext(comMsg.getParentId(),null);
+			Map props = ctxManager.getServiceGroupProps(comMsg.getParentId());
+			Map tempProps = new HashMap();
+			tempProps.putAll(props);
+			
+			if (props != null){
+				System.out.println(props);
+				srvGrpCtx.setProperties(tempProps);
+			}
+			
+			try {
+				AxisService axisService = configContext.getAxisConfiguration().getService(comMsg.getContextId());
+				ServiceContext srvCtx = srvGrpCtx.getServiceContext(axisService);
+				Map srvProps = ctxManager.getServiceProps(comMsg.getParentId(),comMsg.getContextId());
+				Map tempSrvProps = new HashMap();
+				tempSrvProps.putAll(srvProps);
+				
+				if (props != null){
+					srvCtx.setProperties(tempSrvProps);
+				}	
+			} catch (AxisFault e) {
+				log.error("Unable to find the service " + comMsg, e);
+			}
+			
+			
+		}else if(comMsg.getCommandName().equals(CommandConstants.UPDATE_STATE_MAP_ENTRY)){
+			TribesMapEntryMessage mapEntryMsg = (TribesMapEntryMessage)comMsg;
+			if (mapEntryMsg.getCtxType() == TribesMapEntryMessage.SERVICE_GROUP_CONTEXT){
+				Map props = ctxManager.getServiceGroupProps(comMsg.getContextId());
+				if(mapEntryMsg.getOperation() == TribesMapEntryMessage.ADD_OR_UPDATE_ENTRY){
+					props.put(mapEntryMsg.getKey(),mapEntryMsg.getValue());
+				}else{
+					props.remove(mapEntryMsg.getKey());
+				}
+			}else if (mapEntryMsg.getCtxType() == TribesMapEntryMessage.SERVICE_GROUP_CONTEXT){
+				Map props = ctxManager.getServiceProps(comMsg.getParentId(),comMsg.getContextId());
+				if(mapEntryMsg.getOperation() == TribesMapEntryMessage.ADD_OR_UPDATE_ENTRY){
+					props.put(mapEntryMsg.getKey(),mapEntryMsg.getValue());
+				}else{
+					props.remove(mapEntryMsg.getKey());
+				}
+			}
+		}
+	}
+	
+	private void send(TribesCommandMessage msg){
+		Member[] group = channel.getMembers();
+		log.debug("Group size " + group.length);
+        //send the message
+		
+		for (Member member : group){
+			printMember(member);
+		}
+		
+		
+        try {
+			channel.send(group,msg,0);
+		} catch (ChannelException e) {
+			log.error("Error sending command message : " + msg,e);
+		}
+	}
+
+	private void printMember(Member member){
+		member.getUniqueId();
+		log.debug("\n===============================");
+		log.debug("Member Name " + member.getName());
+		log.debug("Member Host" + member.getHost());
+		log.debug("Member Payload" + member.getPayload());
+		log.debug("===============================\n");
+	}
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesCommandMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesCommandMessage.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesCommandMessage.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesCommandMessage.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,65 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+
+
+public class TribesCommandMessage implements CommandConstants, Serializable{
+	
+	private String commandName;
+	private String parentId;
+	private String contextId;
+	private String axisDescriptionName;
+	
+	public TribesCommandMessage(){	
+	}
+
+	public TribesCommandMessage(String commandName, String parentId, String contextId, String axisDescriptionName) {
+		this.commandName = commandName;
+		this.parentId = parentId;
+		this.contextId = contextId;
+		this.axisDescriptionName = axisDescriptionName;
+	}
+	
+	public String getCommandName() {
+		return commandName;
+	}
+
+	public void setCommandName(String commandName) {
+		this.commandName = commandName;
+	}
+	
+	public String getContextId() {
+		return contextId;
+	}
+
+	public void setContextId(String contextId) {
+		this.contextId = contextId;
+	}
+
+	public String getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(String parentId) {
+		this.parentId = parentId;
+	}
+	
+	public String toString(){
+		StringBuilder builder = new StringBuilder();
+		builder.append("TribesCommandMessage [");
+		builder.append(commandName + ",");
+		builder.append(parentId + ",");
+		builder.append(contextId + ",");
+		builder.append(axisDescriptionName + "]");
+		
+		return builder.toString();
+	}
+
+	public String getAxisDescriptionName() {
+		return axisDescriptionName;
+	}
+
+	public void setAxisDescriptionName(String axisDescriptionName) {
+		this.axisDescriptionName = axisDescriptionName;
+	}
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesInfoWebService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesInfoWebService.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesInfoWebService.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesInfoWebService.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,94 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.util.List;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.catalina.tribes.Member;
+
+public class TribesInfoWebService {
+
+	private ServiceContext srvCtx;
+	
+	public void init(ServiceContext context){
+	   this.srvCtx = context;	
+	}
+	
+	public OMElement getMembershipInfo(){
+		ConfigurationContext configCtx = srvCtx.getConfigurationContext();
+		TransientTribesMemberInfo memberInfo = (TransientTribesMemberInfo)configCtx.getProperty("MEMBER_INFO");
+		
+		List <Member> liveMembers = memberInfo.getLiveNodes();
+		List <Member> deadMembers = memberInfo.getDeadNodes();
+		
+		SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        OMNamespace omNs = factory.createOMNamespace("http://org.apache.axis2.cluster.tribes/xsd", "tribes");
+        
+        OMElement memberInfoOM = factory.createOMElement("memberInfo",omNs);
+        
+        OMElement liveMemberOM = factory.createOMElement("liveMemberInfo",omNs);
+        for (Member member : liveMembers){
+        	OMElement memberOM = factory.createOMElement("member",omNs);
+        	memberOM.addAttribute(factory.createOMAttribute("name", omNs, member.getName()));
+        	memberOM.addAttribute(factory.createOMAttribute("host", omNs, String.valueOf(member.getHost())));
+        	memberOM.addAttribute(factory.createOMAttribute("port", omNs, String.valueOf(member.getPort())));
+        	memberOM.addAttribute(factory.createOMAttribute("aliveTime", omNs, String.valueOf(member.getMemberAliveTime())));
+        	liveMemberOM.addChild(memberOM);
+        }
+        
+        OMElement deadMemberOM = factory.createOMElement("deadMemberInfo",omNs);
+        for (Member member : deadMembers){
+        	OMElement memberOM = factory.createOMElement("member",omNs);
+        	memberOM.addAttribute(factory.createOMAttribute("name", omNs, member.getName()));
+        	memberOM.addAttribute(factory.createOMAttribute("host", omNs, String.valueOf(member.getHost())));
+        	memberOM.addAttribute(factory.createOMAttribute("port", omNs, String.valueOf(member.getPort())));
+        	memberOM.addAttribute(factory.createOMAttribute("aliveTime", omNs, String.valueOf(member.getMemberAliveTime())));
+        	deadMemberOM.addChild(memberOM);
+        }
+        
+        memberInfoOM.addChild(liveMemberOM);
+        memberInfoOM.addChild(deadMemberOM);
+        
+        return memberInfoOM;
+	}
+	
+	public OMElement getChannelInfo(){
+		ConfigurationContext configCtx = srvCtx.getConfigurationContext();
+		TransientTribesChannelInfo channelInfo = (TransientTribesChannelInfo)configCtx.getProperty("CHANNEL_INFO");
+		
+		SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        OMNamespace omNs = factory.createOMNamespace("http://org.apache.axis2.cluster.tribes/xsd", "tribes");
+        OMElement channelInfoOM = factory.createOMElement("channelInfo",omNs);
+        
+        OMElement messageCountOM = factory.createOMElement("messageCount",omNs);
+        messageCountOM.addChild(factory.createOMText(messageCountOM, String.valueOf(channelInfo.getMessageCount())));
+        
+        OMElement grpCtxCreationCountOM = factory.createOMElement("grpCtxCreationCount",omNs);
+        grpCtxCreationCountOM.addChild(factory.createOMText(grpCtxCreationCountOM, String.valueOf(channelInfo.getGrpCtxCreationCount())));
+        
+        OMElement grpCtxRemoveCountOM = factory.createOMElement("grpCtxRemoveCount",omNs);
+        grpCtxRemoveCountOM.addChild(factory.createOMText(grpCtxRemoveCountOM, String.valueOf(channelInfo.getGrpCtxRemoveCount())));
+        
+        OMElement srvCtxCreationCountOM = factory.createOMElement("srvCtxCreationCount",omNs);
+        srvCtxCreationCountOM.addChild(factory.createOMText(srvCtxCreationCountOM, String.valueOf(channelInfo.getSrvCtxCreationCount())));
+        
+        OMElement srvCtxRemoveCountOM = factory.createOMElement("srvCtxRemoveCount",omNs);
+        srvCtxRemoveCountOM.addChild(factory.createOMText(srvCtxRemoveCountOM, String.valueOf(channelInfo.getSrvCtxRemoveCount())));
+        
+        OMElement updateStateCountOM = factory.createOMElement("updateStateCount",omNs);
+        updateStateCountOM.addChild(factory.createOMText(updateStateCountOM, String.valueOf(channelInfo.getUpdateStateCount())));
+        
+        channelInfoOM.addChild(messageCountOM);
+        channelInfoOM.addChild(grpCtxCreationCountOM);
+        channelInfoOM.addChild(grpCtxRemoveCountOM);
+        channelInfoOM.addChild(srvCtxCreationCountOM);
+        channelInfoOM.addChild(srvCtxRemoveCountOM);
+        channelInfoOM.addChild(updateStateCountOM);
+        
+        return channelInfoOM;
+	}	
+}

Added: webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesMapEntryMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesMapEntryMessage.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesMapEntryMessage.java (added)
+++ webservices/axis2/branches/java/clustering/modules/cluster/src/org/apache/axis2/cluster/tribes/TribesMapEntryMessage.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,71 @@
+package org.apache.axis2.cluster.tribes;
+
+import java.io.Serializable;
+
+public class TribesMapEntryMessage extends TribesCommandMessage {
+	
+	public static short ADD_OR_UPDATE_ENTRY = 0;
+	public static short REMOVE_ENTRY = 1;
+	public static short SERVICE_GROUP_CONTEXT = 0;
+	public static short SERVICE_CONTEXT = 1;
+	
+	String key;
+	Serializable value;
+	short operation;
+	short ctxType;
+	
+	public short getOperation() {
+		return operation;
+	}
+
+	public short getCtxType() {
+		return ctxType;
+	}
+
+	public void setCtxType(short ctxType) {
+		this.ctxType = ctxType;
+	}
+
+	public void setOperation(short operation) {
+		this.operation = operation;
+	}
+
+	public TribesMapEntryMessage(String commandName, String parentId,
+			String contextId, String axisDescriptionName,
+			String key, Serializable value,short ctxType,short operation) {
+		super(commandName, parentId, contextId, axisDescriptionName);
+		this.key = key;
+		this.value = value;
+		this.operation = operation;
+		this.ctxType = ctxType;
+	}
+
+	public String getKey() {
+		return key;
+	}
+
+	public void setKey(String key) {
+		this.key = key;
+	}
+
+	public Serializable getValue() {
+		return value;
+	}
+
+	public void setValue(Serializable value) {
+		this.value = value;
+	}
+	
+	public String toString(){
+		StringBuilder builder = new StringBuilder();
+		builder.append("TribesCommandMessage [");
+		builder.append(this.getCommandName() + ",");
+		builder.append(this.getParentId() + ",");
+		builder.append(this.getContextId() + ",");
+		builder.append(this.getOperation() == ADD_OR_UPDATE_ENTRY ? "ADD_OR_UPDATE_ENTRY" : "REMOVE_ENTRY" + ",");
+		builder.append(this.getCtxType() == SERVICE_GROUP_CONTEXT ? "SERVICE_GROUP_CONTEXT" : "SERVICE_CONTEXT" + "]");
+		
+		return builder.toString();
+	}
+
+}

Added: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java (added)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,17 @@
+package org.apache.axis2.cluster;
+
+import java.util.Map;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ServiceContext;
+
+public interface ClusterManager {
+
+	public void init(ConfigurationContext context);
+
+	public void addContext(String name, String id, AbstractContext context);
+	
+	public void updateState(ServiceContext ctx);
+	
+}

Added: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/NullClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/NullClusterManager.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/NullClusterManager.java (added)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/cluster/NullClusterManager.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,21 @@
+package org.apache.axis2.cluster;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ServiceContext;
+
+public class NullClusterManager implements ClusterManager{
+
+    public void addContext(String contextId, String parentContextId, AbstractContext context) {
+    }
+
+    public void init(ConfigurationContext context) {
+    }
+
+    public void removeContext(String contextId, String parentContextId, AbstractContext context) {
+    }
+
+	public void updateState(ServiceContext ctx) {
+	}
+
+}

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/AbstractContext.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/AbstractContext.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/AbstractContext.java Sun Feb  4 20:06:24 2007
@@ -21,6 +21,8 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.axis2.cluster.ClusterManager;
+
 /**
  * This is the top most level of the Context hierarchy and is a bag of properties.
  */
@@ -132,7 +134,12 @@
      * @param value
      */
     public void setProperty(String key, Object value) {
-        properties.put(key, value);
+    	if(this instanceof ServiceContext){
+    		System.out.println("========== Service Context ======================");
+    	}else if (this instanceof ServiceGroupContext){
+    		System.out.println("========== Service Group Context ======================");
+    	}
+        properties.put(key, value);        
     }
 
     /**

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java Sun Feb  4 20:06:24 2007
@@ -17,10 +17,21 @@
 
 package org.apache.axis2.context;
 
+import java.io.File;
+import java.net.URL;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.description.*;
+import org.apache.axis2.cluster.ClusterManager;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.DependencyManager;
 import org.apache.axis2.engine.ListenerManager;
@@ -30,10 +41,6 @@
 import org.apache.axis2.util.threadpool.ThreadFactory;
 import org.apache.axis2.util.threadpool.ThreadPool;
 
-import java.io.File;
-import java.net.URL;
-import java.util.*;
-
 /**
  * This contains all the configuration information for Axis2.
  */
@@ -65,7 +72,14 @@
         super(null);
         this.axisConfiguration = axisConfiguration;
         initConfigContextTimeout(axisConfiguration);
+
+        initCluster();
     }
+
+    private void initCluster() {
+		ClusterManager clusterManager = axisConfiguration.getClusterManager();
+		clusterManager.init(this);
+	}
 
     private void initConfigContextTimeout(AxisConfiguration axisConfiguration) {
         Parameter parameter = axisConfiguration.getParameter(Constants.Configuration.CONFIG_CONTEXT_TIMOUT_INTERVAL);

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/OperationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/OperationContext.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/OperationContext.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/OperationContext.java Sun Feb  4 20:06:24 2007
@@ -17,6 +17,20 @@
 
 package org.apache.axis2.context;
 
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.ClusterManager;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.util.ObjectStateUtils;
+import org.apache.axis2.util.MetaDataEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -306,9 +320,9 @@
     }
 
     public void setComplete(boolean complete) {
-        isComplete = complete;
-    }
-
+		isComplete = complete;	
+	}
+    
     public void setKey(String key) {
         this.key = key;
     }

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceContext.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceContext.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceContext.java Sun Feb  4 20:06:24 2007
@@ -17,9 +17,13 @@
 
 package org.apache.axis2.context;
 
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.cluster.ClusterManager;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.TransportInDescription;
@@ -101,7 +105,8 @@
     private boolean cachingOperationContext;
     /** A cache for the last OperationContext */
     private transient OperationContext lastOperationContext;
-
+    private ClusterManager clusterManager;
+    
 
     //----------------------------------------------------------------
     // MetaData for data to be restored in activate after readExternal
@@ -141,6 +146,9 @@
         this.serviceGroupContext = serviceGroupContext;
         this.axisService = serviceConfig;
         this.configContext = (ConfigurationContext) parent.getParent();
+        
+        clusterManager = configContext.getAxisConfiguration().getClusterManager();
+        clusterManager.addContext(serviceConfig.getName(), serviceGroupContext.getId(),this);
     }
 
     public OperationContext createOperationContext(QName name) {
@@ -247,7 +255,7 @@
     public void setCachingOperationContext(boolean cacheLastOperationContext) {
         this.cachingOperationContext = cacheLastOperationContext;
     }
-
+	
 
     /**
      * Returns a name associated with this ServiceContext.

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/context/ServiceGroupContext.java Sun Feb  4 20:06:24 2007
@@ -18,6 +18,7 @@
 package org.apache.axis2.context;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.ClusterManager;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
@@ -38,6 +39,7 @@
 import java.util.Iterator;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 public class ServiceGroupContext extends AbstractContext implements Externalizable {
 
@@ -75,7 +77,8 @@
     private transient AxisServiceGroup axisServiceGroup;
     private String id;
     private Map serviceContextMap;
-
+    private ClusterManager clusterManager;
+    
     //----------------------------------------------------------------
     // MetaData for data to be restored in activate after readExternal
     //----------------------------------------------------------------
@@ -109,10 +112,14 @@
         super(parent);
         this.axisServiceGroup = axisServiceGroup;
         serviceContextMap = new HashMap();
+
+        clusterManager = parent.getAxisConfiguration().getClusterManager();
+
         // initially set the id to the axisServiceGroup
         if (axisServiceGroup != null) {
             setId(axisServiceGroup.getServiceGroupName());
         }
+
     }
 
     public AxisServiceGroup getDescription() {
@@ -146,6 +153,8 @@
         if (serviceContext == null) {
             serviceContext = new ServiceContext(service, this);
             serviceContextMap.put(service.getName(), serviceContext);
+            
+            System.out.println("Added a new Service Ctx " + service.getName());
         }
         return serviceContext;
     }
@@ -160,12 +169,16 @@
         return serviceContextMap.values().iterator();
     }
 
+    /*
+     * We are interested in replicating the service group context
+     * at this point
+     */
     public void setId(String id) {
         this.id = id;
+        ClusterManager clusterManager = ((ConfigurationContext)this.getParent()).getAxisConfiguration().getClusterManager();
+        clusterManager.addContext(id, null,this);
     }
-
-
-
+    
     /**
      * Adds the specified service context object to the
      * lists of service contexts for this service group
@@ -571,6 +584,7 @@
         return true;
     }
 
+
     /**
      * Trace a warning message, if needed, indicating that this 
      * object needs to be activated before accessing certain fields.
@@ -583,4 +597,5 @@
             log.warn(myClassName+":"+methodname+"(): ****WARNING**** "+myClassName+".activate(configurationContext) needs to be invoked.");
         }
     }
+
 }

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Sun Feb  4 20:06:24 2007
@@ -20,6 +20,7 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.NullClusterManager;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
 import org.apache.axis2.description.*;
@@ -135,6 +136,15 @@
             if (defaultModuleVerionElement != null) {
                 processDefaultModuleVersions(defaultModuleVerionElement);
             }
+            
+            OMElement clusterElement = config_element.getFirstChildWithName(new QName(TAG_CLUSTER));
+            if (clusterElement != null) {
+	        ClusterBuilder clusterBuilder = new ClusterBuilder(axisConfig);
+	        clusterBuilder.buildCluster(clusterElement);
+	    }else {
+	        axisConfig.setClusterManager(new NullClusterManager());
+	    }
+
             
             // process MessageBuilders
             OMElement messageBuildersElement = config_element.getFirstChildWithName(new QName(TAG_MESSAGE_BUILDERS));

Added: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java?view=auto&rev=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java (added)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java Sun Feb  4 20:06:24 2007
@@ -0,0 +1,73 @@
+/**
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.axis2.deployment;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.cluster.ClusterManager;
+import org.apache.axis2.cluster.NullClusterManager;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Builds a service description from OM
+ */
+public class ClusterBuilder extends DescriptionBuilder {
+    private static final Log log = LogFactory.getLog(ClusterBuilder.class);
+    private AxisService service;
+
+    public ClusterBuilder(AxisConfiguration axisConfig) {
+        this.axisConfig = axisConfig;
+    }
+
+    public ClusterBuilder(InputStream serviceInputStream, AxisConfiguration axisConfig) {
+        super(serviceInputStream, axisConfig);
+    }
+
+    /**
+     * Populates service from corresponding OM.
+     */
+    public void buildCluster(OMElement clusterElement)
+			throws DeploymentException {
+		String className = clusterElement.getAttribute(
+				new QName(TAG_CLASS_NAME)).getAttributeValue();
+		ClusterManager clusterManager;
+		try {
+			Class clazz = Class.forName(className);
+			clusterManager = (ClusterManager) clazz.newInstance();
+			axisConfig.setClusterManager(clusterManager);
+			return;
+		} catch (ClassNotFoundException e) {
+			log.error("Cluster implementation class not found", e);
+		} catch (InstantiationException e) {
+			log.error("Cannot load Cluster implementation", e);
+			e.printStackTrace();
+		} catch (IllegalAccessException e) {
+			log.error("", e);
+		}
+
+		axisConfig.setClusterManager(new NullClusterManager());
+	}
+
+}

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Sun Feb  4 20:06:24 2007
@@ -65,6 +65,7 @@
     String TAG_TRANSPORT = "transport";
     String TAG_MEP = "mep";
     String TAG_DEFAULT_MODULE_VERSION = "defaultModuleVersions";
+    String TAG_CLUSTER = "cluster"; 
     String TAG_MESSAGE_BUILDERS = "messageBuilders"; //used to add pluggable support for diffrent wire formats
     String TAG_MESSAGE_BUILDER = "messageBuilder";
     String TAG_CONTENT_TYPE = "contentType";

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Sun Feb  4 20:06:24 2007
@@ -17,6 +17,7 @@
 package org.apache.axis2.engine;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.cluster.ClusterManager;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.DeploymentException;
@@ -120,6 +121,8 @@
     private boolean start;
 
     private ArrayList targetResolvers;
+    
+    private ClusterManager clusterManager;
 
     /**
      * Constructor AxisConfigurationImpl.
@@ -952,6 +955,14 @@
     public boolean isAssertionLocal(QName name) {
         return this.localPolicyAssertions.contains(name);
     }
+    
+    public ClusterManager getClusterManager() {
+		return clusterManager;
+	}
+
+	public void setClusterManager(ClusterManager clusterManager) {
+		this.clusterManager = clusterManager;
+	}
 
     /**
      * Checks whether some one has changed the system pre-defined phases
@@ -966,4 +977,5 @@
         setGlobalOutPhase(phasesInfo.getGlobalOutPhaseList());
         setOutFaultPhases(phasesInfo.getOUT_FaultPhases());
     }
+
 }

Modified: webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=503543&r1=503542&r2=503543
==============================================================================
--- webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java (original)
+++ webservices/axis2/branches/java/clustering/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java Sun Feb  4 20:06:24 2007
@@ -27,9 +27,11 @@
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.cluster.ClusterManager;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.engine.Handler.InvocationResponse;
@@ -199,6 +201,15 @@
           flowComplete(msgContext, true);
           throw e;
         }
+        
+        // Choosing this as the replication point.
+        ServiceContext ctx = msgContext.getServiceContext();
+        
+		if (ctx != null){
+			ClusterManager clusterManager = confContext.getAxisConfiguration()
+					.getClusterManager();
+			clusterManager.updateState(ctx);
+		}
         
         return InvocationResponse.CONTINUE;
     }



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