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 az...@apache.org on 2007/04/06 13:37:46 UTC

svn commit: r526125 - in /webservices/axis2/trunk/java/modules: clustering/src/org/apache/axis2/cluster/tribes/util/ clustering/test/org/apache/axis2/clustering/configuration/ kernel/src/org/apache/axis2/deployment/

Author: azeez
Date: Fri Apr  6 04:37:45 2007
New Revision: 526125

URL: http://svn.apache.org/viewvc?view=rev&rev=526125
Log:
Populating the config manager & context manager parameters
Fixing test compilation errors


Modified:
    webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/util/TribesUtil.java
    webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/configuration/ConfigurationManagerTestCase.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java

Modified: webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/util/TribesUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/util/TribesUtil.java?view=diff&rev=526125&r1=526124&r2=526125
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/util/TribesUtil.java (original)
+++ webservices/axis2/trunk/java/modules/clustering/src/org/apache/axis2/cluster/tribes/util/TribesUtil.java Fri Apr  6 04:37:45 2007
@@ -17,30 +17,34 @@
 package org.apache.axis2.cluster.tribes.util;
 
 import org.apache.catalina.tribes.Member;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 public class TribesUtil {
 
-	public static void printMembers(Member[] members) {
-		
-		System.out.println("*****************PRINTING MEMBERS OF THE CURRENT TRIBES GROUP****************");
-
-		if (members != null) {
-			int length = members.length;
-			for (int i = 0; i < length; i++) {
-				byte[] hostBts = members[i].getHost();
-				String HOST = null;
-				if (hostBts != null) {
-					for (int j = 0; j < hostBts.length; j++) {
-						HOST = HOST == null ? ("" + hostBts[j]) : (HOST + "." + hostBts[j]);
-					}
-				}
-
-				String port = "" + members[i].getPort();
-				System.out.println("Member " + (i + 1) + " NAME:" + members[i].getName() + " HOST:"
-						+ HOST + "  PORT:" + port);
-
-			}
-		}
-	}
+    private static Log log = LogFactory.getLog(TribesUtil.class);
+
+    public static void printMembers(Member[] members) {
+
+        log.info("MEMBERS OF THE CURRENT TRIBES GROUP...");
+
+        if (members != null) {
+            int length = members.length;
+            for (int i = 0; i < length; i++) {
+                byte[] hostBts = members[i].getHost();
+                String host = null;
+                if (hostBts != null) {
+                    for (int j = 0; j < hostBts.length; j++) {
+                        host = host == null ? ("" + hostBts[j]) : (host + "." + hostBts[j]);
+                    }
+                }
+
+                String port = "" + members[i].getPort();
+                log.info("Member " + (i + 1) + " NAME:" + members[i].getName() + " HOST:"
+                         + host + "  PORT:" + port);
+
+            }
+        }
+    }
 
 }

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=526125&r1=526124&r2=526125
==============================================================================
--- 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 Fri Apr  6 04:37:45 2007
@@ -34,7 +34,7 @@
        	configurationManagerListener2.clearEventList();
        	
     	String serviceGroupName = "testService";
-    	clusterManager1.getConfigurationManager().loadServiceGroup(serviceGroupName);
+    	clusterManager1.getConfigurationManager().loadServiceGroups(new String[]{serviceGroupName});
     	
     	try {
 			Thread.sleep(3000);
@@ -56,7 +56,7 @@
     	configurationManagerListener2.clearEventList();
     	
     	String serviceGroupName = "testService";
-    	clusterManager1.getConfigurationManager().unloadServiceGroup (serviceGroupName);
+    	clusterManager1.getConfigurationManager().unloadServiceGroups(new String[]{serviceGroupName});
     	
     	try {
 			Thread.sleep(3000);

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=526125&r1=526124&r2=526125
==============================================================================
--- 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 Fri Apr  6 04:37:45 2007
@@ -54,103 +54,112 @@
             throws DeploymentException {
 
         OMAttribute classNameAttr = clusterElement.getAttribute(new QName(TAG_CLASS_NAME));
-        if (classNameAttr==null) {
+        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 parameters.
             Iterator params = clusterElement.getChildrenWithName(new QName(TAG_PARAMETER));
-            processParameters(params, clusterManager,null );
-            
+            processParameters(params, clusterManager, null);
+
             //loading the ConfigurationManager
             OMElement configurationManagerElement = clusterElement.getFirstChildWithName(
-            			new QName (TAG_CONFIGURATION_MANAGER));
+                    new QName(TAG_CONFIGURATION_MANAGER));
             if (configurationManagerElement != null) {
                 classNameAttr = configurationManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
-                if (classNameAttr==null) {
+                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.setConfigurationContext(configCtx);
-						configurationManager.addConfigurationManagerListener(listener);
-					}
-				}
-
-				//updating the ConfigurationManager with the new ConfigurationContext
-				configurationManager.setConfigurationContext(configCtx);
-			}
+                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.setConfigurationContext(configCtx);
+                        configurationManager.addConfigurationManagerListener(listener);
+                    }
+                }
+
+                //updating the ConfigurationManager with the new ConfigurationContext
+                configurationManager.setConfigurationContext(configCtx);
+
+                //loading the parameters.
+                processParameters(configurationManagerElement.getChildrenWithName(new QName(TAG_PARAMETER)),
+                                  configurationManager,
+                                  null);
+            }
 
-			
             // loading the ContextManager
             OMElement contextManagerElement = clusterElement.getFirstChildWithName(
-            			new QName (TAG_CONTEXT_MANAGER));
+                    new QName(TAG_CONTEXT_MANAGER));
             if (contextManagerElement != null) {
                 classNameAttr = contextManagerElement.getAttribute(new QName(TAG_CLASS_NAME));
-                if (classNameAttr==null) {
+                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);
-					}
-				}
-			}
-            
+                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);
+                    }
+                }
+
+                //loading the parameters.
+                processParameters(contextManagerElement.getChildrenWithName(new QName(TAG_PARAMETER)),
+                                  contextManager,
+                                  null);
+            }
+
             axisConfig.setClusterManager(clusterManager);
         } catch (ClassNotFoundException e) {
             throw new DeploymentException(Messages.getMessage("clusterImplNotFound"));
         } catch (InstantiationException e) {
-        	e.printStackTrace();
+            e.printStackTrace();
             throw new DeploymentException(Messages.getMessage("cannotLoadClusterImpl"));
         } catch (IllegalAccessException e) {
             throw new DeploymentException(e);



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