Revision: 16047
Author: [email protected]
Date: Fri Dec 24 23:46:40 2010
Log: [No log message]
http://code.google.com/p/mobicents/source/detail?r=16047

Modified:
/trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Console.java /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/ConsoleListenerImpl.java /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Shell.java

=======================================
--- /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Console.java Fri Dec 24 21:11:00 2010 +++ /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Console.java Fri Dec 24 23:46:40 2010
@@ -17,7 +17,7 @@
     private final InputStream in;
     private final Scanner scanner;

-    private final String prefix;
+    private String prefix;

     private boolean stopped = false;

@@ -55,6 +55,10 @@
             }
         }
     }
+
+    public void setPrefix(String prefix) {
+        this.prefix = prefix;
+    }

     private void addPrefix() {
         if (this.prefix != null) {
=======================================
--- /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/ConsoleListenerImpl.java Fri Dec 24 21:11:00 2010 +++ /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/ConsoleListenerImpl.java Fri Dec 24 23:46:40 2010
@@ -48,6 +48,8 @@
                 // use default
                 try {
                     client.connect(new InetSocketAddress(address, port));
+                    console.setPrefix(Shell.CLI_PREFIX + "(local)"
+                            + Shell.CLI_POSTFIX);
                 } catch (IOException e) {
                     console.write(e.getMessage());
                 }
@@ -57,6 +59,8 @@

                 try {
                     client.connect(new InetSocketAddress(address, port));
+                    this.console.setPrefix(Shell.CLI_PREFIX + "(" + address
+                            + ")" + Shell.CLI_POSTFIX);
                 } catch (IOException e) {
                     console.write(e.getMessage());
                 }
@@ -83,14 +87,15 @@
                 this.console.write(incoming.toString());
             } else {
                 this.console.write("No response from server");
-            }
+            }
         } catch (IOException e) {
             this.console.write(e.getMessage());
             this.console.stop();
         }
-
-        if(text.compareTo("disconnect")==0){
+
+        if (text.compareTo("disconnect") == 0) {
             this.client.stop();
+            this.console.setPrefix(Shell.CLI_PREFIX + Shell.CLI_POSTFIX);
         }
     }

=======================================
--- /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Shell.java Fri Dec 24 21:11:00 2010 +++ /trunk/protocols/ss7/management/shell/src/main/java/org/mobicents/protocols/ss7/management/console/Shell.java Fri Dec 24 23:46:40 2010
@@ -15,7 +15,8 @@

public static final String CONNECTED_MESSAGE = "Connected to %s currently running on %s";

-    public static final String cliPrefix = "mobicents>";
+    public static final String CLI_PREFIX = "mobicents";
+    public static final String CLI_POSTFIX = ">";

     private final ConsoleListener listener;
     private final Console console;
@@ -33,7 +34,7 @@

     public Shell() throws Exception {
         listener = new ConsoleListenerImpl();
-        console = new Console(in, out, listener, cliPrefix);
+        console = new Console(in, out, listener, CLI_PREFIX + CLI_POSTFIX);
     }

     public static void main(String args[]) throws Exception {
@@ -64,6 +65,5 @@

         console.start();
     }
-

 }

Reply via email to