qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r732307 - in /qpid/trunk/qpid/java/management/tools/qpid-cli: src/org/apache/qpid/ src/org/apache/qpid/commands/ test/org/apache/qpid/commands/
Date Wed, 07 Jan 2009 11:36:41 GMT
Author: aidan
Date: Wed Jan  7 03:36:41 2009
New Revision: 732307

URL: http://svn.apache.org/viewvc?rev=732307&view=rev
Log:
QPID-1522: Move common code up to CommandImpl. Rename methods to be consistent. Remove commented
out code.

Added:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/CommandImpl.java
Removed:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java
Modified:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java Wed Jan
 7 03:36:41 2009
@@ -37,16 +37,14 @@
  */
 package org.apache.qpid;
 
-import org.apache.qpid.utils.CommandLineOption;
-
 public interface Command {
 
-    public static String commandname = null;
-    public static CommandLineOption options = null;
-
     public void execute();
 
     public void printusage();
 
-    public void optionvaluechecker();
+    public String optionchecker(String string);
+
+    public boolean checkoptionsetting(String string);
+
 }

Added: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/CommandImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/CommandImpl.java?rev=732307&view=auto
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/CommandImpl.java
(added)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/CommandImpl.java
Wed Jan  7 03:36:41 2009
@@ -0,0 +1,158 @@
+/*
+ *
+ * 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
+ *
+ *    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.Command;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOption;
+
+import java.util.Map;
+
+
+public abstract class CommandImpl implements Command {
+    protected JMXinfo info = null;
+    private String commandname = null;
+
+    private String name;
+    private String virtualhost = null;
+    private String object = null;
+
+    private String outputformat = null;
+    private String seperator = ",";
+
+    public CommandImpl(JMXinfo info, String name) {
+        this.info = info;
+        this.commandname = name;
+    }
+
+    public CommandImpl() {
+
+    }
+
+    protected void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+    
+    protected boolean hasName() {
+        if (this.name == null)
+            return false;
+
+        else
+            return true;
+    }
+    
+    protected void setObject(String object) {
+        this.object = object;
+    }
+    
+    public String getObject() {
+        return this.object;
+    }
+    
+    protected void setOutputFormat(String outputformat) {
+        this.outputformat = outputformat;
+    }
+
+    protected String getOutputFormat()
+    {
+        return outputformat;
+    }
+    
+    protected void setSeperator(String seperator) {
+        this.seperator = seperator;
+    }
+
+    protected String getSeperator()
+    {
+        return seperator;
+    }
+    
+    protected void setVirtualhost(String virtualhost) {
+        this.virtualhost = virtualhost;
+    }
+
+    public String getVirtualhost() {
+        return this.virtualhost;
+    }
+
+    public String optionchecker(String option_letter) {
+        Map map = info.getCommandLineOptionParser().getAlloptions();
+        if (map == null)
+            return null;
+        CommandLineOption option = (CommandLineOption) map.get(option_letter);
+        if (option == null)
+            return null;
+        String value = option.getOptionValue();
+        return value;
+    }
+
+    public boolean checkoptionsetting(String option_letter) {
+        Map map = info.getCommandLineOptionParser().getAlloptions();
+        if (map == null)
+            return false;
+        CommandLineOption option = (CommandLineOption) map.get(option_letter);
+        if (option == null)
+            return false;
+        String value = option.getOptionType();
+
+        if (value != null)
+            return true;
+        else
+            return false;
+    }
+    
+    public void echo(String str) {
+        System.out.println(str);
+    }
+
+    public void unrecognizeoption() {
+        echo("list: Unrecognized option");
+        echo("Try `" + this.commandname + " --help` for more information");
+    }
+
+    public abstract void execute();
+
+    public abstract void printusage();
+
+}

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
Wed Jan  7 03:36:41 2009
@@ -60,9 +60,6 @@
  * To change this template use File | Settings | File Templates.
  */
 public class Commanddelete extends CommandImpl {
-    private String object;
-    private String name;
-    private String vhost;
     private int number = 0;
     private QueueObject objname;
     private MBeanServerConnection mbsc;
@@ -80,7 +77,7 @@
 
     public void deletemessages() {
         Set set = null;
-        objname.setQueryString(this.object, this.name, this.vhost);
+        objname.setQueryString(this.getObject(), this.getName(), this.getVirtualhost());
         set = objname.returnObjects();
 
         if (objname.getSet().size() != 0) {
@@ -111,7 +108,7 @@
             }
 
         } else {
-            if (isname()) {
+            if (hasName()) {
 
                 echo("The Queue you have specified is not in the current broker");
                 echo("");
@@ -132,7 +129,7 @@
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
-                setobject(object);
+                setObject(object);
             else {
                 unrecognizeoption();
                 echo("This command is only applicable for delete command so please start
with queue");
@@ -142,13 +139,13 @@
                 if (name == null)
                     name = optionchecker("n");
 
-                setname(name);
+                setName(name);
             }
             if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
-                setvhost(vhost);
+                setVirtualhost(vhost);
             }
             if (checkoptionsetting("top") || checkoptionsetting("t")) {
                 String number = optionchecker("top");
@@ -177,38 +174,6 @@
 
     }
 
-    private void setobject(String object) {
-        this.object = object;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
-
-    private void setname(String name) {
-        this.name = name;
-    }
-
-    private boolean isname() {
-        if (this.name == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private void setvhost(String vhost) {
-        this.vhost = vhost;
-    }
-
-    public String getvhost() {
-        return this.vhost;
-    }
-
-    public String getname() {
-        return this.name;
-    }
-
     private void setnumber(String number) {
         Integer i = new Integer(number);
         this.number = i.intValue();

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
Wed Jan  7 03:36:41 2009
@@ -53,10 +53,10 @@
     }
 
     public void execute() {
-        displayhelp();
+        printusage();
     }
 
-    private void displayhelp() {
+    public void printusage() {
         echo("");
         echo("Current version of qpid CLI is supporting following commands");
         echo("");

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java
Wed Jan  7 03:36:41 2009
@@ -48,11 +48,6 @@
 
 
 public class Commandinfo extends CommandImpl {
-    private String object = null;
-    private String name = null;
-    private String virtualhost = null;
-    private String outputformat = null;
-    private String seperator = ",";
 
     public Commandinfo(JMXinfo info, String name) {
 
@@ -99,17 +94,17 @@
                 echo("Wrong objectName");
                 return;
             }
-            objname.setQueryString(this.object, this.name, this.virtualhost);
+            objname.setQueryString(this.getObject(), this.getName(), this.getVirtualhost());
             objname.returnObjects();
             if (objname.getSet().size() != 0) {
-                objname.displayinfo(this.outputformat, this.seperator);
+                objname.displayinfo(this.getOutputFormat(), this.getSeperator());
 
             } else {
-                if (isname()) {
+                if (hasName()) {
 
-                    echo("You might quering wrong " + this.object + " name with --name or
-n option ");
+                    echo("You might quering wrong " + this.getObject() + " name with --name
or -n option ");
                     echo("");
-                    echo(this.object + "Type Objects might not in the broker currently");
+                    echo(this.getObject() + "Type Objects might not in the broker currently");
                     echo("");
                 } else {
                     printusage();
@@ -129,30 +124,30 @@
         with main option object or o
          */
         if (checkoptionsetting("output")) {
-            setoutputformat(optionchecker("output"));
+            setOutputFormat(optionchecker("output"));
             if (checkoptionsetting("separator"))
-                setseperator(optionchecker("separator"));
+                setSeperator(optionchecker("separator"));
         }
         if (checkoptionsetting("object") || checkoptionsetting("o")) {
             String object = optionchecker("object");
             if (object == null) {
                 object = optionchecker("o");
             }
-            setobject(object);
+            setObject(object);
             if (checkoptionsetting("name") || checkoptionsetting("n")) {
                 String name = optionchecker("name");
                 if (name == null)
                     name = optionchecker("n");
 
-                setname(name);
+                setName(name);
             }
             if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
-                setvirtualhost(vhost);
+                setVirtualhost(vhost);
             }
-            listobjects(this.object);
+            listobjects(this.getObject());
         } else if (checkoptionsetting("h") || checkoptionsetting("help"))
             printusage();
         else
@@ -185,75 +180,4 @@
         echo("                              ex: <queue info -n ping> : Give all the
information about queue objects ");
         echo("                              having queue name of ping\n");
     }
-
-    private void setobject(String object) {
-        this.object = object;
-    }
-
-    private void setname(String name) {
-        this.name = name;
-    }
-
-    private boolean isname() {
-        if (this.name == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private void setvirtualhost(String vhost) {
-        this.virtualhost = vhost;
-    }
-
-    public String getvirtualhost() {
-        return this.virtualhost;
-    }
-
-    private void setoutputformat(String outputformat) {
-        this.outputformat = outputformat;
-    }
-
-    private void setseperator(String seperator) {
-        this.seperator = seperator;
-    }
-
-    private boolean isseperator() {
-        if (this.seperator == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private boolean isoutputformat() {
-        if (this.outputformat == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    public String getname() {
-        return this.name;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
-
-    /*
-    public String optionchecker(String option_letter) {
-       Map map =  info.getCommandLineOptionParser().getAlloptions();
-       if(map == null)
-       return null;
-       CommandLineOption option = (CommandLineOption) map.get(option_letter);
-       if(option == null)
-       return null;
-       String value = option.getOptionValue();
-       return value;
-
-
-    }
-    */
 }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java
Wed Jan  7 03:36:41 2009
@@ -55,12 +55,6 @@
 
 public class Commandlist extends CommandImpl {
 
-    private String object;
-    private String name;
-    private String vhost;
-    private String outputformat = null;
-    private String seperator = ","; //this variable is assigning if -n option is used otherwise
this is null
-
     public Commandlist(JMXinfo info, String name) {
         super(info, name);
 
@@ -105,19 +99,19 @@
                 echo("Wrong objectName");
                 return;
             }
-            objname.setQueryString(this.object, this.name, this.vhost);
+            objname.setQueryString(this.getObject(), this.getName(), this.getVirtualhost());
             objname.returnObjects();
             if (objname.getSet().size() != 0) {
-                if (this.object.compareToIgnoreCase("queue") == 0 || this.object.compareToIgnoreCase("queues")
== 0)
-                    objname.displayqueues(this.outputformat, this.seperator);
+                if (this.getObject().compareToIgnoreCase("queue") == 0 || this.getObject().compareToIgnoreCase("queues")
== 0)
+                    objname.displayqueues(this.getOutputFormat(), this.getSeperator());
                 else
-                    objname.displayobjects(this.outputformat, this.seperator);
+                    objname.displayobjects(this.getOutputFormat(), this.getSeperator());
             } else {
-                if (isname()) {
+                if (hasName()) {
 
-                    echo("You might quering wrong " + this.object + " name with --name or
-n option ");
+                    echo("You might quering wrong " + this.getObject() + " name with --name
or -n option ");
                     echo("");
-                    echo(this.object + "Type Objects might not in the broker currently");
+                    echo(this.getObject() + "Type Objects might not in the broker currently");
                     echo("");
                 } else {
                     printusage();
@@ -150,30 +144,30 @@
         with main option object or o
          */
         if (checkoptionsetting("output")) {
-            setoutputformat(optionchecker("output"));
+            setOutputFormat(optionchecker("output"));
             if (checkoptionsetting("separator"))
-                setseperator(optionchecker("separator"));
+                setSeperator(optionchecker("separator"));
         }
         if (checkoptionsetting("object") || checkoptionsetting("o")) {
             String object = optionchecker("object");
             if (object == null) {
                 object = optionchecker("o");
             }
-            setobject(object);
+            setObject(object);
             if (checkoptionsetting("name") || checkoptionsetting("n")) {
                 String name = optionchecker("name");
                 if (name == null)
                     name = optionchecker("n");
 
-                setname(name);
+                setName(name);
             }
             if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
-                setvhost(vhost);
+                setVirtualhost(vhost);
             }
-            listobjects(this.object);
+            listobjects(this.getObject());
         } else if (checkoptionsetting("domain") || checkoptionsetting("d"))
             listdomains();
         else if (checkoptionsetting("h") || checkoptionsetting("help"))
@@ -213,81 +207,6 @@
 
 
     }
-
-    private void setobject(String object) {
-        this.object = object;
-    }
-
-    private void setname(String name) {
-        this.name = name;
-    }
-
-    private boolean isname() {
-        if (this.name == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private void setvhost(String vhost) {
-        this.vhost = vhost;
-    }
-
-    public String getvhost() {
-        return this.vhost;
-    }
-
-    public String getname() {
-        return this.name;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
-
-    private void setoutputformat(String outputformat) {
-        this.outputformat = outputformat;
-    }
-
-    private void setseperator(String seperator) {
-        this.seperator = seperator;
-    }
-
-    private boolean isseperator() {
-        if (this.seperator == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private boolean isoutputformat() {
-        if (this.outputformat == null)
-            return false;
-
-        else
-            return true;
-    }
-
-
-    /*
-    public String optionchecker(String option_letter) {
-       Map map =  info.getCommandLineOptionParser().getAlloptions();
-       if(map == null)
-       return null;
-       CommandLineOption option = (CommandLineOption) map.get(option_letter);
-       if(option == null)
-       return null;
-       String value = option.getOptionValue();
-       return value;
-
-
-    }
-    */
-    public void optionvaluechecker() {
-
-    }
 }
 
 

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java
Wed Jan  7 03:36:41 2009
@@ -63,10 +63,8 @@
  * To change this template use File | Settings | File Templates.
  */
 public class Commandmove extends CommandImpl {
-    private String object;
     private String name1 = null, name2 = null, vhost1 = null, vhost2 = null, method1 = null,
method2 = null;    //target and starting queue specifications happen with these options
-    private int number = 0;
-    private QueueObject queue1, queue2;
+    private QueueObject queue1;
     private MBeanServerConnection mbsc;
     private ObjectName queue;
     private int fmid = 0, tmid = 0;
@@ -75,7 +73,6 @@
         super(info, name);
         this.mbsc = info.getmbserverconnector();
         this.queue1 = new QueueObject(mbsc);
-//        this.queue2 = new QueueObject(mbsc);
         this.method1 = "moveMessages";
         this.method2 = "getMessagesOnTheQueue";
 
@@ -83,12 +80,8 @@
 
     public void movemessages() {
         Set set = null;
-        queue1.setQueryString(this.object, this.name1, this.vhost1);
-//        queue2.setQueryString(this.object, this.name2, this.vhost2);
+        queue1.setQueryString(this.getObject(), this.name1, this.vhost1);
         set = queue1.returnObjects();
-        List messageidlist = null;
-        Long frommessageid = null, tomessageid, middle;
-        int temp = 0;
         if (queue1.getSet().size() != 0) {                   // find the queue 
             Iterator it = set.iterator();
             this.queue = (ObjectName) it.next();
@@ -101,43 +94,6 @@
                 printusage();
             }
         }
-//        if(this.tmid == 0 || this.fmid == 0)
-//        {
-//            this.number = queue1.getmessagecount(this.queue);
-//            echo("");
-//            System.out.print("Do you want to delete all the messages from the Queue[Y/N]
:");
-//            InputStreamReader isr = new InputStreamReader(System.in);
-//            BufferedReader br = new BufferedReader(isr);
-//            try{
-//                String s = br.readLine();
-//                echo(s);
-//                if(s.compareToIgnoreCase("y") != 0)
-//                    return;
-//            }catch(Exception ex)
-//            {
-//                ex.printStackTrace();
-//            }
-//
-//        }
-//        if(this.number > queue1.getmessagecount(this.queue))
-//        {
-//            System.out.println("Given number is Greater than the Queue Depth");
-//            return;
-//        }//if user doesn't specify -t option all the messages will be moved
-//        Object[] params = {new Integer(this.number)};
-//        String[] signature = {new String("java.lang.Integer")};
-//        try{
-//            messageidlist = (List)this.mbsc.invoke(queue,this.method2,params,signature);
-//            Iterator it1 = messageidlist.iterator();
-//            temp++;
-//            do
-//            {
-//                middle = (Long)it1.next();
-//                if(temp == 1)
-//                    frommessageid = middle; // get the messageid of first message
-//
-//            }while(it1.hasNext());
-//            tomessageid = middle;   // get the messageid of the last message
         try {
             Object[] params1 = {getfmid(), gettmid(), this.name2};
             String[] signature1 = {new String("long"), new String("long"), new String("java.lang.String")};
@@ -163,7 +119,7 @@
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
-                setobject(object);
+                setObject(object);
             else {
                 unrecognizeoption();
                 echo("This command is only applicable for queue command so please start with
queue");
@@ -214,10 +170,6 @@
 
     }
 
-    private void setobject(String object) {
-        this.object = object;
-    }
-
     private void setname1(String name) {
         this.name1 = name;
     }
@@ -245,14 +197,6 @@
     private void setvhost1(String vhost) {
         this.vhost1 = vhost;
     }
-//    private void setvhost2(String vhost) {
-//        this.vhost2 = vhost;
-//    }
-
-    private void setnumber(String number) {
-        Integer i = new Integer(number);
-        this.number = i.intValue();
-    }
 
     private static String removeSpaces(String s) {
         StringTokenizer st = new StringTokenizer(s, " ", false);
@@ -284,11 +228,4 @@
         return this.name2;
     }
 
-    public String getvhost() {
-        return this.vhost1;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
 }

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=732307&r1=732306&r2=732307&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
Wed Jan  7 03:36:41 2009
@@ -60,13 +60,10 @@
  * To change this template use File | Settings | File Templates.
  */
 public class Commandview extends CommandImpl {
-    private String object;
-    private String name;
-    private String vhost;
     private int number = 0;
     private QueueObject objname;
     private MBeanServerConnection mbsc;
-    private String method1, method2;
+    private String method1;
     private ObjectName queue;
 
     public Commandview(JMXinfo info, String name) {
@@ -74,14 +71,13 @@
         this.mbsc = info.getmbserverconnector();
         this.objname = new QueueObject(mbsc);
         this.method1 = "viewMessages";
-        this.method2 = "viewMessaegContent";
 
     }
 
     public void viewmessages() {
         Set set = null;
         Object temp[] = {null};
-        objname.setQueryString(this.object, this.name, this.vhost);
+        objname.setQueryString(this.getObject(), this.getName(), this.getVirtualhost());
         set = objname.returnObjects();
         String header = "", temp_header = "", message_data = "", outline = "";
 
@@ -159,7 +155,7 @@
             }
 
         } else {
-            if (isname()) {
+            if (hasName()) {
 
                 echo("The Queue you have specified is not in the current broker");
                 echo("");
@@ -180,7 +176,7 @@
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
-                setobject(object);
+                setObject(object);
             else {
                 unrecognizeoption();
                 echo("This command is only applicable for delete command so please start
with queue");
@@ -190,13 +186,13 @@
                 if (name == null)
                     name = optionchecker("n");
 
-                setname(name);
+                setName(name);
             }
             if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
-                setvhost(vhost);
+                setVirtualhost(vhost);
             }
             if (checkoptionsetting("top") || checkoptionsetting("t")) {
                 String number = optionchecker("top");
@@ -225,30 +221,6 @@
 
     }
 
-    private void setobject(String object) {
-        this.object = object;
-    }
-
-    private void setname(String name) {
-        this.name = name;
-    }
-
-    private boolean isname() {
-        if (this.name == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    private void setvhost(String vhost) {
-        this.vhost = vhost;
-    }
-
-    public String getvhost() {
-        return this.vhost;
-    }
-
     private void setnumber(String number) {
         Integer i = new Integer(number);
         this.number = i.intValue();
@@ -261,16 +233,8 @@
         return t;
     }
 
-    public String getname() {
-        return this.name;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
-
-    public int getnumber() {
-        return this.number;
+    public int getnumber()
+    {
+        return number;
     }
-
 }

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=732307&r1=732306&r2=732307&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
Wed Jan  7 03:36:41 2009
@@ -92,12 +92,6 @@
                     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");
                 }
-
-//                if(objname.getmessagecount(this.queue) < this.number)
-//                {
-//                    echo("Given number is Greater than the Queue Depth");
-//                    return;
-//                }
                 else {
                     Object[] params = {this.number};
                     String[] signature = {new String("long")};
@@ -139,25 +133,6 @@
 
                     }
                     echo(message_data);
-//                    Object keys[] = data.keySet().toArray();
-//                    CompositeData comdata = data.get(keys);
-//                    for(int i=0;i < keys.length;i++)
-//                    {
-//                        System.out.println(keys[i].toString());
-//                        CompositeData cdata = data.get(temp);
-//                        System.out.println(cdata.toString());
-//                        temp[0] = null;
-//                    }
-//                    TabularType tabular = data.getTabularType();
-////                    System.out.println(tabular.toString());
-//                   List info = tabular.getIndexNames();
-//                   Iterator it1 = info.iterator();
-//
-//                    do{
-//                            String temp1 = (String)it1.next();
-//                        System.out.println(temp1);
-//                    }while(it1.hasNext());
-
                 }
             } catch (Exception ex) {
                 echo("Given MessageId is invalid, There's no message with the given messageId");
@@ -166,7 +141,7 @@
             }
 
         } else {
-            if (isname()) {
+            if (hasName()) {
 
                 echo("The Queue you have specified is not in the current broker");
                 echo("");
@@ -187,7 +162,7 @@
                 object = optionchecker("o");
             }
             if (object.compareToIgnoreCase("queue") == 0)
-                setobject(object);
+                setObject(object);
             else {
                 unrecognizeoption();
                 echo("This command is only applicable for delete command so please start
with queue");
@@ -197,13 +172,13 @@
                 if (name == null)
                     name = optionchecker("n");
 
-                setname(name);
+                setName(name);
             }
             if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
                 String vhost = optionchecker("virtualhost");
                 if (vhost == null)
                     vhost = optionchecker("v");
-                setvhost(vhost);
+                setVirtualhost(vhost);
             }
             if (checkoptionsetting("messageid") || checkoptionsetting("id")) {
                 String number = optionchecker("id");
@@ -232,30 +207,6 @@
 
     }
 
-    private void setobject(String object) {
-        this.object = object;
-    }
-
-    private void setname(String name) {
-        this.name = name;
-    }
-
-    private boolean isname() {
-        if (this.name == null)
-            return false;
-
-        else
-            return true;
-    }
-
-    public void setvhost(String vhost) {
-        this.vhost = vhost;
-    }
-
-    public String getvhost() {
-        return this.vhost;
-    }
-
     private void setnumber(String number) {
         Integer i = new Integer(number);
         this.number = i.intValue();
@@ -268,14 +219,6 @@
         return t;
     }
 
-    public String getname() {
-        return this.name;
-    }
-
-    public String getobject() {
-        return this.object;
-    }
-
     public int getnumber() {
         return this.number;
     }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
Wed Jan  7 03:36:41 2009
@@ -44,6 +44,7 @@
 import org.junit.Test;
 import org.junit.After;
 import org.junit.Assert;
+import org.apache.qpid.Command;
 import org.apache.qpid.Connector;
 import org.apache.qpid.ConnectorFactory;
 import org.apache.qpid.ConnectionConstants;
@@ -74,7 +75,7 @@
         parser = new CommandLineOptionParser(list);
         test = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME,ConnectionConstants.BROKER_PORT);
         info = new JMXinfo(test.getConnector(),parser,test.getMBeanServerConnection());
-        cmd = new Command(info,"list");
+        cmd = new Commandinfo(info,"list");
 
     }
     @Test

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
Wed Jan  7 03:36:41 2009
@@ -79,9 +79,9 @@
     public void TestSetQueryString()
     {
          delete.execute();
-        Assert.assertEquals(delete.getobject(),"queue");
-        Assert.assertEquals(delete.getvhost(),"test");
-        Assert.assertEquals(delete.getname(),"ping");
+        Assert.assertEquals(delete.getObject(),"queue");
+        Assert.assertEquals(delete.getVirtualhost(),"test");
+        Assert.assertEquals(delete.getName(),"ping");
         Assert.assertEquals(delete.getnumber(),1);
 
     }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
Wed Jan  7 03:36:41 2009
@@ -60,7 +60,7 @@
 public class TestCommandinfo {
       JMXinfo info=null;
     String command = "info -o queue -n ping -v test";
-    Commandinfo infocommand = null;
+    CommandImpl infocommand = null;
     Connector conn = null;
     @Before
     public void startup()
@@ -77,9 +77,9 @@
     public void TestSetQueryString()
     {
         infocommand.execute();
-        Assert.assertEquals(infocommand.getobject(),"queue");
-        Assert.assertEquals(infocommand.getvirtualhost(),"test");
-        Assert.assertEquals(infocommand.getname(),"ping");
+        Assert.assertEquals(infocommand.getObject(),"queue");
+        Assert.assertEquals(infocommand.getVirtualhost(),"test");
+        Assert.assertEquals(infocommand.getName(),"ping");
     }
 
     @After

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
Wed Jan  7 03:36:41 2009
@@ -81,9 +81,9 @@
     public void TestSetQueryString()
     {
         list.execute();
-        Assert.assertEquals(list.getobject(),"queue");
-        Assert.assertEquals(list.getvhost(),"test");
-        Assert.assertEquals(list.getname(),"ping");
+        Assert.assertEquals(list.getObject(),"queue");
+        Assert.assertEquals(list.getVirtualhost(),"test");
+        Assert.assertEquals(list.getName(),"ping");
     }
 
     @After

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
Wed Jan  7 03:36:41 2009
@@ -79,8 +79,8 @@
     public void TestSetQueryString()
     {
         move.execute();
-        Assert.assertEquals(move.getobject(),"queue");
-        Assert.assertEquals(move.getvhost(),"test");
+        Assert.assertEquals(move.getObject(),"queue");
+        Assert.assertEquals(move.getVirtualhost(),"test");
         Assert.assertEquals(move.getname1(),"ping");
         Assert.assertEquals(move.getname2(),"message_queue");
         Assert.assertEquals(move.getfmid(),10);

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
Wed Jan  7 03:36:41 2009
@@ -76,9 +76,9 @@
     public void TestSetQueryString()
     {
         view.execute();
-        Assert.assertEquals(view.getobject(),"queue");
-        Assert.assertEquals(view.getvhost(),"test");
-        Assert.assertEquals(view.getname(),"ping");
+        Assert.assertEquals(view.getObject(),"queue");
+        Assert.assertEquals(view.getVirtualhost(),"test");
+        Assert.assertEquals(view.getName(),"ping");
         Assert.assertEquals(view.getnumber(),10);
 
     }

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java?rev=732307&r1=732306&r2=732307&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
Wed Jan  7 03:36:41 2009
@@ -79,11 +79,10 @@
     public void TestSetQueryString()
     {
         viewcontent.execute();
-        Assert.assertEquals(viewcontent.getobject(),"queue");
+        Assert.assertEquals(viewcontent.getObject(),"queue");
         Assert.assertEquals(viewcontent.getnumber(),10);
-        Assert.assertEquals(viewcontent.getname(),"ping");
-        Assert.assertEquals(viewcontent.getvhost(),"test");
-
+        Assert.assertEquals(viewcontent.getName(),"ping");
+        Assert.assertEquals(viewcontent.getVirtualhost(),"test");
     }
 
     @After



Mime
View raw message