ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/agents/AgentSystem.java
Revision: 1.1
Committed: Fri May 4 02:04:35 2001 UTC (23 years, 6 months ago) by ajm
Branch: MAIN
Log Message:
Loads of new framework but far from complete.

The BasicAgent class is as it says, a basic agent, with ability to be run from the command line to fire it into an agentstation.

AgentStations now have support for adding and removing agents and support for multiple listeners.  Also initial support for peer agent stations.  Attempted support at peer -> peer agent transfer, but run into problems.

Still no bytecode transfer, but location and method has been figured out.

The AgentSystem class is now the bootstrap class for an agent station.  It brings up the AgentStation (which is now singleton) and the Logger (also singleton - using standard i-scream logging techniques).  It is possible to specify a peer station that the booting agent station should connect to.

Initial TODO:

	agent class loader
	agent bytecode transfer
	solve peer -> peer problems - possibly by creating extra socket to send agent, but shouldn't really be needed

File Contents

# Content
1 //---PACKAGE DECLARATION---
2
3 //---IMPORTS---
4
5 /**
6 * A bootstrap class that starts up the agent system
7 *
8 * @author $Author: tdb1 $
9 * @version $Id: TemplateClass.java,v 1.11 2001/03/22 21:50:41 tdb1 Exp $
10 */
11 class AgentSystem {
12
13 //---FINAL / FINAL STATIC ATTRIBUTES---
14
15 /**
16 * The current CVS revision of this class
17 */
18 public static final String REVISION = "$Revision: 1.11 $";
19
20 /**
21 * The toString() of this class
22 * As it won't be instatiated, this is needed.
23 * Not also that we pass a null as the class name (as we are static)
24 */
25 public static final String toString = FormatName.getName("AgentSystem", null, REVISION);
26
27 //---STATIC METHODS---
28
29 /**
30 * The main method which starts up the agent system
31 *
32 * @param args the command line arguements
33 */
34 public static void main(String[] args) {
35 System.out.println("-----------------------------------------");
36 System.out.println("--- i-scream Agent System ---");
37 System.out.println("--- (c) 2001 The i-scream Project ---");
38 System.out.println("--- (http://www.i-scream.org.uk) ---");
39 System.out.println("-----------------------------------------");
40 System.out.println("--- Starting System ---");
41 System.out.println(toString + ": coming up");
42
43 String name = null;
44 String initialPeerHostname = null;
45 int initialPeerPort = 0;
46 if (args.length > 0) {
47 name = args[0];
48 if (args.length >= 3) {
49 initialPeerHostname = args[1];
50 initialPeerPort = Integer.parseInt(args[2]);
51 }
52 } else {
53 throw new RuntimeException("Must specify a station name and/or an initial peer station hostname and port number on the command line!");
54 }
55
56 //System.getProperties().setProperty("java.security.policy", "/home/cut/ajm4/java/java.policy");
57 //if (System.getSecurityManager() == null) {
58 // System.out.println("Setting security manager...");
59 // System.setSecurityManager(new RMISecurityManager());
60 //}
61
62 LoggerImpl logger = (LoggerImpl) new ScreenLogger();
63
64 Logger.initialise(logger, Logger.DEBUG);
65 AgentStation.initialise(name, "Listening Post Alpha 76", initialPeerHostname, initialPeerPort);
66
67 System.out.println(toString + ": running");
68 }
69
70 //---CONSTRUCTORS---
71
72 //---PUBLIC METHODS---
73
74 //---PRIVATE/PROTECTED METHODS---
75
76 //---ACCESSOR/MUTATOR METHODS---
77
78 //---ATTRIBUTES---
79
80 //---STATIC ATTRIBUTES---
81
82 }