You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by la...@apache.org on 2008/10/07 11:07:36 UTC

svn commit: r702402 [1/4] - in /incubator/qpid/trunk/qpid/java/management/tools: ./ qpid-cli/ qpid-cli/bin/ qpid-cli/lib/ qpid-cli/src/ qpid-cli/src/org/ qpid-cli/src/org/apache/ qpid-cli/src/org/apache/qpid/ qpid-cli/src/org/apache/qpid/commands/ qpid...

Author: lahiru
Date: Tue Oct  7 02:07:34 2008
New Revision: 702402

URL: http://svn.apache.org/viewvc?rev=702402&view=rev
Log:
committing qpid-cli for the first time.

Added:
    incubator/qpid/trunk/qpid/java/management/tools/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/Guide.txt
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/LICENSE
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/NOTICE
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/README
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli   (with props)
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat   (with props)
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/build.xml
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/jline-0.9.94.jar   (with props)
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/junit-4.4.jar   (with props)
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/report.property
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandConstants.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Connector.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ConnectorFactory.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ReportGenerator.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandinfo.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandlist.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandmove.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandview.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandviewcontent.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/AllObjects.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ConnectionObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ExchangeObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/ObjectNames.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/QueueObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfiguration.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXinfo.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestObjectNames.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestQueueObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestUserManagementObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestVirtualHostObject.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOption.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOptionParser.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfigProperty.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfiguration.java
    incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXinfo.java

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/Guide.txt
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/Guide.txt?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/Guide.txt (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/Guide.txt Tue Oct  7 02:07:34 2008
@@ -0,0 +1,143 @@
+
+    * How to connect with the Broker *
+    ---------------------------------
+
+Before you come in to this state you have to build the source or you
+can get the binary and extract then set the QPID_CLI environment
+variable to the main directory of the source or binary,then only you
+are in a position to start working with management console. First
+check whether the broker is up and running. In order to simply connect
+with the broker you can run the qpid-cli script which required
+arguments.
+
+${QPID_CLI}/bin/qpid-cli -h [HostName of IP of the broker ] -p [Port
+of the broker]
+
+Default values for arguments -h [localhost] -p [8999]
+
+    * One Shot mode *
+    -----------------
+
+With one shot mode you can run interactive mode commands for one time
+and disconnect with the broker.This feature is useful when you want to
+run particular command in the management console using a script which
+is running in the normal console.What you have to do is you have to
+give the command you want to run with the qpid-cli script running
+command.
+
+Ex 1: $QPID_CLI/bin/qpid-cli queue list -- This will list the queue
+objects and disconnect.
+
+Ex 2: $QPID_CLI/bin/qpid-cli queue view -n ping - This will display
+information about all the message in the queue with the name of ping
+
+Likewise you can run any command in one shot mode and get the output
+for one time.
+
+    * Report Generation Mode *
+    -------------------------
+
+If you want to generate reports you can do it by defining your
+required information using a property file. There's a sample property
+file in the parent directory and you can have a look and get an idea
+about that.You can generate reports by giving a time interval in the
+property file. In order to start the daemon mode you have to run the
+qpid-cli script with the option : -r by giving the path for your
+property file.
+
+Ex: $QPID_CLI/bin/qpid-cli -r ../report.property
+
+You should specify a property file in order to run the daemon mode and
+get information repeatedly.
+
+    * Interactive mode with number of command *
+    -------------------------------------------
+
+This is the mode you get when you run the qpid-cli script without the
+one shot mode and without the daemon mode with [-r] option.Once you
+connect with the broker it display you a prompt [qpid-admin-$], then
+you can run several commands to can perform following tasks.
+
+For all the commands object type is command and most important command
+so you can use this option value without giving the option letter by
+giving that option value at the beginning of the command.
+
+Ex: [list -o queue ] can use this command like this dropping -o option
+[queue list]
+Ex: [list -o queue -n ping] = [queue list -n ping]
+
+    * Data displaying commands *
+    ----------------------------
+
+This is the set of commands which display the information about
+broker.
+
+list : 
+------
+list information about the given object type with limited
+number of attributes and you can use number of command options to get
+different useful behaviors with the list command.You can get the
+complete description about the command by running the command like
+this.[list -h].
+
+info :
+------ 
+list all the attributes of a given object type. This command
+works very similar way to list command. You can use -h option for help
+and get complete description of the info command.
+
+view :
+------
+view information about the content of the message in the queue
+object. In order to run this command you have to specify the object
+type at the beginning.You can give how many message informations you
+want to view from the top of the queue by using -t option.
+
+Ex : queue view -n message_queue -t 5
+[list the message info for top 5 messages in queue message_queue]
+
+viewcontent :
+-------------
+view the content of the a given message in the
+queue. You have to give the messageId as a parameter with -id option
+letters.
+
+Ex: queue viewcontent -n message_queue -id 12
+[list the content encoding and Mimetype of the message with the
+messageId for the give message which is in the queue message_queue]
+
+    * Data modification commands *
+    ------------------------------
+
+This is a set of commands which allow users to deal with messages in
+queues.Users can delete messages from a give queue and user's can move
+one message from one queue to another queue.
+
+delete :
+--------
+Using this command user can delete a give message from a given
+queue you can specify how many messages you want to delete from the
+queue from the top of the queue by using -t option.If user does not
+give how many messages to delete from the top of the queue program is
+going to delete all the messages from the queue after giving a prompt
+to confirm the deletion.
+
+Ex: queue delete -n message_queue -t 3
+[Delete top three messages in the queue message_queue ]
+
+move : 
+------
+This command allow user to move number of messages from one
+queue to another queue. First you have to specify from which queue you
+want to move messages by using -n1 and -v1 option letters(-n1 queue
+name/ -v1 virtual host).Then you have to use -n2 option to give the
+target queue name and then you have to give From messageId and To
+messageId using -fmid and -tmid option letters to specify the messages
+range you want to do the move operation.
+
+Ex: queue move -n1 message_queue -n2 ping -fmid 13 -tmid 15
+[This will move messages with the messageId range of 13-15 from queue
+message_queue to queue ping.
+
+
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/LICENSE
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/LICENSE?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/LICENSE (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/LICENSE Tue Oct  7 02:07:34 2008
@@ -0,0 +1,225 @@
+=========================================================================
+==  Apache License                                                     ==
+=========================================================================
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+     You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+  8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+=============================================================================
+== JLine (BSD) License
+=============================================================================
+Copyright (c) 2008, Apache Software Foundation
+All rights reserved.
+ 
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/NOTICE
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/NOTICE?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/NOTICE (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/NOTICE Tue Oct  7 02:07:34 2008
@@ -0,0 +1,12 @@
+Apache Qpid
+Copyright 2006-2008 Apache Software Foundation
+This product includes software developed at
+Apache Software Foundation (http://www.apache.org/)
+
+Handling console input is provided bye the Jline library package,
+JLine is a Java library for handling console input. It is similar 
+in functionality to BSD editline and GNU readline.Original software is
+available from 
+
+http://jline.sourceforge.net/index.html
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/README
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/README?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/README (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/README Tue Oct  7 02:07:34 2008
@@ -0,0 +1,64 @@
+README
+======
+
+INSTALL
+=======
+        source
+        ======  
+        1.Set the environment variable QPID_CLI	to the root directory of the repository or the release.
+       
+        2.Run these command to build the source
+
+        ant init compile
+
+        3.To launch the CLI run the script in bin folder with appropriate parameters.
+
+        ex:
+
+        Linux   $QPID_CLI/bin/qpid-cli  -h 10.8.100.122 -p 8334
+        Windows %QPID_CLI%/bin/qpid-cli.bat -h 10.8.100.122 -p 8334
+
+        -h hostname (default localhost)
+        -p broker port (default 8999)
+
+        binary
+        ======
+        1.Set the environment variable QPID_CLI	to the root directory of the repository or the release.
+
+        2.To launch the CLI run the script in bin folder with appropriate parameters.
+
+        ex:
+
+        Linux   $QPID_CLI/bin/qpid-cli  -h 10.8.100.122 -p 8334
+        Windows %QPID_CLI%/bin/qpid-cli.bat -h 10.8.100.122 -p 8334
+
+        -h hostname (default localhost)
+        -p broker port (default 8999)
+
+        3. No test cases are included in the binary version.
+
+TESTING
+=======
+
+1.Test source is located in the test directory.If you want to run the tests please start the
+Qpid java broker and run following ant targets.
+        
+        ant compile-tests       This compile all the test sources
+        ant test                This runs all the test cases
+2.If you want to test with a remote broker please use the source release and change the constants in ConnectionConstants.java
+class.(Default values are BROKER_HOSTNAME="localhost" BROKER_PORT="8999")
+
+For more informations please visit the project home page.Please feel free to report bugs and that will
+be really useful to have a good product at the end.
+          http://code.google.com/p/lahirugsoc2008/
+
+
+
+
+
+
+
+
+
+
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli Tue Oct  7 02:07:34 2008
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# 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.
+#
+# set classpath to using jar files
+for f in $QPID_CLI/lib/*.jar
+do
+  CLASSPATH=$CLASSPATH:$f
+done
+export CLASSPATH
+
+
+
+export CLASSPATH=$CLASSPATH:$QPID_CLI/build/main/classes/
+echo $CLASSPATH
+
+
+
+java -classpath $CLASSPATH org.apache.qpid.CommandLineInterpreter $@

Propchange: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat Tue Oct  7 02:07:34 2008
@@ -0,0 +1,27 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements.  See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership.  The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License.  You may obtain a copy of the License at
+@REM 
+@REM   http://www.apache.org/licenses/LICENSE-2.0
+@REM 
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied.  See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+set CLASSPATH=%CLASSPATH%;%QPID_CLI%/lib/jline-0.9.94.jar
+set CLASSPATH=%CLASSPATH%;%QPID_CLI%/lib/junit-4.4.jar
+set CLASSPATH=%CLASSPATH%;%QPID_CLI%/lib/qpid-cli-1.0.jar
+set CLASSPATH=%CLASSPATH%;%QPID_CLI%/build/main/classes/
+java -classpath %CLASSPATH% org.apache.qpid.CommandLineInterpreter %1
+
+
+
+

Propchange: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/bin/qpid-cli.bat
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/build.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/build.xml?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/build.xml (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/build.xml Tue Oct  7 02:07:34 2008
@@ -0,0 +1,73 @@
+<?xml version="1.0" ?>
+<project name="lahirugsoc2008">
+    <property name="src.dir" value="src"/>
+    <property name="build.dir" value="build"/>
+    <property name="build.src.dir" value="${build.dir}/main/"/>
+    <property name="build.test.dir" value="${build.dir}/test/"/>
+    <property name="build.src.classes.dir" value="${build.src.dir}/classes"/>
+    <property name="build.test.classes.dir" value="${build.test.dir}/classes"/>
+    <property name="jar.dir" value="${build.dir}/jar"/>
+    <property name="lib.dir" value="lib"/>
+    <property name="test.dir" value="test"/>
+    <property name="dependency1" value="jline-0.9.94.jar"/>
+    <property name="dependency2" value="junit-4.4.jar"/>
+    <property name="project.name" value="qpid-cli"/>
+    <property name="project.version" value="1.0"/>
+    <property name="target.name" value="${project.name}-${project.version}.jar"/>
+    <property name="target.jar" location="${jar.dir}/${target.name}"/>
+    <property name="build.failed" location="${build.test.dir}/results/FAILED"/>
+    <property name="test.suite" value="org.apache.qpid.AllTest"/>
+    <property name="test.report.dir" value="${build.test.dir}/reports"/>
+    <target name="init">
+        <mkdir dir="${build.src.classes.dir}" />
+        <mkdir dir="${build.test.classes.dir}"/>
+        <mkdir dir="${jar.dir}"/>
+    </target>
+    <target name="clean">
+        <delete dir="${build.src.dir}"/>
+        <delete dir="${build.test.dir}"/>
+        <delete dir="${jar.dir}"/>
+    </target>
+    <target name="compile" depends="init">
+        <javac srcdir="${src.dir}"
+               destdir="${build.src.classes.dir}">
+            <classpath>
+                <pathelement path="${lib.dir}/${dependency1}"/>
+            </classpath>
+        </javac>
+    </target>
+    <target name="compile-tests" depends="compile">
+        <javac srcdir="${test.dir}"
+               destdir="${build.test.classes.dir}"
+               debug="true"
+               includeAntRuntime="true">
+            <classpath>
+                <pathelement path="${lib.dir}/${dependency2}"/>
+                <pathelement path="${build.src.classes.dir}"/>
+            </classpath>
+        </javac>
+    </target>
+    <target name="jar" depends="compile">
+        <jar destfile="${target.jar}" duplicate="preserve"
+             compress="true">
+            <fileset dir="${build.src.classes.dir}"/>
+        </jar>
+    </target>
+    <target name="test" depends="compile-tests">
+        <junit printsummary="true">
+            <classpath>
+                <pathelement path="${build.test.classes.dir}"/>
+                <pathelement path="${build.src.classes.dir}"/>
+                <pathelement path="${lib.dir}/${dependency2}"/>
+            </classpath>
+            <formatter type="brief" usefile="false"/>
+            <test name="${test.suite}"/>
+        </junit>
+    </target>
+</project>
+
+
+
+
+
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/jline-0.9.94.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/jline-0.9.94.jar?rev=702402&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/jline-0.9.94.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/junit-4.4.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/junit-4.4.jar?rev=702402&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/lib/junit-4.4.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/report.property
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/report.property?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/report.property (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/report.property Tue Oct  7 02:07:34 2008
@@ -0,0 +1,7 @@
+object=queue
+column=Name,MessageCount,ActiveConsumerCount,Durable
+filter.name=ping
+filter.virtualhost=test
+output=csv
+seperator=|
+interval=1

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Command.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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;
+
+import org.apache.qpid.utils.CommandLineOption;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: May 29, 2008
+ * Time: 9:21:46 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface
+        Command {
+
+    public static String commandname = null;
+    public static CommandLineOption options = null;
+
+    void execute();
+
+    void printusage();
+
+    void optionchecker();
+
+    void optionvaluechecker();
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandConstants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandConstants.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandConstants.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandConstants.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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;
+
+public interface CommandConstants {
+
+    String LIST_COMMAND = "list";
+    String INFO_COMMAND = "info";
+    String HELP_COMMAND = "help";
+    String DELETE_COMMAND = "delete";
+    String MOVE_COMMAND = "move";
+    String VIEW_COMMAND = "view";
+    String VIEWCONTENT_COMMAND = "viewcontent";
+
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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;
+
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.commands.*;
+import org.apache.qpid.commands.Command;
+
+
+public class CommandExecusionEngine {
+    private Command currentcommand = null;
+    private String commandname = null;
+    private JMXinfo info = null;
+
+    public CommandExecusionEngine(JMXinfo info) {
+        this.info = info;
+        this.commandname = info.getCommandLineOptionParser().getcommandname();
+    }
+
+    public boolean CommandSelector() {
+
+        if (CommandConstants.INFO_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandinfo(info, this.commandname);
+        else if (CommandConstants.LIST_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandlist(info, this.commandname);
+        else if (CommandConstants.HELP_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandhelp(info, this.commandname);
+        else if (CommandConstants.DELETE_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commanddelete(info, this.commandname);
+        else if (CommandConstants.MOVE_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandmove(info, this.commandname);
+        else if (CommandConstants.VIEW_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandview(info, this.commandname);
+        else if (CommandConstants.VIEWCONTENT_COMMAND.equalsIgnoreCase(this.commandname))
+            currentcommand = new Commandviewcontent(info, this.commandname);
+        else {
+            usage();
+            return false;
+        }
+        return true;
+
+
+    }
+
+    public void runcommand() {
+        currentcommand.execute();
+    }
+
+    public void usage() {
+        System.out.println(commandname + ":Command not found");
+    }
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,194 @@
+/*
+ *
+ * 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;
+
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXConfiguration;
+import org.apache.qpid.utils.JMXinfo;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.naming.ServiceUnavailableException;
+import java.io.PrintWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.Properties;
+import java.rmi.ConnectException;
+
+import jline.ConsoleReader;
+import jline.ArgumentCompletor;
+import jline.SimpleCompletor;
+
+
+public class CommandLineInterpreter {
+    public static void main(String[] args) {
+        Connector conn = null;
+        try {
+            // Create an RMI connector client and
+            // connect it to the RMI connector server
+
+            /*checking the commandline options and
+            parse them in to config method */
+            JMXConnector jmxc = null;
+            MBeanServerConnection mbsc = null;
+            ConsoleReader reader = new ConsoleReader();
+            reader.setBellEnabled(false);
+            CommandLineOptionParser commandlineoptionparser = null;
+
+            if ((args == null) || (args.length) == 0) {
+                Usage();
+            }
+            /* here special constructor is calling, when parsing options,in here first option value is starting from minus sign
+              so this is handle by a special constructor */
+            else {
+                if (args[0].startsWith("-")) {
+                    commandlineoptionparser = new CommandLineOptionParser(args, args[0]);     // if user specify any argument with the qpid-cli script
+                }
+            }
+
+            /* Connecting with the broker */
+//            commandlineoptionparser = new CommandLineOptionParser(args);
+//            JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
+            try {
+                if (commandlineoptionparser == null)
+                    commandlineoptionparser = new CommandLineOptionParser(args);
+
+                JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions());
+                conn = ConnectorFactory.getConnector(config.gethostname(), config.getport());
+                jmxc = conn.getConnector();
+                mbsc = conn.getMBeanServerConnection();
+                if (config.checkoptionsetting("r", commandlineoptionparser.getAlloptions())) {
+                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
+                    ReportGenerator reportgen = new ReportGenerator(config.optionchecker("r", commandlineoptionparser.getAlloptions()), info);
+                    reportgen.loadproperties();
+                    reportgen.run();
+                }
+                /* This implementation is for the people who are using the interactive
+                mode for one shot this run the user given command and exit */
+                for (int i = 0; i < args.length; i++) {
+                    if (args[i].compareTo("list") == 0 || args[i].compareTo("info") == 0 || args[i].compareTo("view") == 0 || args[i].compareTo("viewcontent") == 0
+                            || args[i].compareTo("delete") == 0 || args[i].compareTo("move") == 0) {
+                        oneshotmode(args,commandlineoptionparser,jmxc,mbsc);
+
+                        return;
+                    }
+                }
+            } catch (Exception ex) {
+                connectionrefuse();
+                return;
+            }
+            /* In this point connection has been established */
+            String line;
+            String[] command;
+
+            /* prividing GNU readline features using Jline library */
+            //String list = "list";
+            PrintWriter out = new PrintWriter(System.out);
+            reader.addCompletor(new ArgumentCompletor(
+                    new SimpleCompletor(new String[]{"list", "info", "exit", "quit", "delete", "move", "view", "viewcontent", "queue", "exchange", "connection", "usermanagement", "virtualhost"})));
+            while ((line = reader.readLine("qpid-admin-$ ")) != null) {
+                out.flush();
+                if (removeSpaces(line).equalsIgnoreCase("quit") || removeSpaces(line).equalsIgnoreCase("exit"))
+                    break;
+                else if (line.length() == 0)
+                    continue;
+                else {
+                    command = line.split("\\s+");
+                    commandlineoptionparser = new CommandLineOptionParser(command);
+                    JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
+                    CommandExecusionEngine engine = new CommandExecusionEngine(info);
+                    if (engine.CommandSelector())
+                        engine.runcommand();
+                }
+            }
+            conn.getConnector().close();
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    private static void Usage() {
+        System.out.println("Connecting to localhost Qpid java broker...");
+    }
+
+    private static String removeSpaces(String s) {
+        StringTokenizer st = new StringTokenizer(s, " ", false);
+        String t = "";
+        while (st.hasMoreElements()) t += st.nextElement();
+        return t;
+    }
+
+    private static void connectionrefuse() {
+        System.out.println("Cannot connect with the broker in given host with given port");
+        System.out.println("Please check the host name and the port given");
+    }
+
+    private static void commandlineerror() {
+        System.out.println("Please run the script again and try to connect to broker again");
+    }
+    public static String[] oneshotmode(String[] args,CommandLineOptionParser commandlineoptionparser,JMXConnector jmxc,MBeanServerConnection mbsc)
+    {
+        int check = 0;
+        String [] temp;
+        for (int i = 0; i < args.length; i++) {
+
+            if (args[i].compareTo("-h") == 0)
+                check++;
+            else if (args[i].compareTo("-p") == 0)
+                check++;
+        }
+        for (int i = 0; i < (args.length - 2 * check); i++) {     // mulitply by 2 because have to remove the option letter with the option value//
+            args[i] = args[i + check * 2];
+        }
+
+        commandlineoptionparser = new CommandLineOptionParser(args);           //change the args string array which works as interactive mode//
+        JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc);
+        CommandExecusionEngine engine = new CommandExecusionEngine(info);
+        if (engine.CommandSelector())
+            engine.runcommand();
+        return args;
+
+    }
+}
+

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Connector.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Connector.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Connector.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/Connector.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnectorFactory;
+import java.io.IOException;
+
+
+public class Connector {
+    private JMXServiceURL url = null;
+    private JMXConnector jmxc = null;
+    private MBeanServerConnection mbsc = null;
+
+
+    public Connector(JMXServiceURL url, JMXConnector jmxc, MBeanServerConnection mbsc) {
+
+
+        this.url = url;
+        this.jmxc = jmxc;
+        this.mbsc = mbsc;
+
+
+    }
+
+    public JMXServiceURL getURL() {
+        return url;
+    }
+
+    public JMXConnector getConnector() {
+        return jmxc;
+    }
+
+    public MBeanServerConnection getMBeanServerConnection() {
+        return mbsc;
+    }
+
+
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ConnectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ConnectorFactory.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ConnectorFactory.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ConnectorFactory.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,72 @@
+/*
+ *
+ * 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;
+
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jul 3, 2008
+ * Time: 10:51:28 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ConnectorFactory {
+
+    public static Connector getConnector(String host, String port) {
+
+        String url_string = "service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi";
+        JMXServiceURL url;
+        JMXConnector jmxc;
+        MBeanServerConnection mbsc;
+        try {
+            url = new JMXServiceURL(url_string);
+            jmxc = JMXConnectorFactory.connect(url, null);
+            mbsc = jmxc.getMBeanServerConnection();
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null; //To change body of catch statement use File | Settings | File Templates.
+        }
+        return new Connector(url, jmxc, mbsc);
+    }
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ReportGenerator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ReportGenerator.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ReportGenerator.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/ReportGenerator.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,180 @@
+/*
+ *
+ * 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;
+
+import org.apache.qpid.commands.objects.*;
+import org.apache.qpid.utils.JMXinfo;
+
+import javax.management.MBeanServerConnection;
+import java.util.*;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 12, 2008
+ * Time: 4:03:21 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ReportGenerator implements Runnable {
+
+    String[] propertyname = {"object", "column", "filter.name", "filter.virtualhost", "output", "seperator", "interval"};
+    String[] propertyvalue = null;
+    String propertyfilepath = null;
+    String[] columnvalue = null;
+    List<String> columns = null;
+    Properties props = null;
+    JMXinfo info = null;
+    int interval = 10;
+
+    public void run() {
+        for (; ;)  // creating infinite loop
+        {
+            generatereport();
+            try {
+                Thread.sleep(this.interval * 60000);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+
+    public ReportGenerator(String propfile, JMXinfo info) {
+        this.propertyfilepath = propfile;
+        props = new Properties();
+        propertyvalue = new String[propertyname.length];
+        this.info = info;
+        columns = new ArrayList<String>();
+    }
+
+    public void loadproperties()                                  // get all the property file values and set the columen values//
+    {
+        try {
+
+            props.load(new FileInputStream(this.propertyfilepath));
+            for (int i = 0; i < propertyname.length; i++) {
+                propertyvalue[i] = props.getProperty(propertyname[i]);
+            }
+            this.setcolumnvalues();
+            this.setinterval();
+        }
+
+        //catch exception in case properties file does not exist
+
+        catch (IOException e) {
+            System.out.println("Oooops Give property file is not exist");
+        }
+    }
+
+    public void generatereport() {
+        this.listobjects(propertyvalue[0]);
+    }
+
+    private void setcolumnvalues() {
+        columnvalue = propertyvalue[1].split(",");
+        for (int i = 0; i < columnvalue.length; i++) {
+            columns.add(columnvalue[i]);
+        }
+    }
+
+    private void setinterval() {
+        this.interval = (new Integer(propertyvalue[6])).intValue();
+    }
+
+    private void listobjects(String option_value) {
+        /*pring usage if use is not give the correct option letter or no options */
+        if (option_value == null) {
+//            System.out.println("testing");
+            return;
+        }
+        MBeanServerConnection mbsc = info.getmbserverconnector();
+        Set set = null;
+        ObjectNames objname = null;
+
+        try {
+            if (option_value.compareToIgnoreCase("queue") == 0 || option_value.compareToIgnoreCase("queues") == 0) {
+                objname = new QueueObject(mbsc);
+
+            } else
+            if (option_value.compareToIgnoreCase("Virtualhosts") == 0 || option_value.compareToIgnoreCase("Virtualhost") == 0) {
+                objname = new VirtualHostObject(mbsc);
+//                this.name = option_value;
+            } else
+            if (option_value.compareToIgnoreCase("Exchange") == 0 || option_value.compareToIgnoreCase("Exchanges") == 0) {
+                objname = new ExchangeObject(mbsc);
+//                this.name = option_value;
+            } else
+            if (option_value.compareToIgnoreCase("Connection") == 0 || option_value.compareToIgnoreCase("Connections") == 0) {
+                objname = new ConnectionObject(mbsc);
+//                this.name = option_value;
+            } else if (option_value.compareToIgnoreCase("all") == 0) {
+                objname = new AllObjects(mbsc);
+//                this.name = option_value;
+            } else
+            if (option_value.compareToIgnoreCase("Usermanagement") == 0 || option_value.compareToIgnoreCase("Usermanagmenets") == 0) {
+                objname = new UserManagementObject(mbsc);
+//                this.name = option_value;
+            } else {
+                printusage();
+                echo("Wrong objectName");
+                return;
+            }
+            objname.setQueryString(this.propertyvalue[0], this.propertyvalue[2], this.propertyvalue[3]);
+            objname.returnObjects();
+            if (objname.getSet().size() != 0) {
+                objname.reportgenerator(this.propertyvalue[4], this.propertyvalue[5], columns);
+            } else {
+                printusage();
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+
+    }
+
+    public void echo(String str) {
+        System.out.println(str);
+    }
+
+    public void printusage() {
+        System.out.println("Wrong option or wrong option value");
+    }
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Command.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOption;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+import java.util.Map;
+
+
+public class Command {
+    public JMXinfo info = null;
+    public String commandname = null;
+
+
+    public Command(JMXinfo info, String name) {
+        this.info = info;
+        this.commandname = name;
+    }
+
+    public Command() {
+
+    }
+
+    public void execute() {
+
+
+    }
+
+    public void printusage() {
+    }
+
+
+    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 optionvaluechecker() {
+
+    }
+
+    public void echo(String str) {
+        System.out.println(str);
+    }
+
+    public void unrecognizeoption() {
+        echo("list: Unrecognized option");
+        echo("Try `" + this.commandname + " --help` for more information");
+    }
+
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commanddelete.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,228 @@
+/*
+ *
+ * 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.utils.JMXinfo;
+import org.apache.qpid.commands.objects.*;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanInfo;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 6, 2008
+ * Time: 5:34:51 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Commanddelete extends Command {
+    private String object;
+    private String name;
+    private String vhost;
+    private int number = 0;
+    private QueueObject objname;
+    private MBeanServerConnection mbsc;
+    private String method1, method2;
+    private ObjectName queue;
+
+    public Commanddelete(JMXinfo info, String name) {
+        super(info, name);
+        this.mbsc = info.getmbserverconnector();
+        this.objname = new QueueObject(mbsc);
+        this.method1 = "deleteMessageFromTop";
+        this.method2 = "clearQueue";
+
+    }
+
+    public void deletemessages() {
+        Set set = null;
+        objname.setQueryString(this.object, this.name, this.vhost);
+        set = objname.returnObjects();
+
+        if (objname.getSet().size() != 0) {
+            Iterator it = set.iterator();
+            this.queue = (ObjectName) it.next();
+            try {
+                if (this.number == 0) {
+                    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);
+                    String s = br.readLine();
+                    echo(s);
+                    if (s.compareToIgnoreCase("y") == 0)
+                        this.mbsc.invoke(queue, this.method2, null, null);
+                    else
+                        return;
+                } else if (objname.getmessagecount(this.queue) < this.number) {
+                    echo("Given number is Greater than the Queue Depth");
+                    return;
+                } else {
+                    for (int i = 0; i < this.number; i++) {
+                        this.mbsc.invoke(queue, this.method1, null, null);
+                    }
+                }
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+
+        } else {
+            if (isname()) {
+
+                echo("The Queue you have specified is not in the current broker");
+                echo("");
+            } 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
+         */
+
+        if (checkoptionsetting("object") || checkoptionsetting("o")) {
+            String object = optionchecker("object");
+            if (object == null) {
+                object = optionchecker("o");
+            }
+            if (object.compareToIgnoreCase("queue") == 0)
+                setobject(object);
+            else {
+                unrecognizeoption();
+                echo("This command is only applicable for delete command so please start with queue");
+            }
+            if (checkoptionsetting("name") || checkoptionsetting("n")) {
+                String name = optionchecker("name");
+                if (name == null)
+                    name = optionchecker("n");
+
+                setname(name);
+            }
+            if (checkoptionsetting("virtualhost") || checkoptionsetting("v")) {
+                String vhost = optionchecker("virtualhost");
+                if (vhost == null)
+                    vhost = optionchecker("v");
+                setvhost(vhost);
+            }
+            if (checkoptionsetting("top") || checkoptionsetting("t")) {
+                String number = optionchecker("top");
+                if (number == null)
+                    number = optionchecker("t");
+
+                setnumber(removeSpaces(number));
+            }
+            this.deletemessages();
+        } else if (checkoptionsetting("h") || checkoptionsetting("help"))
+            printusage();
+        else
+            unrecognizeoption();
+    }
+
+    public void printusage() {
+        echo("");
+        echo("Usage:delete [OPTION] ... [OBJECT TYPE]...\n");
+        echo("Delete the top most messages from the given queue object\n");
+        echo("To specify the desired queue you have to give the virtualhost name and the queue name with following commands\n");
+        echo("Where possible options include:\n");
+        echo("        -v      --virtualhost Give the virtuallhost name of the desired queue");
+        echo("        -n      --name        Give the queue name of the desired queue you want to do the delete operation");
+        echo("        -t      --top         Give how many number of messages you want to delete from the top (Default = all the messages will be deleted");
+        echo("        -h      --help        Display the help and back to the qpid-cli prompt\n");
+
+    }
+
+    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();
+    }
+
+    public int getnumber() {
+        return this.number;
+    }
+
+    private static String removeSpaces(String s) {
+        StringTokenizer st = new StringTokenizer(s, " ", false);
+        String t = "";
+        while (st.hasMoreElements()) t += st.nextElement();
+        return t;
+    }
+
+}

Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/Commandhelp.java Tue Oct  7 02:07:34 2008
@@ -0,0 +1,73 @@
+/*
+ *
+ * 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.utils.JMXinfo;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jul 6, 2008
+ * Time: 5:55:28 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class Commandhelp extends Command {
+    public Commandhelp(JMXinfo info, String name) {
+        super(info, name);
+    }
+
+    public void execute() {
+        displayhelp();
+    }
+
+    private void displayhelp() {
+        echo("");
+        echo("Current version of qpid CLI is supporting following commands");
+        echo("");
+        echo("[list]    This command is listing limited information about a given type of object");
+        echo("          For more information about list command run `list --help`");
+        echo("[info]    This command is listing All the information about a given type of object");
+        echo("          For more information about list command run `info --help`");
+
+        echo("");
+        echo("[exit]    This command is disconnect the connection with the Qpid Java broker and go back to normal propmt");
+        echo("[quit]    This command is disconnect the connection with the Qpid Java broker and go back to normal propmt");
+        echo("");
+    }
+}