Author: pidster
Date: Wed Jun  8 21:39:11 2011
New Revision: 1133566

URL: http://svn.apache.org/viewvc?rev=1133566&view=rev
Log:
reduce 3 connect methods to 1, using varargs

Modified:
    incubator/kitty/trunk/build.gradle
    incubator/kitty/trunk/src/main/java/org/apache/kitty/CmdShell.groovy
    
incubator/kitty/trunk/src/main/java/org/apache/kitty/client/jmxmp/JMXMPClient.groovy
    incubator/kitty/trunk/src/main/resources/Kitty.properties

Modified: incubator/kitty/trunk/build.gradle
URL: 
http://svn.apache.org/viewvc/incubator/kitty/trunk/build.gradle?rev=1133566&r1=1133565&r2=1133566&view=diff
==============================================================================
--- incubator/kitty/trunk/build.gradle (original)
+++ incubator/kitty/trunk/build.gradle Wed Jun  8 21:39:11 2011
@@ -70,8 +70,6 @@ dependencies {
        testCompile group: 'junit', name: 'junit', version: "$junitVersion"
 }
 
-configurations.runtime.each { File f -> println f }
-
 // --------------------------------------------------------------------
 // java plugin config
 
@@ -101,10 +99,6 @@ jar {
        }
 }
 
-check {
-       
-}
-
 // --------------------------------------------------------------------
 // application plugin config
 
@@ -117,6 +111,10 @@ distZip {
 // --------------------------------------------------------------------
 // task definitions
 
+task docs(dependsOn: ["groovydoc", "javadoc"]) {
+    //
+}
+
 task checkstyle(type: Checkstyle) << {
        source = 'src/main/java'
 }

Modified: incubator/kitty/trunk/src/main/java/org/apache/kitty/CmdShell.groovy
URL: 
http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/java/org/apache/kitty/CmdShell.groovy?rev=1133566&r1=1133565&r2=1133566&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/java/org/apache/kitty/CmdShell.groovy 
(original)
+++ incubator/kitty/trunk/src/main/java/org/apache/kitty/CmdShell.groovy Wed 
Jun  8 21:39:11 2011
@@ -28,6 +28,7 @@ import org.apache.kitty.client.Client
 import org.apache.kitty.utils.Constants
 import org.apache.kitty.utils.Help
 
+
 /**
  * <pre>
  * <b>Description</b>
@@ -74,7 +75,6 @@ class CmdShell {
                // TODO Auto-generated constructor stub
        }
 
-
        static main(args) {
                startShell()
        }
@@ -84,7 +84,7 @@ class CmdShell {
                client = new Client()
 
                // TODO add Windows compatibility check
-               def historyFile = new File(System.getProperty("user.home"), 
".kitty.history")
+               def historyFile = new File(System.getProperty("user.home"), 
"kitty.history")
                historyFile.createNewFile()
                
                def history = new History(historyFile)
@@ -130,8 +130,7 @@ class CmdShell {
                        index = commands.indexOf(input)
                        //println "The index is" + index
 
-                       switch(index)
-                       {
+                       switch(index) {
                                case 0:
                                        cmdHelp()
                                        break;
@@ -237,57 +236,23 @@ class CmdShell {
                println h.toString()
        }
 
-
-       static cmdConnect() {
-               def _host = HOST
-               def _port = PORT
-               println "connecting to $_host at port $_port...."
-               getClient().connect(HOST, PORT)
-               if (getClient().getRemote()) {
-                       println "Successfully connected to host"
-                       remote = getClient().getRemote()
-               }
-               else {
-                       println "Connection attempt was unsuccessful"
-               }
-       }
-
-       static cmdConnect(_host) {
-               def _port = PORT
-               getClient().connect(_host, PORT)
-               println "connecting to $_host at port $_port...."
-               if (getClient().getRemote()) {
-                       println "Successfully connected to host"
-                       remote = getClient().getRemote()
-               }
-               else {
-                       println "Connection attempt was unsuccessful"
-               }
-       }
-
-       static cmdConnect(_host, _port) {
-               println "connecting to $_host at port $_port...."
-               getClient().connect(_host, _port)
-               if (getClient().getRemote()) {
-                       println "Successfully connected to host"
-                       remote = getClient().getRemote()
-               }
-               else {
-                       println "Connection attempt was unsuccessful"
-               }
-       }
-
-       static cmdConnect(_host, _port, _username, _password) {
-               println "connecting with $_username to $_host at port 
$_port...."
-               getClient().connect(_host, _port, _username, _password)
-               if (getClient().getRemote()) {
-                       println "Successfully connected to host"
-                       remote = getClient().getRemote()
-               }
-               else {
-                       println "Connection attempt was unsuccessful"
-               }
-       }
+    static cmdConnect(String... args) {
+        def host = args.length > 1 ? args[0] : HOST
+        def port = args.length > 2 ? args[1] : PORT
+        if (args?.length == 4) {
+            getClient().connect(host, port, args[2], args[3])
+        }
+        else {
+            getClient().connect(host, port)
+        }
+        this.remote = getClient().getRemote()
+        if (this.remote) {
+            println "Successfully connected to host"
+        }
+        else {
+            println "Connection attempt was unsuccessful"
+        }
+    }
 
        static cmdDisconnect() {
                println "disconnecting..."

Modified: 
incubator/kitty/trunk/src/main/java/org/apache/kitty/client/jmxmp/JMXMPClient.groovy
URL: 
http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/java/org/apache/kitty/client/jmxmp/JMXMPClient.groovy?rev=1133566&r1=1133565&r2=1133566&view=diff
==============================================================================
--- 
incubator/kitty/trunk/src/main/java/org/apache/kitty/client/jmxmp/JMXMPClient.groovy
 (original)
+++ 
incubator/kitty/trunk/src/main/java/org/apache/kitty/client/jmxmp/JMXMPClient.groovy
 Wed Jun  8 21:39:11 2011
@@ -23,6 +23,7 @@ import javax.management.remote.JMXServic
 
 import org.apache.kitty.client.Client
 
+
 /**
  * <pre>
  * <b>Description</b>

Modified: incubator/kitty/trunk/src/main/resources/Kitty.properties
URL: 
http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/resources/Kitty.properties?rev=1133566&r1=1133565&r2=1133566&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/resources/Kitty.properties (original)
+++ incubator/kitty/trunk/src/main/resources/Kitty.properties Wed Jun  8 
21:39:11 2011
@@ -0,0 +1 @@
+title=Apache Kitty (Incubating)
\ No newline at end of file


Reply via email to