ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/agents/PeerHandlerFactory.java
Revision: 1.1
Committed: Fri May 4 02:04:35 2001 UTC (23 years, 7 months ago) by ajm
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
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 import java.io.IOException;
5 import java.net.Socket;
6
7 /**
8 * An implementation of the HandlerFactory interface that is
9 * a factory for a handler that handles peer agent stations.
10 *
11 * @author $Author: tdb1 $
12 * @version $Id: TemplateClass.java,v 1.11 2001/03/22 21:50:41 tdb1 Exp $
13 */
14 class PeerHandlerFactory implements HandlerFactory {
15
16 //---FINAL / FINAL STATIC ATTRIBUTES---
17
18 /**
19 * The current CVS revision of this class
20 */
21 public static final String REVISION = "$Revision: 1.11 $";
22
23 //---STATIC METHODS---
24
25 //---CONSTRUCTORS---
26
27 //---PUBLIC METHODS---
28
29 public Handler newHandler(Socket socket) throws IOException {
30 PeerHandler peerHandler = new PeerHandler(socket);
31 AgentStation.getInstance().addPeer(peerHandler);
32 return (Handler) peerHandler;
33 }
34
35 public String getName() {
36 return _name;
37 }
38
39 /**
40 * Overrides the {@link java.lang.Object#toString() Object.toString()}
41 * method to provide clean logging (every class should have this).
42 *
43 * This uses the uk.ac.ukc.iscream.util.FormatName class
44 * to format the toString()
45 *
46 * @return the name of this class and its CVS revision
47 */
48 public String toString() {
49 return FormatName.getName(
50 _name,
51 getClass().getName(),
52 REVISION);
53 }
54
55 //---PRIVATE/PROTECTED METHODS---
56
57 //---ACCESSOR/MUTATOR METHODS---
58
59 //---ATTRIBUTES---
60
61 /**
62 * This is the friendly identifier of the
63 * component this class is running in.
64 * eg, a Filter may be called "filter1",
65 * If this class does not have an owning
66 * component, a name from the configuration
67 * can be placed here. This name could also
68 * be changed to null for utility classes.
69 */
70 private String _name = "PeerHandlerFactory";
71
72 /**
73 * This holds a reference to the
74 * system logger that is being used.
75 */
76 private Logger _logger = Logger.getInstance();
77
78 //---STATIC ATTRIBUTES---
79
80 }