You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by bh...@apache.org on 2007/04/24 15:03:56 UTC

svn commit: r531917 - in /incubator/qpid/branches/M2/java/management/eclipse-plugin: ./ src/main/java/org/apache/qpid/management/ui/ src/main/java/org/apache/qpid/management/ui/actions/ src/main/java/org/apache/qpid/management/ui/jmx/ src/main/java/org...

Author: bhupendrab
Date: Tue Apr 24 06:03:55 2007
New Revision: 531917

URL: http://svn.apache.org/viewvc?view=rev&rev=531917
Log:
Added display of build and release versions in Help->About

Added:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java   (with props)
Modified:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/plugin.xml
    incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/plugin.xml?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/plugin.xml (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/plugin.xml Tue Apr 24 06:03:55 2007
@@ -96,6 +96,11 @@
             description="pops up the window for editing selected attribute"
             id="org.apache.qpid.management.ui.actions.cmd_editAttribute"
             name="Edit Attribute"/>
+      <command
+            categoryId="org.apache.qpid.management.ui.category"
+            description="About Qpid Management Console"
+            id="qpidmc.about"
+            name="About"/>
    </extension>
    <extension
          point="org.eclipse.ui.bindings">
@@ -139,16 +144,12 @@
             application="org.apache.qpid.management.ui.application"
             name="Qpid Management Console">
          <property
-               name="about Qpid Management Console"
-               value="version 0.1.0">
-         </property>
-         <property
                name="windowImages"
                value="icons/qpidmc16.gif,icons/qpidmc32.gif">
          </property>
          <property
                name="aboutText"
-               value="Qpid Management Console&#x0A;version 0.1.0"/>
+               value="Qpid Management Console"/>
       </product>
    </extension>
    <extension

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml Tue Apr 24 06:03:55 2007
@@ -207,6 +207,10 @@
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
                 <configuration>
                   <archive>

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/ApplicationActionBarAdvisor.java Tue Apr 24 06:03:55 2007
@@ -20,6 +20,8 @@
  */
 package org.apache.qpid.management.ui;
 
+import org.apache.qpid.management.ui.actions.VersionAction;
+import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.GroupMarker;
 import org.eclipse.jface.action.ICoolBarManager;
 import org.eclipse.jface.action.IMenuManager;
@@ -44,8 +46,7 @@
     // in the fill methods.  This ensures that the actions aren't recreated
     // when fillActionBars is called with FILL_PROXY.
     private IWorkbenchAction exitAction;
-    private IWorkbenchAction aboutAction;
-    
+    private Action _aboutAction;
 
     public ApplicationActionBarAdvisor(IActionBarConfigurer configurer)
     {
@@ -63,8 +64,8 @@
         exitAction = ActionFactory.QUIT.create(window);
         register(exitAction);
         
-        aboutAction = ActionFactory.ABOUT.create(window);
-        register(aboutAction);
+        _aboutAction = new VersionAction(window);
+        register(_aboutAction);
     }
     
     
@@ -85,8 +86,7 @@
         fileMenu.add(exitAction);
         
         // Help
-        //aboutAction.setText("about Qpid Management Console");
-        helpMenu.add(aboutAction);        
+        helpMenu.add(_aboutAction);
     }
     
     protected void fillCoolBar(ICoolBarManager coolBar)

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AbstractAction.java Tue Apr 24 06:03:55 2007
@@ -1,3 +1,23 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.management.ui.actions;
 
 import static org.apache.qpid.management.ui.Constants.ERROR_SERVER_CONNECTION;
@@ -30,7 +50,7 @@
         }
     }
     
-    protected void handleException(Exception ex, String title, String msg)
+    protected void handleException(Throwable ex, String title, String msg)
     {
         MBeanUtility.printStackTrace(ex);
         if (msg == null)

Added: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java?view=auto&rev=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java (added)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java Tue Apr 24 06:03:55 2007
@@ -0,0 +1,89 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.management.ui.actions;
+
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.qpid.management.ui.Constants;
+import org.apache.qpid.management.ui.jmx.MBeanUtility;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+
+public class VersionAction extends Action
+{        
+    private IWorkbenchWindow _window;
+    public static final String VERSION_RESOURCE = "qpidversion.properties";
+
+    public static final String PRODUCT_NAME_PROPERTY = "qpid.name";
+    public static final String RELEASE_VERSION_PROPERTY = "qpid.version";
+    public static final String BUILD_VERSION_PROPERTY = "qpid.svnversion";
+    
+    private static final String DEFAULT = "unknown";
+    private static String _releaseVersion;
+    private static String _buildVersion;
+    private static String _text;
+    
+    static
+    {
+        Properties props = new Properties();
+        try
+        {
+            InputStream propertyStream = VersionAction.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE);
+            if (propertyStream != null)           
+            {
+                props.load(propertyStream);
+                _releaseVersion = readPropertyValue(props, RELEASE_VERSION_PROPERTY);
+                _buildVersion = readPropertyValue(props, BUILD_VERSION_PROPERTY); 
+                _text = "Build Version : " + _buildVersion + "\n" +
+                        "Release Version : " + _releaseVersion;
+            }
+        }
+        catch (Exception ex)
+        {
+            MBeanUtility.printStackTrace(ex);
+        }
+    }
+    
+    public VersionAction(IWorkbenchWindow window)
+    {
+        _window = window;
+        setText("About " + Constants.APPLICATION_NAME);
+        setId("qpidmc.about");
+        setActionDefinitionId("qpidmc.about");
+    }
+    
+    private static String readPropertyValue(Properties props, String propertyName)
+    {
+        String retVal = (String) props.get(propertyName);
+        if (retVal == null)
+        {
+            retVal = DEFAULT;
+        }
+        return retVal;
+    }
+    
+    public void run()
+    {
+        MessageDialog.openInformation(_window.getShell(), Constants.APPLICATION_NAME, _text);
+    }
+}

Propchange: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/VersionAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/JMXServerRegistry.java Tue Apr 24 06:03:55 2007
@@ -97,58 +97,49 @@
         String securityMechanism = ApplicationRegistry.getSecurityMechanism();
        
         if (securityMechanism != null)
-        {                                
-            try
+        {    
+            // Check if the JMXMP connector is available
+            Class klass = Class.forName("javax.management.remote.jmxmp.JMXMPConnector");
+
+            jmxUrl = new JMXServiceURL("jmxmp", server.getHost(), server.getPort());
+            env = new HashMap<String, Object>();
+
+            if (MECH_CRAMMD5.equals(securityMechanism))
             {
-                // Check if the JMXMP connector is available
-                Class klass = Class.forName("javax.management.remote.jmxmp.JMXMPConnector");
-                
-                jmxUrl = new JMXServiceURL("jmxmp", server.getHost(), server.getPort());
-                env = new HashMap<String, Object>();
-                
-                if (MECH_CRAMMD5.equals(securityMechanism))
-                {
-                    // For SASL/CRAM-MD5
-                    Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>();
-                    Class<?> clazz = Class.forName("org.apache.qpid.management.ui.sasl.CRAMMD5HashedSaslClientFactory");
-                    map.put("CRAM-MD5-HASHED", (Class<? extends SaslClientFactory>) clazz);
-                    
-                    Security.addProvider(new JCAProvider(map));
-                    env.put("jmx.remote.profiles", SASL_CRAMMD5); 
-                    env.put("jmx.remote.sasl.callback.handler",
-                            new UsernameHashedPasswordCallbackHandler(server.getUser(), server.getPassword()));
-                }
-                else if (MECH_PLAIN.equals(securityMechanism))
-                {
-                    // For SASL/PLAIN
-                    Security.addProvider(new SaslProvider());
-                    env.put("jmx.remote.profiles", SASL_PLAIN);
-                    env.put("jmx.remote.sasl.callback.handler",
-                            new UserPasswordCallbackHandler(server.getUser(), server.getPassword())); 
-                }
-                else
-                {
-                    MBeanUtility.printOutput("Security mechanism " + securityMechanism + " is not supported.");
-                }
-                
-                // Now create the instance of JMXMPConnector                                               
-                Class[] paramTypes = {JMXServiceURL.class, Map.class};                           
-                Constructor cons = klass.getConstructor(paramTypes);
-                
-                Object[] args = {jmxUrl, env};           
-                Object theObject = cons.newInstance(args);
-                
-                _jmxc = (JMXConnector)theObject;
-                _jmxc.connect();
-                MBeanUtility.printOutput("Starting JMXConnector with SASL. Server=" + server.getName());
+                // For SASL/CRAM-MD5
+                Map<String, Class<? extends SaslClientFactory>> map = new HashMap<String, Class<? extends SaslClientFactory>>();
+                Class<?> clazz = Class.forName("org.apache.qpid.management.ui.sasl.CRAMMD5HashedSaslClientFactory");
+                map.put("CRAM-MD5-HASHED", (Class<? extends SaslClientFactory>) clazz);
+
+                Security.addProvider(new JCAProvider(map));
+                env.put("jmx.remote.profiles", SASL_CRAMMD5); 
+                env.put("jmx.remote.sasl.callback.handler",
+                        new UsernameHashedPasswordCallbackHandler(server.getUser(), server.getPassword()));
             }
-            catch (Exception ex)
+            else if (MECH_PLAIN.equals(securityMechanism))
             {
-                // When JMXMPConnector is not available
-                MBeanUtility.printOutput("Starting JMXConnector. Server=" + server.getName());                
-                jmxUrl = new JMXServiceURL(server.getUrl());
-                _jmxc = JMXConnectorFactory.connect(jmxUrl, null);
+                // For SASL/PLAIN
+                Security.addProvider(new SaslProvider());
+                env.put("jmx.remote.profiles", SASL_PLAIN);
+                env.put("jmx.remote.sasl.callback.handler",
+                        new UserPasswordCallbackHandler(server.getUser(), server.getPassword())); 
             }
+            else
+            {
+                String text = "Security mechanism " + securityMechanism + " is not supported.";
+                MBeanUtility.printOutput(text);
+                throw new Exception(text);
+            }
+            // Now create the instance of JMXMPConnector                                               
+            Class[] paramTypes = {JMXServiceURL.class, Map.class};                           
+            Constructor cons = klass.getConstructor(paramTypes);
+
+            Object[] args = {jmxUrl, env};           
+            Object theObject = cons.newInstance(args);
+
+            _jmxc = (JMXConnector)theObject;
+            _jmxc.connect();
+            MBeanUtility.printOutput("Starting JMXConnector with SASL. Server=" + server.getName());
         }
         else
         {

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?view=diff&rev=531917&r1=531916&r2=531917
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java (original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java Tue Apr 24 06:03:55 2007
@@ -216,6 +216,10 @@
         }
         catch (IOException ex)
         {
+            if (ex.getCause() == null)
+            {
+                throw ex;
+            }
             throw (Exception)ex.getCause();
         }
     }