Author: azeez
Date: Tue Jan  8 05:11:09 2008
New Revision: 11984

Log:

Added few more JMX methods



Modified:
   trunk/wsas/java/README
   
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java
   
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
   trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerStatus.java

Modified: trunk/wsas/java/README
==============================================================================
--- trunk/wsas/java/README      (original)
+++ trunk/wsas/java/README      Tue Jan  8 05:11:09 2008
@@ -178,8 +178,7 @@
 message.
 
 8. Cannot connect to JMX service using a JMX client tool such as jconsole from 
a remote machine
-when the server is running on Linux. This is due to
-http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6209663.
+when the server is running on Linux. See 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6209663.
 To rectify this, you should edit the /etc/hosts file on the server machine and 
set the correct IP
 address. 
 

Modified: 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java
==============================================================================
--- 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java 
    (original)
+++ 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdmin.java 
    Tue Jan  8 05:11:09 2008
@@ -26,6 +26,7 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
@@ -45,7 +46,6 @@
 import org.wso2.utils.ArchiveManipulator;
 import org.wso2.utils.FileManipulator;
 import org.wso2.utils.MBeanRegistrar;
-import org.wso2.utils.ServerConfiguration;
 import org.wso2.wsas.ServerConstants;
 import org.wso2.wsas.admin.service.spring.GenericApplicationContextSupplier;
 import org.wso2.wsas.admin.service.util.ClassMethodsData;
@@ -115,7 +115,7 @@
             "Cannot remove transport binding. " +
             "<br/>A service must contain at least one transport binding!";
     private PersistenceManager pm = new PersistenceManager();
-    
+
     static {
         MBeanRegistrar.registerMBean(new ServiceAdmin());
     }
@@ -310,6 +310,62 @@
         }
     }
 
+   /* public String[] getActiveEndPoints() {
+        List endpoints = new ArrayList();
+        for (Iterator iter = 
getAxisConfig().getServices().values().iterator(); iter.hasNext();) {
+            AxisService service = (AxisService) iter.next();
+            if (service.isActive()) {
+                *//* String[] eprs;
+                try {
+                    eprs = service.getEPRs();
+                } catch (AxisFault e) {
+                    throw new RuntimeException("Cannot get service EPRs", e);
+                }
+                for (int i = 0; i < eprs.length; i++) {
+                    String epr = eprs[i];
+                    if (!endpoints.contains(epr)) {
+                        endpoints.add(epr);
+                    }
+                }*//*
+
+                for (Iterator endpointIter = 
service.getEndpoints().values().iterator();
+                     endpointIter.hasNext();) {
+                    AxisEndpoint axisEndpoint = (AxisEndpoint) 
endpointIter.next();
+                    String binding = 
axisEndpoint.getBinding().getName().toString();
+                    String epr = axisEndpoint.getEndpointURL();
+
+                    endpoints.add(epr + " [" + binding + "]");
+
+                }
+            }
+        }
+        return (String[]) endpoints.toArray(new String[endpoints.size()]);
+    }
+*/
+    public int getNumberOfActiveServices() throws Exception {
+        int activeServices = 0;
+        HashMap services = getAxisConfig().getServices();
+        for (Iterator iterator = services.values().iterator(); 
iterator.hasNext();) {
+            AxisService service = (AxisService) iterator.next();
+            if (service.isActive()) {
+                activeServices++;
+            }
+        }
+        return activeServices;
+    }
+
+    public int getNumberOfInactiveServices() throws Exception {
+        int inactiveServices = 0;
+        HashMap services = getAxisConfig().getServices();
+        for (Iterator iterator = services.values().iterator(); 
iterator.hasNext();) {
+            AxisService service = (AxisService) iterator.next();
+            if (!service.isActive()) {
+                inactiveServices++;
+            }
+        }
+        return inactiveServices;
+    }
+
     public void startService(String serviceName) throws Exception {
         AxisService axisService = 
getAxisConfig().getServiceForActivation(serviceName);
 

Modified: 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
==============================================================================
--- 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
        (original)
+++ 
trunk/wsas/java/modules/admin/src/org/wso2/wsas/admin/service/ServiceAdminMBean.java
        Tue Jan  8 05:11:09 2008
@@ -21,6 +21,22 @@
 public interface ServiceAdminMBean {
 
     /**
+     * Get the currently active number of services
+     *
+     * @return Currently active number of services
+     * @throws Exception If an error occurs while getting the service count
+     */
+    int getNumberOfActiveServices() throws Exception;
+
+    /**
+     * Get the currently inactive number of services
+     *
+     * @return Currently inactive number of services
+     * @throws Exception If an error occurs while getting the service count
+     */
+    public int getNumberOfInactiveServices() throws Exception;
+
+    /**
      * Get the number of faulty services
      *
      * @return number of faulty services
@@ -44,4 +60,10 @@
      */
     void stopService(String serviceName) throws Exception;
 
+    /**
+     * Get all active service endpoints
+     * @return All active service endpoints
+     */
+//    String[] getActiveEndPoints();
+
 }

Modified: trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerStatus.java
==============================================================================
--- trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerStatus.java    
(original)
+++ trunk/wsas/java/modules/core/src/org/wso2/wsas/ServerStatus.java    Tue Jan 
 8 05:11:09 2008
@@ -47,8 +47,7 @@
     /**
      * The current status of this WSAS instance
      */
-    private static final String CURRENT_SERVER_STATUS = 
"current.server.status";
-//    private static final String CURRENT_SERVER_STATUS = 
"local_current.server.status";
+    private static final String CURRENT_SERVER_STATUS = 
"local_current.server.status";
 
     private ServerStatus() {
     }

_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to