incubator-kitty-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovar...@apache.org
Subject svn commit: r1299318 - in /incubator/kitty/trunk/src/main/groovy/org/apache/kitty: CmdShell.groovy command/Disconnect.groovy command/Domains.groovy command/Exit.groovy command/Ls.groovy command/Pwd.groovy command/SetDomain.groovy
Date Sun, 11 Mar 2012 00:51:33 GMT
Author: anovarini
Date: Sun Mar 11 00:51:32 2012
New Revision: 1299318

URL: http://svn.apache.org/viewvc?rev=1299318&view=rev
Log:
Added license header, extracted other commands

Added:
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Exit.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Ls.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Pwd.groovy
Modified:
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/CmdShell.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Domains.groovy
    incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/SetDomain.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=1299318&r1=1299317&r2=1299318&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:51:32
2012
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -15,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.kitty
 
 import org.apache.kitty.client.Client
@@ -25,6 +23,9 @@ import org.apache.kitty.command.Connect
 import org.apache.kitty.command.Disconnect
 import org.apache.kitty.command.SetDomain
 import org.apache.kitty.command.Domains
+import org.apache.kitty.command.Exit
+import org.apache.kitty.command.Ls
+import org.apache.kitty.command.Pwd
 
 class CmdShell {
 	Client client
@@ -203,20 +204,13 @@ class CmdShell {
 	}
 
 	void cmdExit() {
-        if (client.remote) {
-            client.disconnect()
-        }
-        ioDevice.write 'Bye'
-        ioDevice.close()
+        Command exit = new Exit(ioDevice)
+        exit.execute(client, null)
 	}
 
 	void cmdLs() {
-		if (client.remote) {
-			client.ls()
-		}
-		else {
-            ioDevice.write Constants.ERROR_NOT_CONNECTED
-		}
+        Command ls = new Ls(ioDevice)
+        ls.execute(client, null)
 	}
 
 	void cmdDomains() {
@@ -261,13 +255,8 @@ class CmdShell {
 	}
 
 	void cmdPwd() {
-		if (remote) {
-			String name = (String) client.pwd()
-            ioDevice.write name
-		}
-		else {
-            ioDevice.write Constants.ERROR_NOT_CONNECTED
-		}
+        Command pwd = new Pwd(ioDevice)
+        pwd.execute(client, null)
 	}
 
 	void cmdSetDomain(String domain) {

Modified: 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=1299318&r1=1299317&r2=1299318&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy (original)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Disconnect.groovy Sun Mar
11 00:51:32 2012
@@ -1,7 +1,24 @@
+/*
+ * 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.
+ */
 package org.apache.kitty.command
 
 import org.apache.kitty.IODevice
 import org.apache.kitty.Command
+import org.apache.kitty.client.Client
 
 class Disconnect implements Command {
     IODevice ioDevice
@@ -11,7 +28,7 @@ class Disconnect implements Command {
     }
 
     @Override
-    void execute(org.apache.kitty.client.Client client, String... args) {
+    void execute(Client client, String... args) {
         if (client.remote) {
             client.disconnect()
             if (!client.remote) {

Modified: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Domains.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Domains.groovy?rev=1299318&r1=1299317&r2=1299318&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Domains.groovy (original)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Domains.groovy Sun Mar
11 00:51:32 2012
@@ -1,8 +1,24 @@
+/*
+ * 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.
+ */
 package org.apache.kitty.command
 
 import org.apache.kitty.Command
 import org.apache.kitty.IODevice
-import org.apache.kitty.utils.Constants
+import org.apache.kitty.client.Client
 
 class Domains implements Command {
     IODevice ioDevice
@@ -12,7 +28,7 @@ class Domains implements Command {
     }
 
     @Override
-    void execute(org.apache.kitty.client.Client client, String... args) {
+    void execute(Client client, String... args) {
         def domains = client.domains()
         if (domains) {
             domains.eachWithIndex() { obj, i -> ioDevice.write " ${i}: ${obj}" }

Added: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Exit.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Exit.groovy?rev=1299318&view=auto
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Exit.groovy (added)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Exit.groovy Sun Mar 11
00:51:32 2012
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+package org.apache.kitty.command
+
+import org.apache.kitty.IODevice
+import org.apache.kitty.Command
+import org.apache.kitty.client.Client
+
+class Exit implements Command {
+    IODevice ioDevice
+
+    Exit(IODevice ioDevice) {
+        this.ioDevice = ioDevice
+    }
+
+    @Override
+    void execute(Client client, String... args) {
+        if (client.remote) {
+            client.disconnect()
+        }
+        ioDevice.write 'Bye'
+        ioDevice.close()
+    }
+}

Added: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Ls.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Ls.groovy?rev=1299318&view=auto
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Ls.groovy (added)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Ls.groovy Sun Mar 11 00:51:32
2012
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.kitty.command
+
+import org.apache.kitty.IODevice
+import org.apache.kitty.Command
+import org.apache.kitty.utils.Constants
+import org.apache.kitty.client.Client
+
+class Ls implements Command {
+    IODevice ioDevice
+
+    Ls(IODevice ioDevice) {
+        this.ioDevice = ioDevice
+    }
+
+    @Override
+    void execute(Client client, String... args) {
+        if (client.remote) {
+            client.ls()
+        }
+        else {
+            ioDevice.write Constants.ERROR_NOT_CONNECTED
+        }
+    }
+}

Added: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Pwd.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Pwd.groovy?rev=1299318&view=auto
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Pwd.groovy (added)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/Pwd.groovy Sun Mar 11 00:51:32
2012
@@ -0,0 +1,40 @@
+package org.apache.kitty.command
+/*
+ * 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.
+ */
+
+import org.apache.kitty.IODevice
+import org.apache.kitty.Command
+import org.apache.kitty.utils.Constants
+
+class Pwd implements Command {
+    IODevice ioDevice
+
+    Pwd(IODevice ioDevice) {
+        this.ioDevice = ioDevice
+    }
+
+    @Override
+    void execute(org.apache.kitty.client.Client client, String... args) {
+        if (client.remote) {
+            String name = (String) client.pwd()
+            ioDevice.write name
+        }
+        else {
+            ioDevice.write Constants.ERROR_NOT_CONNECTED
+        }
+    }
+}

Modified: incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/SetDomain.groovy
URL: http://svn.apache.org/viewvc/incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/SetDomain.groovy?rev=1299318&r1=1299317&r2=1299318&view=diff
==============================================================================
--- incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/SetDomain.groovy (original)
+++ incubator/kitty/trunk/src/main/groovy/org/apache/kitty/command/SetDomain.groovy Sun Mar
11 00:51:32 2012
@@ -1,8 +1,25 @@
+/*
+ * 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.
+ */
 package org.apache.kitty.command
 
 import org.apache.kitty.Command
 import org.apache.kitty.IODevice
 import org.apache.kitty.utils.Constants
+import org.apache.kitty.client.Client
 
 class SetDomain implements Command {
     IODevice ioDevice
@@ -12,7 +29,7 @@ class SetDomain implements Command {
     }
 
     @Override
-    void execute(org.apache.kitty.client.Client client, String... args) {
+    void execute(Client client, String... args) {
         String domain = args[0]
         if (client.remote) {
             client.domain = domain



Mime
View raw message