net.ponder2
Class Shell

java.lang.Object
  extended by net.ponder2.Shell
All Implemented Interfaces:
java.lang.Runnable

public class Shell
extends java.lang.Object
implements java.lang.Runnable

The shell is responsible for all the interactions with an interactive user. The shell parses commands, converts them into XML structures and sends them to managed objects to be executed.

Version:
$Id: Shell.java 762 2008-05-22 22:17:15Z Kevin Twidle $
Author:
Kevin Twidle

Method Summary
static int initialise(P2Object root, int port, boolean multipleSMCs)
          instantiates and sets the shell up to receive connections on the given port.
 void run()
           
static java.net.ServerSocket setup(int port)
          opens and binds the server-socket channel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initialise

public static int initialise(P2Object root,
                             int port,
                             boolean multipleSMCs)
instantiates and sets the shell up to receive connections on the given port. The shell is run as a separate thread.

Parameters:
root - the root domain for this SMC
port - the preferred IP port number to listen on for connections
Returns:
the actual IP port number that was opened for connections

run

public void run()
Specified by:
run in interface java.lang.Runnable

setup

public static java.net.ServerSocket setup(int port)
                                   throws java.io.IOException
opens and binds the server-socket channel

Parameters:
port - the IP port number to be opened
Returns:
the new socket channel
Throws:
java.io.IOException - if the port is not available


Copyright © 2008 Imperial College. All Rights Reserved.