You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/11/02 09:20:31 UTC
svn commit: r709849 - in /geronimo/gshell/trunk/gshell-remote:
gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/
gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/
gshell-remote-server/src/mai...
Author: jdillon
Date: Sun Nov 2 01:20:31 2008
New Revision: 709849
URL: http://svn.apache.org/viewvc?rev=709849&view=rev
Log:
Tidy
Modified:
geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteCompleterProxy.java
geronimo/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CompleteMessage.java
geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CompleteHandler.java
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteCompleterProxy.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteCompleterProxy.java?rev=709849&r1=709848&r2=709849&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteCompleterProxy.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/proxy/RemoteCompleterProxy.java Sun Nov 2 01:20:31 2008
@@ -29,20 +29,23 @@
*
* @version $Rev: 580765 $ $Date: 2007-09-30 20:52:39 +0200 (Sun, 30 Sep 2007) $
*/
-public class RemoteCompleterProxy implements Completor {
-
+public class RemoteCompleterProxy
+ implements Completor
+{
private final RshClient client;
- public RemoteCompleterProxy(RshClient client) {
+ public RemoteCompleterProxy(final RshClient client) {
assert client != null;
this.client = client;
}
- public int complete(String buffer, int cursor, List candidates) {
+ public int complete(final String buffer, final int cursor, final List candidates) {
try {
+ //noinspection unchecked
return client.complete(buffer, cursor, candidates);
- } catch (Exception e) {
+ }
+ catch (Exception e) {
return -1;
}
}
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CompleteMessage.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CompleteMessage.java?rev=709849&r1=709848&r2=709849&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CompleteMessage.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CompleteMessage.java Sun Nov 2 01:20:31 2008
@@ -29,12 +29,11 @@
public class CompleteMessage
extends RshMessage
{
-
private final String buffer;
private final int cursor;
- public CompleteMessage(String buffer, int cursor) {
+ public CompleteMessage(final String buffer, final int cursor) {
this.buffer = buffer;
this.cursor = cursor;
}
@@ -54,9 +53,10 @@
extends RshMessage
{
private final List<String> candidates;
+
private final int position;
- public Result(final List<String> candidates, int position) {
+ public Result(final List<String> candidates, final int position) {
this.candidates = candidates;
this.position = position;
}
Modified: geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CompleteHandler.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CompleteHandler.java?rev=709849&r1=709848&r2=709849&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CompleteHandler.java (original)
+++ geronimo/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CompleteHandler.java Sun Nov 2 01:20:31 2008
@@ -19,27 +19,30 @@
package org.apache.geronimo.gshell.remote.server.handler;
-import java.util.List;
-import java.util.Iterator;
-import java.util.ArrayList;
-
+import jline.Completor;
import org.apache.geronimo.gshell.remote.message.CompleteMessage;
-import org.apache.geronimo.gshell.remote.message.CloseShellMessage;
import org.apache.geronimo.gshell.remote.server.RemoteShellImpl;
-import org.apache.geronimo.gshell.whisper.transport.Session;
+import org.apache.geronimo.gshell.shell.Shell;
import org.apache.geronimo.gshell.shell.ShellContext;
import org.apache.geronimo.gshell.shell.ShellContextHolder;
-import org.apache.geronimo.gshell.shell.Shell;
-import jline.Completor;
+import org.apache.geronimo.gshell.whisper.transport.Session;
-public class CompleteHandler
- extends ServerMessageHandlerSupport<CompleteMessage> {
+import java.util.ArrayList;
+import java.util.List;
+/**
+ * Server handler for {@link CompleteMessage} messages.
+ *
+ * @version $Rev: 706033 $ $Date: 2008-10-19 22:36:15 +0700 (Sun, 19 Oct 2008) $
+ */
+public class CompleteHandler
+ extends ServerMessageHandlerSupport<CompleteMessage>
+{
public CompleteHandler() {
super(CompleteMessage.class);
}
- public void handle(Session session, ServerSessionContext context, CompleteMessage message) throws Exception {
+ public void handle(final Session session, final ServerSessionContext context, final CompleteMessage message) throws Exception {
assert session != null;
assert context != null;
assert message != null;
@@ -53,10 +56,9 @@
try {
Shell shell = context.shellContext.getShell();
if (shell instanceof RemoteShellImpl) {
- List<Completor> completors = ((RemoteShellImpl) shell).getCompleters();
- for (Iterator i = completors.iterator(); i.hasNext();) {
- Completor comp = (Completor) i.next();
- if ((position = comp.complete(message.getBuffer(), message.getCursor(), candidates)) != -1) {
+ List<Completor> completors = ((RemoteShellImpl)shell).getCompleters();
+ for (Completor completor : completors) {
+ if ((position = completor.complete(message.getBuffer(), message.getCursor(), candidates)) != -1) {
break;
}
}