|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.agent.JumpingAgent
This agent was designed to graphically demonstrate the migration behavior. It creates a Frame that contains a ComboBox and a Button. The ComboBox offers the user all servers that are known to the agent. If the JumpButton is pressed, the migration takes place and the agent "jumps" to the selected server.
Field Summary | |
private JFrame |
commandFrame_
Holds the GUI. |
private Object |
lock_
Lock object for internal synchronization. |
private MobilityContext |
mob_
The agents ability for mobility. |
private static String |
PREFIX_SERVER_PROP
|
private JComboBox |
serverChoiceBox_
Offers all known server destinations for selection |
Constructor Summary | |
JumpingAgent()
Default constructor. |
Method Summary | |
void |
actionPerformed(ActionEvent a)
Set the ticket accoring to user's choice and dispose the window. |
ArrayList |
findTargets()
Initializes the URL array from the Vicinity
service. |
private String |
getCurrentHost()
|
private String |
getLastHost()
|
private void |
initGUI()
Arranges the gui components. |
static void |
main(String[] argv)
This method is used for the initial launch of the agent from the jshell. |
void |
resume(ErrorCode err)
Resumes the agent. |
void |
run()
Runs the agent. |
void |
windowActivated(WindowEvent e)
|
void |
windowClosed(WindowEvent e)
Awake the agent who is waiting for user input. |
void |
windowClosing(WindowEvent e)
A closed window will kill the agent. |
void |
windowDeactivated(WindowEvent e)
|
void |
windowDeiconified(WindowEvent e)
|
void |
windowIconified(WindowEvent e)
|
void |
windowOpened(WindowEvent e)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private transient JFrame commandFrame_
private transient JComboBox serverChoiceBox_
private transient MobilityContext mob_
private Object lock_
private static final String PREFIX_SERVER_PROP
Constructor Detail |
public JumpingAgent()
Method Detail |
public void resume(ErrorCode err)
Resumable
start()
method (from the server's perspective).
The server calls this method when the agent is set up from
persistent storage rather than being received from a remote
host. The difference to start()
is basically
a semantic one.
resume
in interface Resumable
err
- The error code that is passed to the agent.
If the error code is ErrorCode.OK
then
this method should behave more or less like
start()
.
Otherwise, this method should start the agent in a way
that is appropriate for the error code. For instance,
if the agent is set up again after a failed migration
then ErrorCode.DESTINATION_UNREACHABLE
might be passed.public void run()
run
in interface Runnable
public ArrayList findTargets()
Vicinity
service.
ArrayList
of found targets or
null
, if Vicinity
is not installed.private void initGUI()
private String getLastHost()
private String getCurrentHost()
public void actionPerformed(ActionEvent a)
windowClosed()
about how this will
affect the agent.
param a The action event (unused).
actionPerformed
in interface ActionListener
public void windowClosed(WindowEvent e)
Here are two cases possible. First, the window was closed by clicking the JUMP! button. This will set a ticket and then dispose the window. Because the ticket was set the gent will be migrated after its termination. The destination is stated in the ticket.
The second option is that the window was closed by clicking the windows closing icon in the frame. In this case no ticket has been specified, but we tell the agent also to continue and terminate. Hence the agent will die.
windowClosed
in interface WindowListener
e
- The window event (unused).public void windowClosing(WindowEvent e)
windowClosed()
for more details.
windowClosing
in interface WindowListener
e
- The window event (unused).public void windowActivated(WindowEvent e)
windowActivated
in interface WindowListener
public void windowDeactivated(WindowEvent e)
windowDeactivated
in interface WindowListener
public void windowDeiconified(WindowEvent e)
windowDeiconified
in interface WindowListener
public void windowIconified(WindowEvent e)
windowIconified
in interface WindowListener
public void windowOpened(WindowEvent e)
windowOpened
in interface WindowListener
public static void main(String[] argv) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |