com.agentfactory.platform
Class InitialisationManager
java.lang.Object
com.agentfactory.platform.InitialisationManager
public class InitialisationManager
- extends java.lang.Object
This is the main entry point for the Agent Factory Framework.
An instance of the AgentPlatform class is created. The AgentPlatform class,
along with an AgentContainer, basic services, and input reading systems
comprise the core functionality.
The platform must be initialised with an explicit platform configuration
file. One global configuration file is not used since it may be useful to run
multiple instances of the platform on the same physical platform. If no
configuration file is specified, the class will NOT check any default
locations since those locations are likely to live outside the agent factory
class structure. Instead, start-up scripts may like to provide the address
of a default configuration file on a particular platform.
The default operational mode of the Agent Factory Framework is a command line
driven. Alternativly, command line options can be specified at start-up to
turn the platform into a script driven, or server based platform:
a) -script
b) -port
An out parameter can be used to set the system out. The out parameter takes
the name of a file to which system.out will be directed, e.g.:
-out
This class is implemented as a singleton to allow all agent factory classes
to have a single point of entry in gettng access to the agent platform
object.
Note, by default, the platform runs with no GUI; If a GUI is required, the
platform configuration file should specify one.
|
Method Summary |
static InitialisationManager |
getInstance()
A singleton access method. |
AgentPlatform |
getPlatform()
Get a reference to the AgentPlatform object. |
void |
initialise(java.lang.String[] inArgs)
Initialise the IniatialisationMethod. |
java.net.Socket |
initialiseNetworkInterface(int portNumber)
Initialise a network command interface on a given port number. |
static void |
main(java.lang.String[] args)
This is the method that starts all methods!!! An instance of the
initialisation class will be created and used to parse the command
line parameters. |
void |
parseParameters()
Process the input parameters that have been specified on the command
line. |
void |
printHelpMesg()
Print a simple help message to standard out. |
void |
printVersion()
Print a message with the Agent Factory version number. |
void |
processInput()
Complete the initialisation proceedure by creating a platform and
agents. |
void |
setOutputStream(java.io.OutputStream os,
java.io.InputStream is)
Set the default system output stream to the specified output stream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static InitialisationManager getInstance()
- A singleton access method.
- Returns:
- InitialisationManager - the unique instance of the Initialisation
Manager. This object can be used to get a hold on the actual
Agent Factory platform.
initialise
public void initialise(java.lang.String[] inArgs)
- Initialise the IniatialisationMethod. This method must be called before
the getInstance method should be called by any external code.
- Parameters:
inArgs -
getPlatform
public AgentPlatform getPlatform()
- Get a reference to the AgentPlatform object.
- Returns:
- AgentPlatform - The unique instance of the agent platform.
parseParameters
public void parseParameters()
- Process the input parameters that have been specified on the command
line. All parameters will be processed, resulting in error messages,
flags being set, or mode selection as appropriate.
This method is normally used by the main method, but can also be used
by any class that wants to run the initialiser within another class (a
test for example).
printHelpMesg
public void printHelpMesg()
- Print a simple help message to standard out. The message includes
command line information and version numbers.
printVersion
public void printVersion()
- Print a message with the Agent Factory version number.
TODO - robertr - 13-Aug-2004 - Implement some dynamic way of
updating the version number.
processInput
public void processInput()
- Complete the initialisation proceedure by creating a platform and
agents.
This mehtod should be called after the command line input has been parsed.
If not, the method will exit immeditately, complaining that no
configuration file has been supplied.
initialiseNetworkInterface
public java.net.Socket initialiseNetworkInterface(int portNumber)
- Initialise a network command interface on a given port number. A server
will be started that waits for a client to connect. Once the client has
connected, the socket connection will be returned.
- Parameters:
portNumber - -
An int primitive that specifies the port on which the server
should be started.
- Returns:
- Socket - A socket to a client which has connected.
setOutputStream
public void setOutputStream(java.io.OutputStream os,
java.io.InputStream is)
- Set the default system output stream to the specified output stream. Once
this command has been called all system output and system error messages
will go to the specified output stream.
- Parameters:
os - An OutputStream object.
main
public static void main(java.lang.String[] args)
- This is the method that starts all methods!!! An instance of the
initialisation class will be created and used to parse the command
line parameters. Based on that parsing, the agent platform will be
created along with an appropriate input interface handler.