axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r519894 - in /webservices/axis2/trunk/java/modules: clustering/src/org/apache/axis2/cluster/listeners/ clustering/src/org/apache/axis2/cluster/tribes/ clustering/src/org/apache/axis2/cluster/tribes/configuration/ clustering/src/org/apache/a...
Date Mon, 19 Mar 2007 10:32:10 GMT
Author: chamikara
Date: Mon Mar 19 03:31:58 2007
New Revision: 519894

URL: http://svn.apache.org/viewvc?view=rev&rev=519894
Log:
Implemented the missing parts of the ConfigurationManager.
Added the setConfigurationManager, setContextManager methods to the CM.
Added a setConfigContext method to the ContextManager and the ContextManagerListener.
Added a setAxisConfiguration method to ConfigManager and ConfigManagerListener.
Did updates to extend the exis2.xml clustering entry to include ConfigManager,ContextManager
and the Listeners.
Updated the test cases.

Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
    webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusteringFault.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/listeners/DefaultContextManagerListener.java
Mon Mar 19 03:31:58 2007
@@ -38,10 +38,6 @@
 	ConfigurationContext configurationContext = null;
 	private static final Log log = LogFactory.getLog(DefaultContextManagerListener.class);
 	
-	public DefaultContextManagerListener (ConfigurationContext configurationContext) {
-		this.configurationContext = configurationContext;
-	}
-	
 	public ContextUpdater getUpdater() {
 		return updater;
 	}
@@ -117,7 +113,10 @@
 			}
 
 		}
-		
+	}
+
+	public void setConfigurationContext(ConfigurationContext configurationContext) {
+		this.configurationContext = configurationContext;
 	}
 
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/ChannelListener.java
Mon Mar 19 03:31:58 2007
@@ -155,7 +155,6 @@
 		if (msg instanceof ConfigurationCommand) {
 
 			ConfigurationCommand command = (ConfigurationCommand) msg;
-			System.out.println("CmdType:" + command.getCommandType());
 			if (command.getCommandType() == CommandType.LOAD_SERVICE_GROUP) {
 				
 				ConfigurationEvent event = new ConfigurationEvent();

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/TribesClusterManager.java
Mon Mar 19 03:31:58 2007
@@ -59,20 +59,17 @@
 		return configurationManager;
 	}
 
-	public void init(ConfigurationContext context) throws ClusteringFault {
+	public void init(ConfigurationContext configurationContext) throws ClusteringFault {
 		log.debug("initializing tibes");
-
-		this.configContext = context;
-		contextManager.setConfigContext(context);
-		
+		this.configContext = configurationContext;
 		ChannelSender sender = new ChannelSender ();
 		ChannelListener listener = new ChannelListener (configurationManager, contextManager);
 
 		TransientTribesChannelInfo channelInfo = new TransientTribesChannelInfo();
 		TransientTribesMemberInfo memberInfo = new TransientTribesMemberInfo();
 
-		configContext.setProperty("MEMBER_INFO", memberInfo);
-		configContext.setProperty("CHANNEL_INFO", channelInfo);
+		configurationContext.setProperty("MEMBER_INFO", memberInfo);
+		configurationContext.setProperty("CHANNEL_INFO", channelInfo);
 
 		contextManager.setSender(sender);
 		configurationManager.setSender(sender);
@@ -93,7 +90,7 @@
 			listener.setUpdater(updater);
 			listener.setContextManager(contextManager);
 			
-			registerTribesInfoService(configContext);
+			registerTribesInfoService(configurationContext);
 
 		} catch (ChannelException e) {
 			String message = "Error starting Tribes channel";
@@ -114,4 +111,13 @@
 		}
 	}
 
+	public void setConfigurationManager(ConfigurationManager configurationManager) {
+		this.configurationManager = (TribesConfigurationManager) configurationManager;
+	}
+
+	public void setContextManager(ContextManager contextManager) {
+		this.contextManager = (TribesContextManager) contextManager;
+	}
+
+	
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/configuration/TribesConfigurationManager.java
Mon Mar 19 03:31:58 2007
@@ -25,19 +25,23 @@
 import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
 import org.apache.axis2.cluster.tribes.ChannelSender;
 import org.apache.axis2.cluster.tribes.CommandType;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.neethi.Policy;
 
 public class TribesConfigurationManager implements ConfigurationManager {
 
 	private ArrayList listeners = null;
 	private ChannelSender sender = null;
-	
+	private AxisConfiguration axisConfiguration = null;
 	
 	public TribesConfigurationManager () {
 		listeners = new ArrayList ();
 	}
 	
 	public void addConfigurationManagerListener(ConfigurationManagerListener listener) {
+		if (axisConfiguration!=null)
+			listener.setAxisConfiguration(axisConfiguration);
+		
 		listeners.add(listener);
 	}
 
@@ -108,7 +112,10 @@
 			else if (CommandType.ROLLBACK==command)
 				listener.rollbackCalled(event);
 		}
-		
+	}
+
+	public void setAxisConfiguration(AxisConfiguration axisConfiguration) {
+		this.axisConfiguration = axisConfiguration;
 	}
 	
 }

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/context/TribesContextManager.java
Mon Mar 19 03:31:58 2007
@@ -259,6 +259,9 @@
 	}
 
 	public void addContextManagerListener(ContextManagerListener listener) {
+		if (configContext!=null)
+			listener.setConfigurationContext(configContext);
+		
 		listeners.add(listener);
 	}
 
@@ -272,9 +275,16 @@
 		}
 	}
 
-	public void setConfigContext(ConfigurationContext configContext) {
-		this.configContext = configContext;
+	public void setConfigurationContext(ConfigurationContext configurationContext) {
+		this.configContext = configurationContext;
+		
+		//setting this to the listeners as well.
+		if (listeners!=null) {
+			for (Iterator it=listeners.iterator();it.hasNext();) {
+				ContextManagerListener listener = (ContextManagerListener) it.next();
+				listener.setConfigurationContext(configurationContext);
+			}
+		}
 	}
-	
 	
 }

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
Mon Mar 19 03:31:58 2007
@@ -62,11 +62,17 @@
 		configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
 		configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();
 
-		contextManagerListener1 = new DefaultContextManagerListener (configurationContext1);
+		clusterManager1.getContextManager().setConfigurationContext(configurationContext1);
+		clusterManager2.getContextManager().setConfigurationContext(configurationContext2);
+		
+		contextManagerListener1 = new DefaultContextManagerListener ();
 		clusterManager1.getContextManager(). addContextManagerListener (contextManagerListener1);
-		contextManagerListener2 = new DefaultContextManagerListener (configurationContext2);
+		contextManagerListener2 = new DefaultContextManagerListener ();
 		clusterManager2.getContextManager(). addContextManagerListener (contextManagerListener2);

 
+		clusterManager1.getConfigurationManager().setAxisConfiguration(configurationContext1.getAxisConfiguration());
+		clusterManager2.getConfigurationManager().setAxisConfiguration(configurationContext2.getAxisConfiguration());
+		
 		configurationManagerListener1 = new TestConfigurationManagerListener ();
 		clusterManager1.getConfigurationManager().addConfigurationManagerListener(configurationManagerListener1);
 		configurationManagerListener2 = new TestConfigurationManagerListener ();

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
Mon Mar 19 03:31:58 2007
@@ -16,6 +16,8 @@
 
 package org.apache.axis2.clustering.configuration;
 
+import java.util.List;
+
 import org.apache.axis2.cluster.ClusteringFault;
 import org.apache.axis2.cluster.configuration.ConfigurationEvent;
 import org.apache.axis2.clustering.ClusterManagerTestCase;
@@ -40,7 +42,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
 		assertEquals(event.getConfigurationName(), serviceGroupName);
     }
@@ -58,7 +64,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
 		assertEquals(event.getConfigurationName(), serviceGroupName);
     }
@@ -80,8 +90,11 @@
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}
-    	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+		
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
 		assertNotNull(event);
 		assertEquals(event.getConfigurationName(), serviceGroupName);
 		assertEquals(event.getPolicyId(), policyID);
@@ -101,7 +114,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
     }
     
@@ -118,7 +135,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
     }
     
@@ -135,7 +156,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
     }
 	
@@ -152,7 +177,11 @@
 			e.printStackTrace();
 		}
     	
-		ConfigurationEvent event = (ConfigurationEvent) configurationManagerListener2.getEventList().get(0);
+    	List eventList = configurationManagerListener2.getEventList();
+    	assertNotNull(eventList);
+    	assertEquals(eventList.size(), 1);
+		ConfigurationEvent event = (ConfigurationEvent) eventList.get(0);
+		
 		assertNotNull(event);
     }
     

Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
(original)
+++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/TestConfigurationManagerListener.java
Mon Mar 19 03:31:58 2007
@@ -19,10 +19,12 @@
 import java.util.ArrayList;
 import org.apache.axis2.cluster.configuration.ConfigurationEvent;
 import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
+import org.apache.axis2.engine.AxisConfiguration;
 
 public class TestConfigurationManagerListener implements ConfigurationManagerListener {
 
 	ArrayList eventList = null;
+	private AxisConfiguration axisConfiguration = null;
 	
 	public TestConfigurationManagerListener () {
 		eventList = new ArrayList ();
@@ -64,4 +66,8 @@
 		eventList.add(event);
 	}
 
+	public void setAxisConfiguration(AxisConfiguration axisConfiguration) {
+		this.axisConfiguration = axisConfiguration;
+	}
+	
 }

Modified: webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/kernel/conf/axis2.xml Mon Mar 19 03:31:58 2007
@@ -241,12 +241,19 @@
     <!-- ================================================= -->
     <!-- Clustering  -->
     <!-- ================================================= -->
-    <!-- Configure and uncomment following for preparing Axis2 to a clustered environment
-->
+    <!-- Configure and uncomment following for preparing Axis2 to a clustered environment
-->
     <!-- 
-    <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
-    	<parameter name="param1" locked="false">value1</parameter>
+    <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
+    	<configurationManager class="org.apache.axis2.cluster.tribes.configuration.TribesConfigurationManager">
+    	    <listeners>
+    	    </listeners>
+    	</configurationManager>
+    	<contextManager class="org.apache.axis2.cluster.tribes.context.TribesContextManager">
+    	    <listeners>
+    	    </listeners>
+    	</contextManager>
     </cluster>
-     -->
+    -->
      
     <!-- ================================================= -->
     <!-- Phases  -->

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusterManager.java
Mon Mar 19 03:31:58 2007
@@ -21,7 +21,9 @@
 import org.apache.axis2.context.ConfigurationContext;
 
 public interface ClusterManager {
-    public void init(ConfigurationContext context) throws ClusteringFault;
+    public void init(ConfigurationContext configurationContext) throws ClusteringFault;
     public ContextManager getContextManager ();
     public ConfigurationManager getConfigurationManager ();
+    public void setContextManager (ContextManager contextManager);
+    public void setConfigurationManager (ConfigurationManager configurationManager);
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusteringFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusteringFault.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusteringFault.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/ClusteringFault.java
Mon Mar 19 03:31:58 2007
@@ -27,4 +27,8 @@
 	public ClusteringFault (String message, Exception e) {
 		super (message, e);
 	}
+	
+	public ClusteringFault (Exception e) {
+		super (e);
+	}
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManager.java
Mon Mar 19 03:31:58 2007
@@ -17,6 +17,7 @@
 package org.apache.axis2.cluster.configuration;
 
 import org.apache.axis2.cluster.ClusteringFault;
+import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.neethi.Policy;
 
 public interface ConfigurationManager {
@@ -40,4 +41,6 @@
      * For registering a configuration event listener.
      */
     void addConfigurationManagerListener(ConfigurationManagerListener listener);
-}
+    
+    void setAxisConfiguration (AxisConfiguration axisConfiguration);
+}
\ No newline at end of file

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/configuration/ConfigurationManagerListener.java
Mon Mar 19 03:31:58 2007
@@ -16,8 +16,9 @@
 
 package org.apache.axis2.cluster.configuration;
 
+import org.apache.axis2.engine.AxisConfiguration;
+
 public interface ConfigurationManagerListener {
-	
     public void serviceGroupLoaded(ConfigurationEvent event);
     public void serviceGroupUnloaded(ConfigurationEvent event);
     public void policyApplied(ConfigurationEvent event);
@@ -25,5 +26,5 @@
     public void prepareCalled (ConfigurationEvent event);
     public void rollbackCalled (ConfigurationEvent event);
     public void commitCalled (ConfigurationEvent event);
-    
+    public void setAxisConfiguration (AxisConfiguration axisConfiguration);
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManager.java
Mon Mar 19 03:31:58 2007
@@ -18,6 +18,7 @@
 
 import org.apache.axis2.cluster.ClusteringFault;
 import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ConfigurationContext;
 
 public interface ContextManager {
     public void addContext(AbstractContext context) throws ClusteringFault;
@@ -25,4 +26,5 @@
     public void updateState(AbstractContext context) throws ClusteringFault;
     public boolean isContextClusterable (AbstractContext context) throws ClusteringFault;
     public void addContextManagerListener (ContextManagerListener listener);
+    public void setConfigurationContext (ConfigurationContext configurationContext);
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextManagerListener.java
Mon Mar 19 03:31:58 2007
@@ -16,9 +16,11 @@
 
 package org.apache.axis2.cluster.context;
 
+import org.apache.axis2.context.ConfigurationContext;
 
 public interface ContextManagerListener {
     public void contextAdded(ContextEvent event);
     public void contextRemoved(ContextEvent event);
     public void contextUpdated(ContextEvent event);
+    public void setConfigurationContext (ConfigurationContext configurationContext);
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/cluster/context/ContextType.java
Mon Mar 19 03:31:58 2007
@@ -17,8 +17,8 @@
 package org.apache.axis2.cluster.context;
 
 public class ContextType {
-	final int CONFIG_CONTEXT = 1;
-	final int SERVICE_GROUP_CONTEXT = 2;
-	final int SERVICE_CONTEXT = 3;
-	final int OPERATION_CONTEXT = 4;
+	public static final int CONFIG_CONTEXT = 1;
+	public static final int SERVICE_GROUP_CONTEXT = 2;
+	public static final int SERVICE_CONTEXT = 3;
+	public static final int OPERATION_CONTEXT = 4;
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java
Mon Mar 19 03:31:58 2007
@@ -87,6 +87,12 @@
 
     public void initCluster() throws AxisFault {
         ClusterManager clusterManager = axisConfiguration.getClusterManager();
+        if (clusterManager!=null) {
+        	ContextManager contextManager = clusterManager.getContextManager();
+        	if (contextManager!=null)
+        		contextManager.setConfigurationContext(this);
+        }
+        
         clusterManager.init(this);
     }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
Mon Mar 19 03:31:58 2007
@@ -17,8 +17,14 @@
 
 package org.apache.axis2.deployment;
 
+import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.cluster.ClusterManager;
+import org.apache.axis2.cluster.configuration.ConfigurationManager;
+import org.apache.axis2.cluster.configuration.ConfigurationManagerListener;
+import org.apache.axis2.cluster.context.ContextManager;
+import org.apache.axis2.cluster.context.ContextManagerListener;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
@@ -27,6 +33,7 @@
 
 import javax.xml.namespace.QName;
 import java.io.InputStream;
+import java.util.Iterator;
 
 
 /**
@@ -50,17 +57,101 @@
     public void buildCluster(OMElement clusterElement)
             throws DeploymentException {
 
-        String className = clusterElement.getAttribute(
-                new QName(TAG_CLASS_NAME)).getAttributeValue();
+        OMAttribute classNameAttr = clusterElement.getAttribute(new QName(TAG_CLASS_NAME));
+        if (classNameAttr==null) {
+            throw new DeploymentException(Messages.getMessage("classAttributeNotFound", TAG_CLUSTER));
+        }
+        
+        String className = classNameAttr.getAttributeValue();
         ClusterManager clusterManager;
         try {
             Class clazz = Class.forName(className);
             clusterManager = (ClusterManager) clazz.newInstance();
+            
+            //loading the ConfigurationManager
+            OMElement configurationManagerElement = clusterElement.getFirstChildWithName(
+            			new QName (TAG_CONFIGURATION_MANAGER));
+            if (configurationManagerElement != null) {
+                classNameAttr = configurationManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
+                if (classNameAttr==null) {
+                    throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
TAG_CONFIGURATION_MANAGER));
+                }
+                
+                className = classNameAttr.getAttributeValue();
+				clazz = Class.forName(className);
+				
+				ConfigurationManager configurationManager = (ConfigurationManager) clazz
+						.newInstance();
+				clusterManager.setConfigurationManager(configurationManager);
+
+				OMElement listenersElement = configurationManagerElement
+						.getFirstChildWithName(new QName(TAG_LISTENERS));
+				if (listenersElement != null) {
+					Iterator listenerElemIter = listenersElement.getChildrenWithName(new QName(
+							TAG_LISTENER));
+					while (listenerElemIter.hasNext()) {
+						OMElement listenerElement = (OMElement) listenerElemIter.next();
+				        classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
+				        if (classNameAttr==null) {
+				            throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
TAG_LISTENER));
+				        }
+				        
+				        className = classNameAttr.getAttributeValue();
+						clazz = Class.forName(className);
+						ConfigurationManagerListener listener = (ConfigurationManagerListener) clazz
+								.newInstance();
+						listener.setAxisConfiguration(axisConfig);
+						configurationManager.addConfigurationManagerListener(listener);
+					}
+				}
+
+				//updating the ConfigurationManager with the new Axisconfiguration
+				configurationManager.setAxisConfiguration(axisConfig);
+			}
+
+			
+            // loading the ContextManager
+            OMElement contextManagerElement = clusterElement.getFirstChildWithName(
+            			new QName (TAG_CONTEXT_MANAGER));
+            if (contextManagerElement != null) {
+                classNameAttr = contextManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
+                if (classNameAttr==null) {
+                    throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
TAG_CONTEXT_MANAGER));
+                }
+                
+                className = classNameAttr.getAttributeValue();
+
+				clazz = Class.forName(className);
+				ContextManager contextManager = (ContextManager) clazz.newInstance();
+				clusterManager.setContextManager(contextManager);
+
+				OMElement listenersElement = contextManagerElement.getFirstChildWithName(new QName(
+						TAG_LISTENERS));
+				if (listenersElement != null) {
+					Iterator listenerElemIter = listenersElement.getChildrenWithName(new QName(
+							TAG_LISTENER));
+					while (listenerElemIter.hasNext()) {
+						OMElement listenerElement = (OMElement) listenerElemIter.next();
+				        classNameAttr = listenerElement.getAttribute(new QName(TAG_CLASS_NAME));
+				        if (classNameAttr==null) {
+				            throw new DeploymentException(Messages.getMessage("classAttributeNotFound",
TAG_LISTENER));
+				        }
+				        
+				        className = classNameAttr.getAttributeValue();
+						clazz = Class.forName(className);
+						System.out.println(className);
+						ContextManagerListener listener = (ContextManagerListener) clazz.newInstance();
+						contextManager.addContextManagerListener(listener);
+					}
+				}
+			}
+            
             axisConfig.setClusterManager(clusterManager);
             return;
         } catch (ClassNotFoundException e) {
             throw new DeploymentException(Messages.getMessage("clusterImplNotFound"));
         } catch (InstantiationException e) {
+        	e.printStackTrace();
             throw new DeploymentException(Messages.getMessage("cannotLoadClusterImpl"));
         } catch (IllegalAccessException e) {
             throw new DeploymentException(e);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
Mon Mar 19 03:31:58 2007
@@ -96,6 +96,11 @@
     String TAG_SUPPORTED_POLICY_NAMESPACES = "supported-policy-namespaces";
     String TAG_NAMESPACES = "namespaces";
 
+    //ClusterBuilder
+    String TAG_CONFIGURATION_MANAGER = "configurationManager";
+    String TAG_CONTEXT_MANAGER = "contextManager";
+    String TAG_LISTENERS = "listeners";
+    
     //Deployer related cons
     String DIRECTORY = "directory";
     String EXTENSION = "extension";

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties?view=diff&rev=519894&r1=519893&r2=519894
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/i18n/resource.properties
Mon Mar 19 03:31:58 2007
@@ -212,6 +212,7 @@
 cannotaddmsgctx=The system cannot add the message context again until client runs.
 clusterImplNotFound=Cluster implementation class is not found
 cannotLoadClusterImpl=Cluster implementation cannot be loaded
+classAttributeNotFound=The element {0} must have a attribute with the name ''class''
 
 #Policy
 emptypolicy=The Policy ID is either null or empty.



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


Mime
View raw message