examples.postcard
Class TouristAgent

java.lang.Object
  extended byde.fhg.igd.semoa.agent.RoundtripAgent
      extended byexamples.postcard.TouristAgent
All Implemented Interfaces:
Runnable, Serializable

public class TouristAgent
extends RoundtripAgent

An agents which is intended to wander round the world and bring back a time-stamped picture from every place it visits. The picture is provided by the postcard service, which is expected at the visited servers.

This demo application is inspired by the movie "The fantastic world of Amelie", which deals with the young woman Amelie living at Paris and trying to solve other people's problems. In order help her father to deal with her mothers death, Amelie sends her father's Gartenzwerg (a small statue of a dwarf, put in a garden for decoration. Very popular in Germany) on a trip round the world. From every place the statue visits it takes a picutre of itself and a famous place and sends it home.

Oh, and no - it's not an American movie and it won't get any Oscar.

Version:
"$Id: TouristAgent.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Ulrich Pinsdorf
See Also:
Serialized Form

Field Summary
private static String LOGFILE
          Defines where the log file is stored in the agent's corpus.
private  List postcards_
          An ordered list of postcards the agent has collected yet.
private static int state_
          Represents the state of the agent's lifecycle.
 
Fields inherited from class de.fhg.igd.semoa.agent.RoundtripAgent
debug_, env_, MAX_RETRIES, mob_, start_, time_, vars_
 
Constructor Summary
TouristAgent()
          Creates the agent and initializes the member fields properly.
 
Method Summary
private  String currentLocation()
           
private  String currentURL()
           
private  Postcard fetchPostcard()
           
protected  void finish()
          This method is called when the agent reached its final hop.
 String getLog()
           
 void log(String message)
          Appends at message line at the end of the log file in the agent's corpus.
protected  void perform()
          This method must be implemented by subclasses.
 
Methods inherited from class de.fhg.igd.semoa.agent.RoundtripAgent
getHopNumber, onRunning, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

postcards_

private List postcards_
An ordered list of postcards the agent has collected yet.


state_

private static int state_
Represents the state of the agent's lifecycle.


LOGFILE

private static final String LOGFILE
Defines where the log file is stored in the agent's corpus. This is mutable/log.txt

See Also:
Constant Field Values
Constructor Detail

TouristAgent

public TouristAgent()
Creates the agent and initializes the member fields properly.

Method Detail

perform

protected void perform()
Description copied from class: RoundtripAgent
This method must be implemented by subclasses. It is called once for each hop on the agent's itinarary when the agent is at the desired hop. Default is to print the number of the current hop.

Overrides:
perform in class RoundtripAgent

finish

protected void finish()
Description copied from class: RoundtripAgent
This method is called when the agent reached its final hop. Subclasses should override this method with agent specific behavior. Default is to print a short message saying that the agent finished.

Overrides:
finish in class RoundtripAgent

fetchPostcard

private Postcard fetchPostcard()

currentLocation

private String currentLocation()

currentURL

private String currentURL()

getLog

public String getLog()

log

public void log(String message)
Appends at message line at the end of the log file in the agent's corpus. The log file is stored at LOGFILE.



Copyright © Fraunhofer Gesellschaft. All Rights Reserved.