|
Agent System POND 1.0 (1.7.2000) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--FIM.Util.Threads.CancellableThread | +--PkgAgentSystem.AgentSystem | +--PkgAgentSystem.GUI.GUIAgentSystem
Base class for agent systems with a graphical user interface. To be used with class MainFrame
.
Can be used as stand-alone:
java PkgAgentSystem.GUI.GUIAgentSystem agentDir libraryDir [Port [savedFile]]
Field Summary | |
protected MainFrame |
mainframe
The main window of the system |
Fields inherited from class PkgAgentSystem.AgentSystem |
DEBUG,
MAX_DEFER_DELAY,
MIN_DEFER_DELAY,
SECURE_CONNECTION,
securityStore,
servingThreads,
STD_PORT |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY,
MIN_PRIORITY,
NORM_PRIORITY,
values |
Constructor Summary | |
GUIAgentSystem(int port,
String libraryDir,
String agentDir,
boolean exitOnLast,
String savedFile)
Creates a new GUI agent system with the security turned on. |
|
GUIAgentSystem(int port,
String libraryDir,
String agentDir,
boolean exitOnLast,
String savedFile,
boolean useSecurity)
Creates a new GUI agent system and shows the main window. |
Method Summary | |
(package private) void |
addKeyPair(NamedKeyPair nkp)
Adds a general key pair to the security store. |
(package private) void |
addTrustedCertificate(String name,
Certificate cert)
Adds a trusted certificate to the security store. |
(package private) boolean |
agentsExist()
Returns whether there is at least one agent (either active or persisted) in this system. |
protected void |
dePersist(AgentData data)
Restores a persisted agent to the running state. |
protected void |
destroyPersistedAgent(AgentData data)
Terminates a currently persisted agent. |
(package private) void |
doCreateAgent()
Create a new agent. |
protected void |
doMoveAgent(AgentBase agent,
URL destination)
Transfers an agent to another host. |
(package private) boolean |
existsTrustedCertificateName(String name)
Checks whether a trusted certificate with this name already exists. |
protected String |
getAgentDirectory()
Returns the directory from where the agents are loaded. |
static void |
main(String[] args)
This class can also be used directly to show a GUI agent system: java PkgAgentSystem.GUI.GUIAgentSystem agentDir libraryDir [Port [savedFile]] |
protected void |
move(AgentBase agent,
URL destination)
Helper function for transfering an agent. |
protected void |
onAgentCreated(AgentData data)
Notify the mainframefor updating the user interface after an agent was created. |
protected void |
onAgentDepersisted(AgentData data)
Notify the mainframe for updating the user interface after an agent was depersisted. |
protected void |
onAgentDestroyed(AgentData data)
Notify the mainframe for updating the user interface after an agent was destroyed. |
protected void |
onAgentPersisted(AgentData data)
Notify the mainframe for updating the user interface after an agent was persisted. |
protected void |
onAgentReceived(AgentData data)
Notify the mainframe for updating the user interface after an agent was received. |
(package private) String |
openFile(String filename,
String password)
Reades the agent system with all contained agents from a file. |
protected void |
persist(AgentBase agent)
Persists an agent to the disk. |
protected void |
reportError(String msg)
Report an error to the user. |
(package private) String |
saveFile(String password)
Saves the agent system with all contained agents to the default file. |
(package private) String |
saveFileAs(String filename,
String password)
Saves the agent system with all contained agents to a file. |
protected AgentBase |
startAgent(String className,
String codeOrigin,
boolean forceLocalCode,
AgentIdentity identity,
PrivateKey privateKey,
Object param,
boolean start)
For starting an agent by the system. |
protected void |
stopAgent(AgentBase agent,
boolean destroyed)
Terminates a running agent. |
Methods inherited from class FIM.Util.Threads.CancellableThread |
isCancelled |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected MainFrame mainframe
Constructor Detail |
public GUIAgentSystem(int port, String libraryDir, String agentDir, boolean exitOnLast, String savedFile)
port
- the port the system will listen on (must be >1024 or -1)libraryDir
- the directory, where the common libraries are from; All agents will load classes
first from there and only after not finding them there from their local path/package. Must be provided.agentDir
- the directory, where the AGENTS are from, NOT where the JDK or the agent system is locatedexitOnLast
- if true the system will terminate after the last agent is destroyed (may start empty however)savedFile
- if not null, the agentsystem will load the state from this filepublic GUIAgentSystem(int port, String libraryDir, String agentDir, boolean exitOnLast, String savedFile, boolean useSecurity)
port
- the port the system will listen on (must be >1024 or -1)libraryDir
- the directory, where the common libraries are from; All agents will load classes
first from there and only after not finding them there from their local path/package. Must be provided.agentDir
- the directory, where the AGENTS are from, NOT where the JDK or the agent system is locatedexitOnLast
- if true the system will terminate after the last agent is destroyed (may start empty however)savedFile
- if not null, the agentsystem will load the state from this fileuseSecurity
- false if no security system is wantedMethod Detail |
protected void onAgentCreated(AgentData data)
data
- the management data of the new agentprotected void onAgentReceived(AgentData data)
data
- the management data of the new agentprotected void onAgentPersisted(AgentData data)
data
- the management data of the now persisted agentprotected void onAgentDepersisted(AgentData data)
data
- the management data of the restored agentprotected void onAgentDestroyed(AgentData data)
data
- the management data of the removed agentprotected void stopAgent(AgentBase agent, boolean destroyed)
Mainframe
can access it.agent
- the agent to stopdestroy
- if the agent should be completely destroyed (false when persisting)protected void destroyPersistedAgent(AgentData data)
Mainframe
can access it.data
- the management data of the agent to destroyprotected void persist(AgentBase agent) throws NotSerializableException
Mainframe
can access it.agent
- the agent to persistAgentBase
,
PersistingDeniedException
protected void dePersist(AgentData data) throws CreateAgentFailureException
Mainframe
can access it.data
- the management data of the agent to depersistAgentBase
protected void move(AgentBase agent, URL destination) throws ReceiveAgentDeniedException, CannotSendException
agent
- the agent to movedestination
- URL
of the system the agent shall be moved toprotected void doMoveAgent(AgentBase agent, URL destination) throws ReceiveAgentDeniedException, CannotSendException
Mainframe
can access it.agent
- the agent to movedestination
- URL
of the system the agent shall be moved toprotected AgentBase startAgent(String className, String codeOrigin, boolean forceLocalCode, AgentIdentity identity, PrivateKey privateKey, Object param, boolean start) throws CreateAgentFailureException, InitializationException
doCreateAgent
)className
- name of the class of the agent to start (including all packages)codeOrigin
- file or directory where from where the code should be loaded. If null, searches for it in the agent-directory.forceLocalCode
- if true, the code will be marked as from the local host, even if it is notidentity
- the identity of the agentprivateKey
- the private key of the agent (might be null if identity has no public key or just not provided)param
- the parameter passed to the method initialize, which is called after starting the agentstart
- true if the agent should be started (if false, it can be started later with "void doCreateAgent()
Mainframe
.CreateAgentDialog
,
SelectIdentityDialog
protected String getAgentDirectory()
Mainframe
can access it.boolean agentsExist()
true
if at least one agent existsString saveFileAs(String filename, String password) throws FileNotFoundException
Mainframe
can access it.filename
- the name of the file to which the system is savedpassword
- the password used for encrypting the fileString saveFile(String password) throws FileNotFoundException
Mainframe
can access it.password
- the password used for encrypting the fileString openFile(String filename, String password) throws FileNotFoundException
Mainframe
can access it.filename
- the name of the file from which the system is restoredpassword
- the password used for decrypting the fileboolean existsTrustedCertificateName(String name) throws KeyStoreException
name
- the name under which the trusted certificate should be storedtrue
if this name already exists as an trusted certificatevoid addTrustedCertificate(String name, Certificate cert) throws KeyStoreException
name
- the name under which the trusted certificate should be storedcert
- the trusted certificatevoid addKeyPair(NamedKeyPair nkp) throws KeyStoreException
nkp
- the named pair of keys to be storedprotected void reportError(String msg)
super.reportError(msg)
.msg
- the error message to reportpublic static void main(String[] args)
java PkgAgentSystem.GUI.GUIAgentSystem agentDir libraryDir [Port [savedFile]]
|
Agent System POND 1.0 (1.7.2000) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |