Author: channa
Date: Mon Dec 10 01:57:36 2007
New Revision: 10812

Log:

Added left click message showing monitored instances, changed config screen 
icon, changed messaging to reset error status the moment a non-error message is 
received, added debug statements to diagnose possible 'wrapper executable not 
found' state preventing service startup from monitor, made startup O/S 
sensitive, updated tray icon images.

Modified:
   
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ConfigScreen.java
   
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/InstanceMonitor.java
   
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/JMXClient.java
   
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ServiceMonitor.java
   trunk/commons/monitor/modules/client/src/main/resources/icons/default.GIF
   trunk/commons/monitor/modules/client/src/main/resources/icons/error.GIF
   
trunk/commons/monitor/modules/client/src/main/resources/icons/intermediate.GIF
   
trunk/commons/monitor/modules/client/src/main/resources/properties/servicemonitor.properties

Modified: 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ConfigScreen.java
==============================================================================
--- 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ConfigScreen.java
       (original)
+++ 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ConfigScreen.java
       Mon Dec 10 01:57:36 2007
@@ -43,6 +43,9 @@
         this.jmxClient = jmxClient;
         // Setup frame.
         configFrame = new 
JFrame(monitorProperties.getProperty("monitor.configmon.title"));
+        Image frameIcon = 
Toolkit.getDefaultToolkit().getImage(java.net.URLClassLoader.
+                getSystemResource(MonitorConstants.SERVER_DOWN_IMAGE));
+        configFrame.setIconImage(frameIcon);
         configFrame.setSize(410, 150);
     }
 

Modified: 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/InstanceMonitor.java
==============================================================================
--- 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/InstanceMonitor.java
    (original)
+++ 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/InstanceMonitor.java
    Mon Dec 10 01:57:36 2007
@@ -67,7 +67,7 @@
 
         // Property determines the maximum number of retries to connect.
         connectionRetries = Integer.parseInt(monitorProperties.getProperty(
-                    "monitor.connectionretries"));
+                "monitor.connectionretries"));
 
         // Setup timer to check status.
         int pollInterval = 
Integer.parseInt(monitorProperties.getProperty("monitor.pollinterval"));
@@ -187,10 +187,11 @@
                     connectMenuItem.setEnabled(false);
                     break;
                 case ERROR:
-                    startMenuItem.setEnabled(false);
+                    // If the server has an error, allow all options.
+                    startMenuItem.setEnabled(true);
                     restartMenuItem.setEnabled(true);
                     stopMenuItem.setEnabled(true);
-                    connectMenuItem.setEnabled(false);
+                    connectMenuItem.setEnabled(true);
                     break;
                 case INTERMEDIATE:
                     startMenuItem.setEnabled(false);
@@ -269,10 +270,13 @@
      * @return True if both files are available.
      */
     private boolean isServiceLocal() {
+        boolean found;
         String wrapperPath = getProperty(".bin");
         File wrapperBinary = new File(wrapperPath);
-
-        return wrapperBinary.exists();
+        log.debug("Checking for wrapper binary at:" + 
wrapperBinary.getAbsolutePath());
+        found = wrapperBinary.exists();
+        log.debug("Binary found =" + found);
+        return found;
     }
 
     /**
@@ -280,12 +284,25 @@
      */
     private void startServer() {
         log.debug("Start menu item selected!");
+
         setStatus(ServerState.INTERMEDIATE);
         try {
             Runtime runtime = Runtime.getRuntime();
             String[] command = new String[3];
             command[0] = getProperty(".bin");
-            command[1] = getProperty(".start");
+
+            // Setup the start argument based on operating system, defaulting 
to the command line.
+            String osName = System.getProperty("os.name");
+            if (osName != null) {
+                if (osName.startsWith("Windows")) {
+                    command[1] = getProperty(".startwindows");
+                } else {
+                    command[1] = getProperty(".startlinux");
+                }
+            } else {
+                command[1] = "-c";
+            }
+
             command[2] = getProperty(".conf");
             log.debug("Start command: " + java.util.Arrays.toString(command));
             runtime.exec(command);

Modified: 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/JMXClient.java
==============================================================================
--- 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/JMXClient.java
  (original)
+++ 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/JMXClient.java
  Mon Dec 10 01:57:36 2007
@@ -315,13 +315,11 @@
 
             /**
              * If an 'ERROR' level message is received from the server, set 
status to error and
-             * reset to normal once a 'NORMAL' severity is message is received.
+             * reset to normal once any other type of message is received.
              */
-            if (newMessageStatus == TrayIcon.ERROR_MESSAGE_TYPE && 
oldMessageStatus !=
-                    TrayIcon.ERROR_MESSAGE_TYPE) {
+            if (newMessageStatus == TrayIcon.ERROR_MESSAGE_TYPE) {
                 serverErrorFree = false;
-            } else if (newMessageStatus == TrayIcon.NONE_MESSAGE_TYPE && 
oldMessageStatus ==
-                    TrayIcon.ERROR_MESSAGE_TYPE) {
+            } else {
                 serverErrorFree = true;
             }
 

Modified: 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ServiceMonitor.java
==============================================================================
--- 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ServiceMonitor.java
     (original)
+++ 
trunk/commons/monitor/modules/client/src/main/java/org/wso2/monitor/ServiceMonitor.java
     Mon Dec 10 01:57:36 2007
@@ -180,6 +180,15 @@
         String iconText = serviceName + " - " + state.toString();
         trayIcon = new TrayIcon(i, iconText, monitorMenu);
         trayIcon.setIconAutoSize(true);
+
+        // Add a listener to respond to clicks - show the instances being 
monitored.
+        trayIcon.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                String title = 
monitorProperties.getProperty("monitor.configmon.instances");
+                String instances = 
java.util.Arrays.toString(monitoredInstances.keySet().toArray());
+                trayIcon.displayMessage(title, instances, 
TrayIcon.NONE_MESSAGE_TYPE);
+            }
+        });
         defaultTray.addTrayIcon(trayIcon);
     }
 

Modified: 
trunk/commons/monitor/modules/client/src/main/resources/icons/default.GIF
==============================================================================
Binary files. No diff available.

Modified: 
trunk/commons/monitor/modules/client/src/main/resources/icons/error.GIF
==============================================================================
Binary files. No diff available.

Modified: 
trunk/commons/monitor/modules/client/src/main/resources/icons/intermediate.GIF
==============================================================================
Binary files. No diff available.

Modified: 
trunk/commons/monitor/modules/client/src/main/resources/properties/servicemonitor.properties
==============================================================================
--- 
trunk/commons/monitor/modules/client/src/main/resources/properties/servicemonitor.properties
        (original)
+++ 
trunk/commons/monitor/modules/client/src/main/resources/properties/servicemonitor.properties
        Mon Dec 10 01:57:36 2007
@@ -9,6 +9,7 @@
 monitor.options.messages=Messages
 monitor.options.admin=Admininstration
 # Monitor Config Screen text
+monitor.configmon.instances=Instances Monitored
 monitor.configmon.title=Configure Monitor
 monitor.configmon.serviceurl=Service URL
 monitor.configmon.mbeanname=MBean Name
@@ -29,7 +30,8 @@
 # Local server and configuration locations
 monitor.service.0.bin=..\\bin\\native\\wrapper-windows-x86-32.exe
 monitor.service.0.conf=..\\..\\conf\\wrapper.conf
-monitor.service.0.start=-t
+monitor.service.0.startwindows=-t
+monitor.service.0.startlinux=-c
 #-----Connection configuration-----------------------#
 monitor.service.0.name=Mashup Server
 monitor.service.0.url=service:jmx:rmi:///jndi/rmi://localhost:9995/jmxrmi

_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

Reply via email to