qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r733073 [2/4] - in /qpid/trunk/qpid/java/management/tools/qpid-cli: src/org/apache/qpid/ src/org/apache/qpid/commands/ src/org/apache/qpid/commands/objects/ src/org/apache/qpid/utils/ test/org/apache/qpid/ test/org/apache/qpid/commands/ tes...
Date Fri, 09 Jan 2009 16:24:03 GMT
Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java Fri Jan  9 08:24:01 2009
@@ -18,58 +18,37 @@
  * under the License.
  *
  */
- /*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.commands;
 
-import org.apache.qpid.commands.objects.ObjectNames;
-import org.apache.qpid.commands.objects.QueueObject;
-import org.apache.qpid.utils.JMXinfo;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.openmbean.*;
-import java.util.*;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.awt.font.OpenType;
-
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Aug 8, 2008
- * Time: 11:33:05 PM
- * To change this template use File | Settings | File Templates.
- */
-public class Commandview extends CommandImpl {
-    
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularDataSupport;
+
+import org.apache.qpid.commands.objects.QueueObject;
+import org.apache.qpid.utils.JMXinfo;
+
+public class Commandview extends CommandImpl
+{
+
     public static final String COMMAND_NAME = "view";
-    
+
     private int number = 0;
     private QueueObject objname;
     private MBeanServerConnection mbsc;
     private String method1;
     private ObjectName queue;
 
-    public Commandview(JMXinfo info) {
+    public Commandview(JMXinfo info)
+    {
         super(info);
         this.mbsc = info.getmbserverconnector();
         this.objname = new QueueObject(mbsc);
@@ -77,54 +56,62 @@
 
     }
 
-    public void viewmessages() {
+    public void viewmessages()
+    {
         Set set = null;
-        Object temp[] = {null};
+        Object temp[] = { null };
         objname.setQueryString(this.getObject(), this.getName(), this.getVirtualhost());
         set = objname.returnObjects();
         String header = "", temp_header = "", message_data = "", outline = "";
 
-
-        if (objname.getSet().size() != 0) {
+        if (objname.getSet().size() != 0)
+        {
             Iterator it = set.iterator();
             this.queue = (ObjectName) it.next();
-            try {
-                if (objname.getmessagecount(this.queue) == 0) {
+            try
+            {
+                if (objname.getmessagecount(this.queue) == 0)
+                {
                     echo("Selected Queue doesn't contain any messages");
                     return;
                 }
                 if (this.number == 0)
                     this.number = objname.getmessagecount(this.queue);
 
-
-                if (objname.getmessagecount(this.queue) < this.number) {
+                if (objname.getmessagecount(this.queue) < this.number)
+                {
                     echo("Given number is Greater than the Queue Depth");
                     return;
-                } else {
-                    Object[] params = {1, this.number};
-                    String[] signature = {new String("int"), new String("int")};
-                    TabularDataSupport data = (TabularDataSupport) this.mbsc.invoke(queue, this.method1, params, signature);
+                }
+                else
+                {
+                    Object[] params = { 1, this.number };
+                    String[] signature = { new String("int"), new String("int") };
+                    TabularDataSupport data = (TabularDataSupport) this.mbsc.invoke(queue, this.method1, params,
+                            signature);
 
                     Set entrySet = data.entrySet();
                     ArrayList<Map.Entry> list = new ArrayList<Map.Entry>(entrySet);
-                    if (list.size() != 0) {// no data}
-                        for (int i = 0; i < list.size(); i++) {
-                            CompositeData compositedata =
-                                    (CompositeData) (list.get(i)).getValue();
-                            List<String> itemNames = new
-                                    ArrayList<String>(compositedata.getCompositeType().keySet());
+                    if (list.size() != 0)
+                    {// no data}
+                        for (int i = 0; i < list.size(); i++)
+                        {
+                            CompositeData compositedata = (CompositeData) (list.get(i)).getValue();
+                            List<String> itemNames = new ArrayList<String>(compositedata.getCompositeType().keySet());
                             if (i == 0) // display the table headers
                             {
-                                for (int j = 0; j < itemNames.size(); j++) {
+                                for (int j = 0; j < itemNames.size(); j++)
+                                {
                                     temp_header = "";
-                                    if (j != 1)                                //skipping header information
+                                    if (j != 1) // skipping header information
                                     {
                                         temp_header = itemNames.get(j);
                                         while (temp_header.length() < 15)
                                             temp_header = " " + temp_header;
 
                                         header = header + temp_header + "|";
-                                    } else
+                                    }
+                                    else
                                         continue;
                                 }
                                 echo(header);
@@ -133,71 +120,93 @@
                                 echo(outline);
                             }
 
-                            for (int j = 0; j < itemNames.size(); j++) {
+                            for (int j = 0; j < itemNames.size(); j++)
+                            {
                                 temp_header = "";
-                                if (j != 1) {
+                                if (j != 1)
+                                {
                                     temp_header = String.valueOf(compositedata.get(itemNames.get(j)));
                                     while (temp_header.length() < 15)
                                         temp_header = " " + temp_header;
                                     message_data = message_data + temp_header + "|";
-                                } else        // header information is not displaying unless user specify header information is needed
+                                }
+                                else
+                                    // header information is not displaying
+                                    // unless user specify header information is
+                                    // needed
                                     continue;
 
-
                             }
                             echo(message_data);
                             header = "";
                             message_data = "";
                         }
-                    } else {
+                    }
+                    else
+                    {
                         System.out.println("No Data to Display");
                     }
                 }
-            } catch (Exception ex) {
+            }
+            catch (Exception ex)
+            {
                 ex.printStackTrace();
             }
 
-        } else {
-            if (hasName()) {
+        }
+        else
+        {
+            if (hasName())
+            {
 
                 echo("The Queue you have specified is not in the current broker");
                 echo("");
-            } else {
+            }
+            else
+            {
                 printusage();
             }
         }
     }
 
-    public void execute() {
-        /* In here you it's easy to handle any number of otpions which are going to add with the list command which works
-        with main option object or o
+    public void execute()
+    {
+        /*
+         * In here you it's easy to handle any number of otpions which are going
+         * to add with the list command which works with main option object or o
          */
 
-        if (checkoptionsetting("object") || checkoptionsetting("o")) {
+        if (checkoptionsetting("object") || checkoptionsetting("o"))
+        {
             String object = optionchecker("object");
-            if (object == null) {
+            if (object == null)
+            {
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
                 setObject(object);
-            else {
+            else
+            {
                 unrecognizeoption();
                 echo("This command is only applicable for delete command so please start with queue");
             }
-            if (checkoptionsetting("name") || checkoptionsetting("n")) {
+            if (checkoptionsetting("name") || checkoptionsetting("n"))
+            {
                 String name = optionchecker("name");
                 if (name == null)
                     name = optionchecker("n");
 
                 setName(name);
             }
-            if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
+            if (checkoptionsetting("virtualhost") || checkoptionsetting("v"))
+            {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
                 setVirtualhost(vhost);
             }
-            if (checkoptionsetting("top") || checkoptionsetting("t")) {
+            if (checkoptionsetting("top") || checkoptionsetting("t"))
+            {
                 String number = optionchecker("top");
                 if (number == null)
                     number = optionchecker("t");
@@ -205,13 +214,15 @@
                 setnumber(removeSpaces(number));
             }
             this.viewmessages();
-        } else if (checkoptionsetting("h") || checkoptionsetting("help"))
+        }
+        else if (checkoptionsetting("h") || checkoptionsetting("help"))
             printusage();
         else
             unrecognizeoption();
     }
 
-    public void printusage() {
+    public void printusage()
+    {
         echo("");
         echo("Usage:view [OPTION] ... [OBJECT TYPE]...\n");
         echo("view the information about given number of messages from the given queue object\n");
@@ -224,15 +235,18 @@
 
     }
 
-    private void setnumber(String number) {
+    private void setnumber(String number)
+    {
         Integer i = new Integer(number);
         this.number = i.intValue();
     }
 
-    private static String removeSpaces(String s) {
+    private static String removeSpaces(String s)
+    {
         StringTokenizer st = new StringTokenizer(s, " ", false);
         String t = "";
-        while (st.hasMoreElements()) t += st.nextElement();
+        while (st.hasMoreElements())
+            t += st.nextElement();
         return t;
     }
 

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java Fri Jan  9 08:24:01 2009
@@ -18,47 +18,27 @@
  * under the License.
  *
  */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.commands;
 
-import org.apache.qpid.commands.objects.QueueObject;
-import org.apache.qpid.utils.JMXinfo;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
-import javax.management.openmbean.TabularData;
 import javax.management.openmbean.CompositeData;
-import java.util.*;
-import java.nio.charset.Charset;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Aug 10, 2008
- * Time: 12:19:16 PM
- * To change this template use File | Settings | File Templates.
- */
-public class Commandviewcontent extends CommandImpl {
+import org.apache.qpid.commands.objects.QueueObject;
+import org.apache.qpid.utils.JMXinfo;
+
+public class Commandviewcontent extends CommandImpl
+{
 
     public static final String COMMAND_NAME = "viewcontent";
-    
+
     private String object;
     private String name;
     private String vhost;
@@ -68,40 +48,47 @@
     private String method1;
     private ObjectName queue;
 
-    public Commandviewcontent(JMXinfo info) {
+    public Commandviewcontent(JMXinfo info)
+    {
         super(info);
         this.mbsc = info.getmbserverconnector();
         this.objname = new QueueObject(mbsc);
         this.method1 = "viewMessageContent";
 
     }
-    
-    public void viewcontent() {
+
+    public void viewcontent()
+    {
         Set set = null;
-        Object temp[] = {null};
+        Object temp[] = { null };
         objname.setQueryString(this.object, this.name, this.vhost);
         set = objname.returnObjects();
         String temp_header = "", header = "", message_data = "", encoding = null;
 
-        if (objname.getSet().size() != 0) {
+        if (objname.getSet().size() != 0)
+        {
             Iterator it = set.iterator();
             this.queue = (ObjectName) it.next();
-            try {
-                if (objname.getmessagecount(this.queue) == 0) {
+            try
+            {
+                if (objname.getmessagecount(this.queue) == 0)
+                {
                     echo("Selected Queue doesn't contain any messages");
                     return;
                 }
-                if (this.number == 0) {
+                if (this.number == 0)
+                {
                     echo("You haven't selected a MessageId Please use -id and give a message id");
                     echo("Or run view command with same arguemnts to view messageId list for the queue");
                 }
-                else {
-                    Object[] params = {this.number};
-                    String[] signature = {new String("long")};
+                else
+                {
+                    Object[] params = { this.number };
+                    String[] signature = { new String("long") };
                     CompositeData data = (CompositeData) this.mbsc.invoke(queue, this.method1, params, signature);
-                    List<String> itemNames = new
-                            ArrayList<String>(data.getCompositeType().keySet());
-                    for (int j = 0; j < itemNames.size(); j++) {
+                    List<String> itemNames = new ArrayList<String>(data.getCompositeType().keySet());
+                    for (int j = 0; j < itemNames.size(); j++)
+                    {
                         temp_header = "";
                         temp_header = itemNames.get(j);
                         while (temp_header.length() < 15)
@@ -110,21 +97,39 @@
                         header = header + temp_header + "|";
                     }
                     echo(header);
-                    encoding = String.valueOf(data.get(itemNames.get(2)));   // set the encoding at the beginning because encoding comes later in the loop
-                    if (encoding == null || encoding.length() == 0) {
+                    encoding = String.valueOf(data.get(itemNames.get(2))); // set
+                                                                           // the
+                                                                           // encoding
+                                                                           // at
+                                                                           // the
+                                                                           // beginning
+                                                                           // because
+                                                                           // encoding
+                                                                           // comes
+                                                                           // later
+                                                                           // in
+                                                                           // the
+                                                                           // loop
+                    if (encoding == null || encoding.length() == 0)
+                    {
                         encoding = Charset.defaultCharset().name();
 
                     }
-                    for (int j = 0; j < itemNames.size(); j++) {
+                    for (int j = 0; j < itemNames.size(); j++)
+                    {
                         temp_header = "";
-                        if (j != 1) {
+                        if (j != 1)
+                        {
                             temp_header = String.valueOf(data.get(itemNames.get(j)));
                             while (temp_header.length() < 15)
                                 temp_header = " " + temp_header;
-                        } else {
+                        }
+                        else
+                        {
                             Byte[] arrayItems = (Byte[]) data.get(itemNames.get(j));
                             byte[] byteArray = new byte[arrayItems.length];
-                            for (int i = 0; i < arrayItems.length; i++) {
+                            for (int i = 0; i < arrayItems.length; i++)
+                            {
                                 byteArray[i] = arrayItems[i];
                                 temp_header = new String(byteArray, encoding);
                                 while (temp_header.length() < 15)
@@ -133,57 +138,71 @@
                         }
                         message_data = message_data + temp_header + "|";
 
-
                     }
                     echo(message_data);
                 }
-            } catch (Exception ex) {
+            }
+            catch (Exception ex)
+            {
                 echo("Given MessageId is invalid, There's no message with the given messageId");
                 ex.printStackTrace();
                 return;
             }
 
-        } else {
-            if (hasName()) {
+        }
+        else
+        {
+            if (hasName())
+            {
 
                 echo("The Queue you have specified is not in the current broker");
                 echo("");
-            } else {
+            }
+            else
+            {
                 printusage();
             }
         }
     }
 
-    public void execute() {
-        /* In here you it's easy to handle any number of otpions which are going to add with the list command which works
-        with main option object or o
+    public void execute()
+    {
+        /*
+         * In here you it's easy to handle any number of otpions which are going
+         * to add with the list command which works with main option object or o
          */
 
-        if (checkoptionsetting("object") || checkoptionsetting("o")) {
+        if (checkoptionsetting("object") || checkoptionsetting("o"))
+        {
             String object = optionchecker("object");
-            if (object == null) {
+            if (object == null)
+            {
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
                 setObject(object);
-            else {
+            else
+            {
                 unrecognizeoption();
                 echo("This command is only applicable for delete command so please start with queue");
             }
-            if (checkoptionsetting("name") || checkoptionsetting("n")) {
+            if (checkoptionsetting("name") || checkoptionsetting("n"))
+            {
                 String name = optionchecker("name");
                 if (name == null)
                     name = optionchecker("n");
 
                 setName(name);
             }
-            if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
+            if (checkoptionsetting("virtualhost") || checkoptionsetting("v"))
+            {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
                 setVirtualhost(vhost);
             }
-            if (checkoptionsetting("messageid") || checkoptionsetting("id")) {
+            if (checkoptionsetting("messageid") || checkoptionsetting("id"))
+            {
                 String number = optionchecker("id");
                 if (number == null)
                     number = optionchecker("id");
@@ -191,13 +210,15 @@
                 setnumber(removeSpaces(number));
             }
             this.viewcontent();
-        } else if (checkoptionsetting("h") || checkoptionsetting("help"))
+        }
+        else if (checkoptionsetting("h") || checkoptionsetting("help"))
             printusage();
         else
             unrecognizeoption();
     }
 
-    public void printusage() {
+    public void printusage()
+    {
         echo("");
         echo("Usage:viewcontent [OPTION] ... [OBJECT TYPE]...\n");
         echo("view the information about given number of messages from the given queue object\n");
@@ -210,21 +231,24 @@
 
     }
 
-    private void setnumber(String number) {
+    private void setnumber(String number)
+    {
         Integer i = new Integer(number);
         this.number = i.intValue();
     }
 
-    private static String removeSpaces(String s) {
+    private static String removeSpaces(String s)
+    {
         StringTokenizer st = new StringTokenizer(s, " ", false);
         String t = "";
-        while (st.hasMoreElements()) t += st.nextElement();
+        while (st.hasMoreElements())
+            t += st.nextElement();
         return t;
     }
 
-    public int getnumber() {
+    public int getnumber()
+    {
         return this.number;
     }
 
-
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java Fri Jan  9 08:24:01 2009
@@ -23,22 +23,16 @@
 
 import javax.management.MBeanServerConnection;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 20, 2008
- * Time: 9:04:22 AM
- * To change this template use File | Settings | File Templates.
- */
-public class AllObjects extends ObjectNames {
+public class AllObjects extends ObjectNames
+{
 
-    public AllObjects(MBeanServerConnection mbsc) {
+    public AllObjects(MBeanServerConnection mbsc)
+    {
         ObjectNames(mbsc);
-//        querystring = "org.apache.qpid:*";
-//        set = returnObjects();
     }
 
-    public void setQueryString(String object, String name) {
+    public void setQueryString(String object, String name)
+    {
         querystring = "org.apache.qpid:*";
     }
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java Fri Jan  9 08:24:01 2009
@@ -23,23 +23,16 @@
 
 import javax.management.MBeanServerConnection;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 26, 2008
- * Time: 9:58:02 PM
- * To change this template use File | Settings | File Templates.
- */
-public class ConnectionObject extends ObjectNames {
-    public ConnectionObject(MBeanServerConnection mbsc) {
-        /*calling parent classes constructor */
+public class ConnectionObject extends ObjectNames
+{
+    public ConnectionObject(MBeanServerConnection mbsc)
+    {
+        /* calling parent classes constructor */
         ObjectNames(mbsc);
-//        querystring = "org.apache.qpid:type=VirtualHost.Connection,*";
-//        set = returnObjects();
-
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
         if (name != null && vhost == null)
             querystring = "org.apache.qpid:type=Connection,name=" + name + ",*";
         else if (name != null && vhost != null)
@@ -51,4 +44,3 @@
 
     }
 }
-

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java Fri Jan  9 08:24:01 2009
@@ -23,22 +23,16 @@
 
 import javax.management.MBeanServerConnection;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 24, 2008
- * Time: 12:15:19 AM
- * To change this template use File | Settings | File Templates.
- */
-public class ExchangeObject extends ObjectNames {
-    public ExchangeObject(MBeanServerConnection mbsc) {
+public class ExchangeObject extends ObjectNames
+{
+    public ExchangeObject(MBeanServerConnection mbsc)
+    {
         ObjectNames(mbsc);
-//        querystring = "org.apache.qpid:type=VirtualHost.Exchange,*";
-//        set = returnObjects();
 
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
         if (name != null && vhost == null)
             querystring = "org.apache.qpid:type=VirtualHost.Exchange,name=" + name + ",*";
         else if (name != null && vhost != null)
@@ -50,4 +44,3 @@
 
     }
 }
-

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java Fri Jan  9 08:24:01 2009
@@ -21,29 +21,18 @@
 
 package org.apache.qpid.commands.objects;
 
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.management.Attribute;
 import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
-import javax.management.MBeanInfo;
-import javax.management.MBeanException;
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.ReflectionException;
-import javax.management.Attribute;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import java.io.IOException;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 20, 2008
- * Time: 8:39:01 AM
- * To change this template use File | Settings | File Templates.
- */
-public class ObjectNames {
+public class ObjectNames
+{
     public String querystring = null;
     public MBeanServerConnection mbsc;
     public Set set = null;
@@ -51,33 +40,44 @@
     public String attributevalues = "";// = null;
 
     /* method return the Set objects according to the Object type */
-    public void ObjectNames(MBeanServerConnection mbsc) {
+    public void ObjectNames(MBeanServerConnection mbsc)
+    {
         this.mbsc = mbsc;
     }
 
-    public Set returnObjects() {
-        try {
+    public Set returnObjects()
+    {
+        try
+        {
             set = mbsc.queryNames(new ObjectName(querystring), null);
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
         return set;
     }
 
-    public void echo(String str) {
+    public void echo(String str)
+    {
         System.out.println(str);
     }
+
     /* display appropriate objects according to the ojbect type */
 
-    public void displayobjects(String output, String seperator) {
+    public void displayobjects(String output, String seperator)
+    {
         Iterator it = set.iterator();
         String line = "";
         String temp2 = "";
         int iterator = 0;
-        try {
-            do {
+        try
+        {
+            do
+            {
                 ObjectName temp_object = null;
-                if (it.hasNext()) {
+                if (it.hasNext())
+                {
                     temp_object = (ObjectName) it.next();
                     if (temp_object == null)
                         System.out.println("null test");
@@ -85,7 +85,8 @@
                 // echo(temp_object.getCanonicalKeyPropertyListString());
                 MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object);
                 MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
-                if (attr_info == null) {
+                if (attr_info == null)
+                {
                     echo(temp_object.toString());
                     String temp = "";
                     while (temp_object.toString().length() > temp.length())
@@ -93,27 +94,37 @@
                     if (output == null)
                         echo(temp);
 
-                } else {
-                    for (MBeanAttributeInfo attr : attr_info) {
+                }
+                else
+                {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
 
-                        try {
+                        try
+                        {
                             String temp1 = attr.getName();
-                            if (output == null) {
+                            if (output == null)
+                            {
                                 while (temp1.length() < 15)
                                     temp1 = " " + temp1;
                                 attributes = attributes + temp1 + "|";
-                            } else if (output.compareToIgnoreCase("csv") == 0)
+                            }
+                            else if (output.compareToIgnoreCase("csv") == 0)
                                 attributes = attributes + temp1 + seperator;
-                            else {
+                            else
+                            {
                                 echo("Wrong output format current version is supporting only for CSV");
                                 return;
                             }
-                        } catch (Exception x) {
+                        }
+                        catch (Exception x)
+                        {
                             x.printStackTrace();
                         }
                     }
-                    if (attributes.equalsIgnoreCase("")) {
+                    if (attributes.equalsIgnoreCase(""))
+                    {
                         echo(temp_object.toString());
                         String temp = "";
                         while (temp_object.toString().length() > temp.length())
@@ -122,34 +133,40 @@
                         echo("There are no attributes for this object Type");
                         continue;
                     }
-                    for (MBeanAttributeInfo attr : attr_info) {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
                         temp2 = null;
-                        try {
+                        try
+                        {
                             toWrite = mbsc.getAttribute(temp_object, attr.getName());
-                        } catch (Exception x) {
+                        }
+                        catch (Exception x)
+                        {
                             temp2 = "-";
                         }
                         if (toWrite != null)
                             temp2 = toWrite.toString();
                         else
                             temp2 = "-";
-                        if (output == null) {
+                        if (output == null)
+                        {
 
                             while (temp2.length() < 15)
                                 temp2 = " " + temp2;
 
                             attributevalues = attributevalues + temp2 + "|";
-                        } else if (output.compareToIgnoreCase("csv") == 0)
+                        }
+                        else if (output.compareToIgnoreCase("csv") == 0)
                             attributevalues = attributevalues + temp2 + seperator;
 
-                        //echo(temp1 + "     " + temp2 + "      " + temp3);
-
+                        // echo(temp1 + "     " + temp2 + "      " + temp3);
 
                     }
                 }
                 iterator++;
-                if (iterator == 1) {
+                if (iterator == 1)
+                {
                     echo(attributes);
                     for (int i = 0; i < attributes.length(); i++)
                         line = line + "-";
@@ -161,21 +178,27 @@
                 attributes = "";
                 attributevalues = "";
             } while (it.hasNext());
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
 
     }
 
-    public void reportgenerator(String output, String seperator, List<String> column) {
+    public void reportgenerator(String output, String seperator, List<String> column)
+    {
         Iterator it = set.iterator();
         String line = "";
         String temp2 = "";
         int iterator = 0;
-        try {
-            do {
+        try
+        {
+            do
+            {
                 ObjectName temp_object = null;
-                if (it.hasNext()) {
+                if (it.hasNext())
+                {
                     temp_object = (ObjectName) it.next();
                     if (temp_object == null)
                         System.out.println("null test");
@@ -183,7 +206,8 @@
                 // echo(temp_object.getCanonicalKeyPropertyListString());
                 MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object);
                 MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
-                if (attr_info == null) {
+                if (attr_info == null)
+                {
                     echo(temp_object.toString());
                     String temp = "";
                     while (temp_object.toString().length() > temp.length())
@@ -191,29 +215,40 @@
                     if (output == null)
                         echo(temp);
 
-                } else {
-                    for (MBeanAttributeInfo attr : attr_info) {
+                }
+                else
+                {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
 
-                        try {
+                        try
+                        {
                             String temp1 = attr.getName();
-                            if (column.contains(temp1)) {
-                                if (output == null) {
+                            if (column.contains(temp1))
+                            {
+                                if (output == null)
+                                {
                                     while (temp1.length() < 15)
                                         temp1 = " " + temp1;
                                     attributes = attributes + temp1 + "|";
-                                } else if (output.compareToIgnoreCase("csv") == 0)
+                                }
+                                else if (output.compareToIgnoreCase("csv") == 0)
                                     attributes = attributes + temp1 + seperator;
-                                else {
+                                else
+                                {
                                     echo("Wrong output format current version is supporting only for CSV");
                                     return;
                                 }
                             }
-                        } catch (Exception x) {
+                        }
+                        catch (Exception x)
+                        {
                             x.printStackTrace();
                         }
                     }
-                    if (attributes.equalsIgnoreCase("")) {
+                    if (attributes.equalsIgnoreCase(""))
+                    {
                         echo(temp_object.toString());
                         String temp = "";
                         while (temp_object.toString().length() > temp.length())
@@ -222,37 +257,44 @@
                         echo("There are no attributes for this object Type");
                         return;
                     }
-                    for (MBeanAttributeInfo attr : attr_info) {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
                         temp2 = null;
-                        if (column.contains(attr.getName())) {
-                            try {
+                        if (column.contains(attr.getName()))
+                        {
+                            try
+                            {
                                 toWrite = mbsc.getAttribute(temp_object, attr.getName());
-                            } catch (Exception x) {
+                            }
+                            catch (Exception x)
+                            {
                                 temp2 = "-";
                             }
                             if (toWrite != null)
                                 temp2 = toWrite.toString();
                             else
                                 temp2 = "-";
-                            if (output == null) {
+                            if (output == null)
+                            {
 
                                 while (temp2.length() < 15)
                                     temp2 = " " + temp2;
 
                                 attributevalues = attributevalues + temp2 + "|";
-                            } else if (output.compareToIgnoreCase("csv") == 0)
+                            }
+                            else if (output.compareToIgnoreCase("csv") == 0)
                                 attributevalues = attributevalues + temp2 + seperator;
 
-                            //echo(temp1 + "     " + temp2 + "      " + temp3);
+                            // echo(temp1 + "     " + temp2 + "      " + temp3);
 
                         }
 
-
                     }
                 }
                 iterator++;
-                if (iterator == 1) {
+                if (iterator == 1)
+                {
                     echo(attributes);
                     for (int i = 0; i < attributes.length(); i++)
                         line = line + "-";
@@ -264,30 +306,37 @@
                 attributes = "";
                 attributevalues = "";
             } while (it.hasNext());
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
 
     }
 
-    public void displayqueues(String output, String seperator) {
+    public void displayqueues(String output, String seperator)
+    {
         Iterator it = set.iterator();
         String line = "";
         int iterator = 0;
         int attr_count = 0;
         String temp1 = "";
         String temp2 = "";
-        try {
-            do {
+        try
+        {
+            do
+            {
                 attr_count = 0;
                 ObjectName temp_object = null;
-                if (it.hasNext()) {
+                if (it.hasNext())
+                {
                     temp_object = (ObjectName) it.next();
                 }
                 // echo(temp_object.getCanonicalKeyPropertyListString());
                 MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object);
                 MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
-                if (attr_info == null) {
+                if (attr_info == null)
+                {
                     echo(temp_object.toString());
                     String temp = "";
                     while (temp_object.toString().length() > temp.length())
@@ -295,93 +344,106 @@
                     if (output == null)
                         echo(temp);
 
-                } else {
-                    for (MBeanAttributeInfo attr : attr_info) {
+                }
+                else
+                {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
                         attr_count++;
-                        try {
+                        try
+                        {
                             toWrite = mbsc.getAttribute(temp_object, attr.getName());
-                            if (output == null) {
-                                switch (attr_count) {
-                                    case 1:
-                                    case 3:
-                                        temp1 = attr.getName();
-                                        while (temp1.length() < 10)
-                                            temp1 = " " + temp1;
-                                        attributes = attributes + temp1 + "|";
-                                        temp2 = toWrite.toString();
-                                        while (temp2.length() < 10)
-                                            temp2 = " " + temp2;
-                                        attributevalues = attributevalues + temp2 + "|";
-                                        break;
-                                    case 6:
-                                        temp1 = attr.getName();
-                                        while (temp1.length() < 20)
-                                            temp1 = " " + temp1;
-                                        attributes = attributes + temp1 + "|";
-                                        temp2 = toWrite.toString();
-                                        while (temp2.length() < 20)
-                                            temp2 = " " + temp2;
-                                        attributevalues = attributevalues + temp2 + "|";
-                                        break;
-                                    case 7:
-                                        temp1 = attr.getName();
-                                        while (temp1.length() < 13)
-                                            temp1 = " " + temp1;
-                                        attributes = attributes + temp1 + "|";
-                                        temp2 = toWrite.toString();
-                                        while (temp2.length() < 13)
-                                            temp2 = " " + temp2;
-                                        attributevalues = attributevalues + temp2 + "|";
-                                        break;
-                                    case 9:
-                                        temp1 = attr.getName();
-                                        while (temp1.length() < 20)
-                                            temp1 = " " + temp1;
-                                        attributes = attributes + temp1 + "|";
-                                        temp2 = toWrite.toString();
-                                        while (temp2.length() < 20)
-                                            temp2 = " " + temp2;
-                                        attributevalues = attributevalues + temp2 + "|";
-                                        break;
+                            if (output == null)
+                            {
+                                switch (attr_count)
+                                {
+                                case 1:
+                                case 3:
+                                    temp1 = attr.getName();
+                                    while (temp1.length() < 10)
+                                        temp1 = " " + temp1;
+                                    attributes = attributes + temp1 + "|";
+                                    temp2 = toWrite.toString();
+                                    while (temp2.length() < 10)
+                                        temp2 = " " + temp2;
+                                    attributevalues = attributevalues + temp2 + "|";
+                                    break;
+                                case 6:
+                                    temp1 = attr.getName();
+                                    while (temp1.length() < 20)
+                                        temp1 = " " + temp1;
+                                    attributes = attributes + temp1 + "|";
+                                    temp2 = toWrite.toString();
+                                    while (temp2.length() < 20)
+                                        temp2 = " " + temp2;
+                                    attributevalues = attributevalues + temp2 + "|";
+                                    break;
+                                case 7:
+                                    temp1 = attr.getName();
+                                    while (temp1.length() < 13)
+                                        temp1 = " " + temp1;
+                                    attributes = attributes + temp1 + "|";
+                                    temp2 = toWrite.toString();
+                                    while (temp2.length() < 13)
+                                        temp2 = " " + temp2;
+                                    attributevalues = attributevalues + temp2 + "|";
+                                    break;
+                                case 9:
+                                    temp1 = attr.getName();
+                                    while (temp1.length() < 20)
+                                        temp1 = " " + temp1;
+                                    attributes = attributes + temp1 + "|";
+                                    temp2 = toWrite.toString();
+                                    while (temp2.length() < 20)
+                                        temp2 = " " + temp2;
+                                    attributevalues = attributevalues + temp2 + "|";
+                                    break;
                                 }
-                            } else if (output.compareToIgnoreCase("csv") == 0) {
-                                switch (attr_count) {
-                                    case 1:
-                                    case 3:
-                                    case 6:
-                                        temp1 = attr.getName();
-                                        attributes = attributes + temp1 + seperator;
-                                        temp2 = toWrite.toString();
-                                        attributevalues = attributevalues + temp2 + seperator;
-                                        break;
-                                    case 7:
-                                        temp1 = attr.getName();
-                                        attributes = attributes + temp1 + seperator;
-                                        temp2 = toWrite.toString();
-                                        attributevalues = attributevalues + temp2 + seperator;
-                                        break;
-                                    case 9:
-                                        temp1 = attr.getName();
-                                        attributes = attributes + temp1 + seperator;
-                                        temp2 = toWrite.toString();
-                                        attributevalues = attributevalues + temp2 + seperator;
-                                        break;
+                            }
+                            else if (output.compareToIgnoreCase("csv") == 0)
+                            {
+                                switch (attr_count)
+                                {
+                                case 1:
+                                case 3:
+                                case 6:
+                                    temp1 = attr.getName();
+                                    attributes = attributes + temp1 + seperator;
+                                    temp2 = toWrite.toString();
+                                    attributevalues = attributevalues + temp2 + seperator;
+                                    break;
+                                case 7:
+                                    temp1 = attr.getName();
+                                    attributes = attributes + temp1 + seperator;
+                                    temp2 = toWrite.toString();
+                                    attributevalues = attributevalues + temp2 + seperator;
+                                    break;
+                                case 9:
+                                    temp1 = attr.getName();
+                                    attributes = attributes + temp1 + seperator;
+                                    temp2 = toWrite.toString();
+                                    attributevalues = attributevalues + temp2 + seperator;
+                                    break;
                                 }
-                            } else {
+                            }
+                            else
+                            {
                                 echo("Wrong output format specified currently CLI supports only csv output format");
                                 return;
                             }
 
-
-                        } catch (Exception x) {
+                        }
+                        catch (Exception x)
+                        {
                             x.printStackTrace();
                         }
 
                     }
                 }
                 iterator++;
-                if (iterator == 1) {
+                if (iterator == 1)
+                {
                     for (int i = 0; i < attributes.length(); i++)
                         line = line + "-";
                     if (output == null)
@@ -395,60 +457,76 @@
                 attributes = "";
                 attributevalues = "";
             } while (it.hasNext());
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
     }
 
-    public void displayinfo(String output, String seperator) {
+    public void displayinfo(String output, String seperator)
+    {
         Iterator it = set.iterator();
         String temp1, temp2 = "";
-        try {
-            do {
+        try
+        {
+            do
+            {
 
                 ObjectName temp_object = null;
-                if (it.hasNext()) {
+                if (it.hasNext())
+                {
                     temp_object = (ObjectName) it.next();
                 }
                 // echo(temp_object.getCanonicalKeyPropertyListString());
                 MBeanInfo bean_info = mbsc.getMBeanInfo(temp_object);
                 MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
-                if (attr_info == null) {
+                if (attr_info == null)
+                {
                     echo(temp_object.toString());
                     String temp = "";
                     while (temp_object.toString().length() > temp.length())
                         temp = "=" + temp;
                     echo(temp);
 
-                } else {
+                }
+                else
+                {
                     echo(temp_object.toString());
                     String temp = "";
                     while (temp_object.toString().length() > temp.length())
                         temp = "=" + temp;
                     echo(temp);
 
-                    for (MBeanAttributeInfo attr : attr_info) {
+                    for (MBeanAttributeInfo attr : attr_info)
+                    {
                         Object toWrite = null;
 
-                        try {
+                        try
+                        {
                             toWrite = mbsc.getAttribute(temp_object, attr.getName());
-                        } catch (Exception x) {
+                        }
+                        catch (Exception x)
+                        {
                             temp2 = "-";
                         }
                         temp1 = attr.getName();
                         if (toWrite != null)
                             temp2 = toWrite.toString();
 
-                        if (output == null) {
+                        if (output == null)
+                        {
                             while (temp1.length() < 35)
                                 temp1 = " " + temp1;
 
                             while (temp2.length() < 35)
                                 temp2 = " " + temp2;
                             echo(temp1 + "     " + temp2);
-                        } else if (output.compareToIgnoreCase("csv") == 0)
+                        }
+                        else if (output.compareToIgnoreCase("csv") == 0)
                             echo(temp1 + seperator + temp2);
-                        else {
+                        else
+                        {
                             echo("Wrong output format specified currently CLI supports only csv output format");
                             return;
                         }
@@ -458,25 +536,31 @@
 
                 }
             } while (it.hasNext());
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
 
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
 
     }
 
-    public void setQueryStringforinfo(String object, String name, String virtualhost) {
+    public void setQueryStringforinfo(String object, String name, String virtualhost)
+    {
 
     }
 
-    public String getQueryString() {
+    public String getQueryString()
+    {
         return querystring;
     }
 
-    public Set getSet() {
+    public Set getSet()
+    {
         return set;
     }
 

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java Fri Jan  9 08:24:01 2009
@@ -26,19 +26,15 @@
 import javax.management.MBeanInfo;
 import javax.management.ObjectName;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 20, 2008
- * Time: 8:49:56 AM
- * To change this template use File | Settings | File Templates.
- */
-public class QueueObject extends ObjectNames {
-    public QueueObject(MBeanServerConnection mbsc) {
+public class QueueObject extends ObjectNames
+{
+    public QueueObject(MBeanServerConnection mbsc)
+    {
         ObjectNames(mbsc);
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
         if (name != null && vhost == null)
             querystring = "org.apache.qpid:type=VirtualHost.Queue,name=" + name + ",*";
         else if (name != null && vhost != null)
@@ -49,23 +45,28 @@
             querystring = "org.apache.qpid:type=VirtualHost.Queue,*";
     }
 
-    public int getmessagecount(ObjectName queue) {
+    public int getmessagecount(ObjectName queue)
+    {
         int attr_count = 0;
         String value;
         Integer depth = null;
 
-        try {
+        try
+        {
             MBeanInfo bean_info;
             bean_info = mbsc.getMBeanInfo(queue);
             MBeanAttributeInfo[] attr_info = bean_info.getAttributes();
             if (attr_info == null)
                 return 0;
-            else {
-                for (MBeanAttributeInfo attr : attr_info) {
+            else
+            {
+                for (MBeanAttributeInfo attr : attr_info)
+                {
                     Object toWrite = null;
                     attr_count++;
                     toWrite = mbsc.getAttribute(queue, attr.getName());
-                    if (attr_count == 7) {
+                    if (attr_count == 7)
+                    {
                         value = toWrite.toString();
                         depth = new Integer(value);
                     }
@@ -73,7 +74,9 @@
 
             }
 
-        } catch (Exception ex) {
+        }
+        catch (Exception ex)
+        {
             ex.printStackTrace();
         }
         if (depth != null)
@@ -82,5 +85,4 @@
             return -1;
     }
 
-
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java Fri Jan  9 08:24:01 2009
@@ -23,22 +23,15 @@
 
 import javax.management.MBeanServerConnection;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 24, 2008
- * Time: 12:11:52 AM
- * To change this template use File | Settings | File Templates.
- */
-public class UserManagementObject extends ObjectNames {
-    public UserManagementObject(MBeanServerConnection mbsc) {
+public class UserManagementObject extends ObjectNames
+{
+    public UserManagementObject(MBeanServerConnection mbsc)
+    {
         ObjectNames(mbsc);
-//        querystring = "org.apache.qpid:type=UserManagement,*";
-//        set = returnObjects();
-
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
         querystring = "org.apache.qpid:type=UserManagement,*";
     }
 

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java Fri Jan  9 08:24:01 2009
@@ -23,31 +23,25 @@
 
 import javax.management.MBeanServerConnection;
 
-/**
- * Created by IntelliJ IDEA.
- * User: lahiru
- * Date: Jun 20, 2008
- * Time: 9:02:04 AM
- * To change this template use File | Settings | File Templates.
- */
-public class VirtualHostObject extends ObjectNames {
+public class VirtualHostObject extends ObjectNames
+{
 
-    public VirtualHostObject(MBeanServerConnection mbsc) {
+    public VirtualHostObject(MBeanServerConnection mbsc)
+    {
         ObjectNames(mbsc);
-//        querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*";
-//        set = returnObjects();
     }
 
-    public void setQueryString(String object, String name, String vhost) {
+    public void setQueryString(String object, String name, String vhost)
+    {
         if (name != null && vhost == null)
             querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,name=" + name + ",*";
         else if (name != null && vhost != null)
-            querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",name=" + name + ",*";
+            querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",name=" + name
+                    + ",*";
         else if (name == null && vhost != null)
             querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",*";
         else
             querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*";
 
-
     }
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java Fri Jan  9 08:24:01 2009
@@ -18,52 +18,40 @@
  * under the License.
  *
  */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.utils;
 
 import java.util.ArrayList;
 
-public class CommandLineOption implements CommandLineOptionConstants {
+public class CommandLineOption implements CommandLineOptionConstants
+{
     private String type;
     private ArrayList optionValues;
 
-    public CommandLineOption(String type, String[] values) {
+    public CommandLineOption(String type, String[] values)
+    {
         setOptionType(type);
         ArrayList arrayList = new ArrayList(values.length);
-        for (int i = 0; i < values.length; i++) {
+        for (int i = 0; i < values.length; i++)
+        {
             arrayList.add(values[i]);
         }
         this.optionValues = arrayList;
     }
 
-    private void setOptionType(String type) {
-        //cater for the long options first
-        if (type.startsWith("--")) {
+    private void setOptionType(String type)
+    {
+        // cater for the long options first
+        if (type.startsWith("--"))
+        {
             type = type.replaceFirst("--", "");
         }
-        if (type.startsWith("-")) {
+        if (type.startsWith("-"))
+        {
             type = type.replaceFirst("-", "");
         }
 
-        //we do not change the case of the option!
+        // we do not change the case of the option!
 
         this.type = type;
     }
@@ -71,42 +59,46 @@
     /**
      * @param type
      */
-    public CommandLineOption(String type, ArrayList values) {
+    public CommandLineOption(String type, ArrayList values)
+    {
         setOptionType(type);
 
-        if (null != values) {
+        if (null != values)
+        {
             this.optionValues = values;
         }
     }
 
-
     /**
      * @return Returns the type.
      * @see CommandLineOptionConstants
      */
-    public String getOptionType() {
+    public String getOptionType()
+    {
         return type;
     }
 
-
     /**
      * @return Returns the optionValues.
      */
-    public String getOptionValue() {
-        if ((optionValues != null) && (optionValues.size() > 0)) {
+    public String getOptionValue()
+    {
+        if ((optionValues != null) && (optionValues.size() > 0))
+        {
             return (String) optionValues.get(0);
-        } else {
+        }
+        else
+        {
             return null;
         }
     }
 
-
     /**
      * @return Returns the optionValues.
      */
-    public ArrayList getOptionValues() {
+    public ArrayList getOptionValues()
+    {
         return optionValues;
     }
 
-
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java Fri Jan  9 08:24:01 2009
@@ -18,30 +18,13 @@
  * under the License.
  *
  */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.utils;
 
-
-public interface CommandLineOptionConstants {
-    static interface JMXCommandLineOptionConstants {
+public interface CommandLineOptionConstants
+{
+    static interface JMXCommandLineOptionConstants
+    {
         String HOST_OPTION = "h";
         String PORT_OPTION = "p";
         String INTERVAL_OPTION = "i";
@@ -51,5 +34,4 @@
 
     }
 
-
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java Fri Jan  9 08:24:01 2009
@@ -18,23 +18,6 @@
  * under the License.
  *
  */
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.utils;
 
@@ -43,8 +26,8 @@
 import java.util.HashMap;
 import java.util.StringTokenizer;
 
-
-public class CommandLineOptionParser {
+public class CommandLineOptionParser
+{
     private static int STARTED = 0;
     private static int NEW_OPTION = 1;
     private static int SUB_PARAM_OF_OPTION = 2;
@@ -52,38 +35,43 @@
     private Map commandlineoption;
     private String commandname;
 
-    public CommandLineOptionParser(Map commandlineoptions) {
+    public CommandLineOptionParser(Map commandlineoptions)
+    {
         this.commandlineoption = commandlineoptions;
     }
 
-    public CommandLineOptionParser(String[] args) {
+    public CommandLineOptionParser(String[] args)
+    {
         /* check whether user just type the enter key */
         this.commandlineoption = this.parse(args);
 
     }
 
-    public CommandLineOptionParser(String[] args, String first) {
+    public CommandLineOptionParser(String[] args, String first)
+    {
         this.commandname = first;
         this.commandlineoption = this.parsefirst(args);
     }
 
-    public Map parse(String[] args) {
+    public Map parse(String[] args)
+    {
         Map commandLineOptions = new HashMap();
 
-        if (0 == args.length) {
+        if (0 == args.length)
+        {
             return commandLineOptions;
-        } else if (1 == args.length) {
+        }
+        else if (1 == args.length)
+        {
             commandname = args[0];
             return commandLineOptions;
         }
         /* when user is not giving the command line option with a "=" */
-//       if (!args[2].startsWith("-"))
-//            return commandLineOptions;
-
-        //State 0 means started
-        //State 1 means earlier one was a new -option
-        //State 2 means earlier one was a sub param of a -option
-
+        // if (!args[2].startsWith("-"))
+        // return commandLineOptions;
+        // State 0 means started
+        // State 1 means earlier one was a new -option
+        // State 2 means earlier one was a sub param of a -option
         int state = STARTED;
         ArrayList optionBundle = null;
         String optionType = null;
@@ -91,48 +79,60 @@
         String newcommand = "";
         String[] newargs;
         int j;
-        if (args[1].compareTo("list") == 0 || args[1].compareTo("info") == 0 || args[1].compareTo("delete") == 0 ||
-                args[1].compareTo("move") == 0 || args[1].compareTo("view") == 0 || args[1].compareTo("viewcontent") == 0) {
+        if (args[1].compareTo("list") == 0 || args[1].compareTo("info") == 0 || args[1].compareTo("delete") == 0
+                || args[1].compareTo("move") == 0 || args[1].compareTo("view") == 0
+                || args[1].compareTo("viewcontent") == 0)
+        {
             String object = args[0];
-            for (j = 0; j < (args.length - 1); j++) {
+            for (j = 0; j < (args.length - 1); j++)
+            {
                 newcommand = newcommand + args[j + 1] + " ";
             }
             newcommand = newcommand + "-o " + object;
             newargs = newcommand.split(" ");
             args = newargs;
-        } else
-        if (!args[1].startsWith("-"))     //if user give command like list queue or something without minus argument
-            return commandLineOptions;         //for the second wordxi
+        }
+        else if (!args[1].startsWith("-")) // if user give command like list
+                                           // queue or something without minus
+                                           // argument
+            return commandLineOptions; // for the second wordxi
 
         commandname = args[0];
-        for (int i = 0; i < args.length; i++) {
-            if (args[i].startsWith("-")) {
-                if (STARTED == state) {
+        for (int i = 0; i < args.length; i++)
+        {
+            if (args[i].startsWith("-"))
+            {
+                if (STARTED == state)
+                {
                     // fresh one
                     state = NEW_OPTION;
                     optionType = args[i];
-                } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
+                }
+                else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state)
+                {
                     // new one but old one should be saved
-                    commandLineOption =
-                            new CommandLineOption(optionType, optionBundle);
-                    commandLineOptions.put(commandLineOption.getOptionType(),
-                            commandLineOption);
+                    commandLineOption = new CommandLineOption(optionType, optionBundle);
+                    commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption);
                     state = NEW_OPTION;
                     optionType = args[i];
                     optionBundle = null;
 
                 }
-            } else {
-                if (NEW_OPTION == state) {
+            }
+            else
+            {
+                if (NEW_OPTION == state)
+                {
                     optionBundle = new ArrayList();
                     optionBundle.add(args[i]);
                     state = SUB_PARAM_OF_OPTION;
 
-                } else if (SUB_PARAM_OF_OPTION == state) {
+                }
+                else if (SUB_PARAM_OF_OPTION == state)
+                {
                     optionBundle.add(args[i]);
                 }
 
-
             }
         }
         commandLineOption = new CommandLineOption(optionType, optionBundle);
@@ -141,21 +141,23 @@
 
     }
 
-    public Map parsefirst(String[] args) {
+    public Map parsefirst(String[] args)
+    {
         Map commandLineOptions = new HashMap();
-        if (0 == args.length) {
+        if (0 == args.length)
+        {
             return commandLineOptions;
-        } else if (1 == args.length) {
+        }
+        else if (1 == args.length)
+        {
             return commandLineOptions;
         }
         /* when user is not giving the command line option with a "=" */
-//       if (!args[2].startsWith("-"))
-//            return commandLineOptions;
-
-        //State 0 means started
-        //State 1 means earlier one was a new -option
-        //State 2 means earlier one was a sub param of a -option
-
+        // if (!args[2].startsWith("-"))
+        // return commandLineOptions;
+        // State 0 means started
+        // State 1 means earlier one was a new -option
+        // State 2 means earlier one was a sub param of a -option
         int state = STARTED;
         ArrayList optionBundle = null;
         String optionType = null;
@@ -164,34 +166,41 @@
         String[] newargs;
         int j;
 
-        for (int i = 0; i < args.length; i++) {
-            if (args[i].startsWith("-")) {
-                if (STARTED == state) {
+        for (int i = 0; i < args.length; i++)
+        {
+            if (args[i].startsWith("-"))
+            {
+                if (STARTED == state)
+                {
                     // fresh one
                     state = NEW_OPTION;
                     optionType = args[i];
-                } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
+                }
+                else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state)
+                {
                     // new one but old one should be saved
-                    commandLineOption =
-                            new CommandLineOption(optionType, optionBundle);
-                    commandLineOptions.put(commandLineOption.getOptionType(),
-                            commandLineOption);
+                    commandLineOption = new CommandLineOption(optionType, optionBundle);
+                    commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption);
                     state = NEW_OPTION;
                     optionType = args[i];
                     optionBundle = null;
 
                 }
-            } else {
-                if (NEW_OPTION == state) {
+            }
+            else
+            {
+                if (NEW_OPTION == state)
+                {
                     optionBundle = new ArrayList();
                     optionBundle.add(args[i]);
                     state = SUB_PARAM_OF_OPTION;
 
-                } else if (SUB_PARAM_OF_OPTION == state) {
+                }
+                else if (SUB_PARAM_OF_OPTION == state)
+                {
                     optionBundle.add(args[i]);
                 }
 
-
             }
         }
         commandLineOption = new CommandLineOption(optionType, optionBundle);
@@ -200,18 +209,22 @@
 
     }
 
-    public Map getAlloptions() {
+    public Map getAlloptions()
+    {
         return this.commandlineoption;
     }
 
-    public String getcommandname() {
+    public String getcommandname()
+    {
         return this.commandname;
     }
 
-    private static String removeSpaces(String s) {
+    private static String removeSpaces(String s)
+    {
         StringTokenizer st = new StringTokenizer(s, " ", false);
         String t = "";
-        while (st.hasMoreElements()) t += st.nextElement();
+        while (st.hasMoreElements())
+            t += st.nextElement();
         return t;
     }
 

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java?rev=733073&r1=733072&r2=733073&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java Fri Jan  9 08:24:01 2009
@@ -1,45 +1,27 @@
 /*
-*
-* 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.
-*
-*/
-/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
  *
- * Licensed 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
+ * 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
+ *   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.
+ * 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.utils;
 
-
-public class JMXConfigProperty {
+public class JMXConfigProperty
+{
 
     private static final String DEFAULT_HOST_NAME = "localhost";
     private static final String DEFAULT_PORT = "8999";



Mime
View raw message