incubator-kitty-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovar...@apache.org
Subject svn commit: r1299313 - in /incubator/kitty/trunk/src/main/groovy/org/apache/kitty: CmdShell.groovy command/Connect.groovy command/Disconnect.groovy
Date Sun, 11 Mar 2012 00:02:28 GMT
Author: anovarini
Date: Sun Mar 11 00:02:28 2012
New Revision: 1299313

URL: http://svn.apache.org/viewvc?rev=1299313&view=rev
Log:
Moved Disconnect command

Added:
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy
Modified:
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Connect.groovy

Modified: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy?rev=1299313&r1=1299312&r2=1299313&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy (original)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy Sun Mar 11 00:02:28
2012
@@ -22,6 +22,7 @@ import org.apache.kitty.client.Client
 import org.apache.kitty.utils.Constants
 import org.apache.kitty.command.Help
 import org.apache.kitty.command.Connect
+import org.apache.kitty.command.Disconnect
 
 class CmdShell {
 	Client client
@@ -190,20 +191,13 @@ class CmdShell {
 	}
 
     void cmdConnect(String... args) {
-        Connect connect = new Connect(ioDevice)
+        Command connect = new Connect(ioDevice)
         connect.execute(client, args)
     }
 
 	void cmdDisconnect() {
-		if (client.remote) {
-			client.disconnect()
-			if (!client.remote) {
-                ioDevice.write 'Disconnected'
-			}
-		}
-		else {
-            ioDevice.write 'Not connected'
-		}
+        Command command = new Disconnect(ioDevice)
+        command.execute(client)
 	}
 
 	void cmdExit() {

Modified: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Connect.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Connect.groovy?rev=1299313&r1=1299312&r2=1299313&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Connect.groovy (original)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Connect.groovy Sun Mar
11 00:02:28 2012
@@ -4,13 +4,6 @@ import org.apache.kitty.client.Client
 import org.apache.kitty.Command
 import org.apache.kitty.IODevice
 
-/**
- * Created with IntelliJ IDEA.
- * User: ale
- * Date: 10/03/2012
- * Time: 23:43
- * To change this template use File | Settings | File Templates.
- */
 class Connect implements Command {
     static final String HOST = "localhost"
     static final String PORT = "1099"

Added: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy?rev=1299313&view=auto
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy (added)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy Sun Mar
11 00:02:28 2012
@@ -0,0 +1,25 @@
+package org.apache.kitty.command
+
+import org.apache.kitty.IODevice
+import org.apache.kitty.Command
+
+class Disconnect implements Command {
+    IODevice ioDevice
+
+    Disconnect(IODevice ioDevice) {
+        this.ioDevice = ioDevice
+    }
+
+    @Override
+    void execute(org.apache.kitty.client.Client client, String... args) {
+        if (client.remote) {
+            client.disconnect()
+            if (!client.remote) {
+                ioDevice.write 'Disconnected'
+            }
+        }
+        else {
+            ioDevice.write 'Not connected'
+        }
+    }
+}



Mime
View raw message