qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhupend...@apache.org
Subject svn commit: r529246 - in /incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui: ./ actions/ sasl/ views/
Date Mon, 16 Apr 2007 13:48:32 GMT
Author: bhupendrab
Date: Mon Apr 16 06:48:31 2007
New Revision: 529246

URL: http://svn.apache.org/viewvc?view=rev&rev=529246
Log:
removed default username as guest. Added hashing for new user password field. 

Modified:
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Perspective.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
Mon Apr 16 06:48:31 2007
@@ -61,6 +61,9 @@
     public final static String OPERATION_CREATE_BINDING = "createNewBinding";
     public final static String OPERATION_MOVE_MESSAGES = "moveMessages";
     
+    public final static String OPERATION_SUCCESSFUL = "Operation successful";
+    public final static String OPERATION_UNSUCCESSFUL = "Operation unsuccessful";
+    
     public final static String ALL = "All";
     
     public final static String NAVIGATION_ROOT = "Qpid Connections";
@@ -70,7 +73,7 @@
     public final static String CONNECTION ="Connection";
     public final static String EXCHANGE = "Exchange";
     public final static String EXCHANGE_TYPE = "ExchangeType";
-    public final static String[] EXCHANGE_TYPE_VALUES = {"direct", "topic", "headers"};
+    public final static String[] EXCHANGE_TYPE_VALUES = {"direct", "fanout", "headers", "topic"};
     public final static String[] BOOLEAN_TYPE_VALUES = {"false", "true"};
     public final static String[] ATTRIBUTE_TABLE_TITLES = {"Attribute Name", "Value"};  
     public static final String[] CONNECTION_PROTOCOLS ={"RMI"};

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Perspective.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Perspective.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Perspective.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Perspective.java
Mon Apr 16 06:48:31 2007
@@ -37,8 +37,8 @@
 		layout.setEditorAreaVisible(false);
         
 		// standalone view meaning it can't be docked or stacked with other views, and it doesn't
have a title bar.        
-		layout.addStandaloneView(NavigationView.ID, true, IPageLayout.LEFT, 0.25f, editorArea);
-        layout.addStandaloneView(MBeanView.ID, true, IPageLayout.RIGHT, 0.75f, editorArea);
+		layout.addStandaloneView(NavigationView.ID, true, IPageLayout.LEFT, 0.30f, editorArea);
+        layout.addStandaloneView(MBeanView.ID, true, IPageLayout.RIGHT, 0.70f, editorArea);
 		
 		layout.getViewLayout(NavigationView.ID).setCloseable(false);
         layout.getViewLayout(MBeanView.ID).setCloseable(false);       

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/AddServer.java
Mon Apr 16 06:48:31 2007
@@ -260,7 +260,7 @@
         user.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         final Text textUser = new Text(composite, SWT.BORDER);
-        textUser.setText(DEFAULT_USERNAME);
+        textUser.setText("");
         textUser.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
         
         Label password = new Label(composite, SWT.NONE);
@@ -268,7 +268,7 @@
         password.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         final Text textPwd = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD);
-        textPwd.setText(DEFAULT_PASSWORD);
+        textPwd.setText("");
         //textPwd.setEchoChar('*');
         textPwd.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
         

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
Mon Apr 16 06:48:31 2007
@@ -191,7 +191,7 @@
         user.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         final Text textUser = new Text(composite, SWT.BORDER);
-        textUser.setText(DEFAULT_USERNAME);
+        textUser.setText("");
         textUser.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
         // Put cursor on this field
         textUser.setFocus();
@@ -201,7 +201,7 @@
         password.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         final Text textPwd = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD);
-        textPwd.setText(DEFAULT_PASSWORD);
+        textPwd.setText("");
         textPwd.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
         
         Composite buttonsComposite  = new Composite(composite, SWT.NONE);

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/sasl/UsernameHashedPasswordCallbackHandler.java
Mon Apr 16 06:48:31 2007
@@ -21,9 +21,6 @@
 package org.apache.qpid.management.ui.sasl;
 
 import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
 
 import javax.security.auth.callback.Callback;
 import javax.security.auth.callback.CallbackHandler;
@@ -31,6 +28,8 @@
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 
+import org.apache.qpid.management.ui.views.ViewUtility;
+
 public class UsernameHashedPasswordCallbackHandler implements CallbackHandler
 {
     private String user;
@@ -39,7 +38,7 @@
     public UsernameHashedPasswordCallbackHandler(String user, String password) throws Exception
     {
         this.user = user;
-        this.pwchars = getHash(password);
+        this.pwchars = ViewUtility.getHash(password);
     }
 
     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
@@ -63,29 +62,6 @@
         }
     }
 
-    private char[] getHash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
-    {
-        byte[] data = text.getBytes("utf-8");
-
-        MessageDigest md = MessageDigest.getInstance("MD5");
-
-        for (byte b : data)
-        {
-            md.update(b);
-        }
-
-        byte[] digest = md.digest();
-
-        char[] hash = new char[digest.length ];
-
-        int index = 0;
-        for (byte b : digest)
-        {            
-            hash[index++] = (char) b;
-        }
-
-        return hash;
-    }
     
     private void clearPassword()
     {

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
Mon Apr 16 06:48:31 2007
@@ -249,6 +249,8 @@
             formData.top = new FormAttachment(0, parameterPositionOffset);
             formData.left = new FormAttachment(label, 5);
             formData.right = new FormAttachment(valueWidth);
+            // this will contain the list of items, if the list is to be made available to
choose from
+            // e.g. the list of exchanges
             String[] items = null;
             if (param.getName().equals(QUEUE))
             {
@@ -300,7 +302,12 @@
             }
             else
             {
-                Text text = _toolkit.createText(_paramsComposite, "", SWT.NONE);
+                int style = SWT.NONE;
+                if (PASSWORD.equalsIgnoreCase(param.getName()))
+                {
+                    style = SWT.PASSWORD;
+                }
+                Text text = _toolkit.createText(_paramsComposite, "", style);
                 formData = new FormData();
                 formData.top = new FormAttachment(0, parameterPositionOffset);
                 formData.left = new FormAttachment(label, 5);
@@ -559,6 +566,21 @@
                         }
                         // End of custom code
                         
+                        
+                        // customized for passwords
+                        if (PASSWORD.equalsIgnoreCase(param.getName()))
+                        {
+                            try
+                            {
+                                param.setValueFromString(ViewUtility.getHashedString(param.getValue()));
+                            }
+                            catch (Exception ex)
+                            {
+                                MBeanUtility.handleException(_mbean, ex);
+                                return;
+                            }
+                        }
+                        // end of customization
                         ViewUtility.popupInfoMessage(_form.getText(),
                                 "Please select the " + ViewUtility.getDisplayText(param.getName()));
                         
@@ -620,7 +642,13 @@
         
         if (_opData.getReturnType().equals("void") || _opData.getReturnType().equals("java.lang.Void"))
         {
-            ViewUtility.popupInfoMessage(title, "Operation successful");
+            ViewUtility.popupInfoMessage(title, OPERATION_SUCCESSFUL);
+        }
+        else if (_opData.getReturnType().equals("boolean") || _opData.getReturnType().equals("java.lang.Boolean"))
+        {
+            boolean success = Boolean.parseBoolean(result.toString());
+            String message = success ? OPERATION_SUCCESSFUL : OPERATION_UNSUCCESSFUL;
+            ViewUtility.popupInfoMessage(title, message);
         }
         else if (_opData.getParameters() != null && !_opData.getParameters().isEmpty())
         {

Modified: incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java?view=diff&rev=529246&r1=529245&r2=529246
==============================================================================
--- incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
(original)
+++ incubator/qpid/branches/M2/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/ViewUtility.java
Mon Apr 16 06:48:31 2007
@@ -20,7 +20,10 @@
  */
 package org.apache.qpid.management.ui.views;
 
+import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -548,5 +551,35 @@
         {
             oldControls[i].dispose();
         }
+    }
+    
+    public static String getHashedString(Object text) throws NoSuchAlgorithmException, UnsupportedEncodingException
+    {
+        char[] chars = getHash((String)text);
+        return new String(chars);
+    }
+    
+    public static char[] getHash(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException
+    {
+        byte[] data = text.getBytes("utf-8");
+
+        MessageDigest md = MessageDigest.getInstance("MD5");
+
+        for (byte b : data)
+        {
+            md.update(b);
+        }
+
+        byte[] digest = md.digest();
+
+        char[] hash = new char[digest.length ];
+
+        int index = 0;
+        for (byte b : digest)
+        {            
+            hash[index++] = (char) b;
+        }
+
+        return hash;
     }
 }



Mime
View raw message