de.fhg.igd.atlas.core
Interface AgentTracer

All Known Implementing Classes:
AgentTracerImpl

public interface AgentTracer

Defines the interface to an AgentTracer implementation, which provides a watch list for agents. All agents in this list are tracked in certain intervalls and their current contact address is stored.

Version:
"$Id: AgentTracer.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Peters

Field Summary
static String WHATIS
          The WhatIs entry key for this service.
 
Method Summary
 void addAgentToWatchList(AgentCard agentCard)
          Adds an agent to the agent tracer's watch list.
 void addAgentToWatchList(byte[] implicitName)
          Adds an agent to the agent tracer's watch list.
 TrustedListener addListener(Listener listener)
          Adds a Listener.
 long getUpdateTime()
          Returns the update interval of the agent tracer.
 SortedMap list()
          Returns a copy of the internally used map which holds the (implicit name, contact address) correlations of the last update.
 void refresh()
          Initiates a contact address update for all agents in the agent tracer's watch list.
 void removeAgentFromWatchList(AgentCard card)
          Removes an agent from the agent tracer's watch list.
 void removeAgentFromWatchList(byte[] implicitName)
          Removes an agent from the agent tracer's watch list.
 void setUpdateTime(long updateTime)
          Sets the update interval of the agent tracer.
 

Field Detail

WHATIS

public static final String WHATIS
The WhatIs entry key for this service.

See Also:
Constant Field Values
Method Detail

addAgentToWatchList

public void addAgentToWatchList(AgentCard agentCard)
Adds an agent to the agent tracer's watch list. The agent identified by the given agentCard will be registered within the agent tracer and lookups will be initiated in certain update intervals to resolve its current contact address. If the contact address of an agent in the watch list could not be resolved for a certain number of update cycles, it is automatically removed from the list, again. Theadded to the watch list if not already

Parameters:
agentCard - The agent card of the agent.

addAgentToWatchList

public void addAgentToWatchList(byte[] implicitName)
Adds an agent to the agent tracer's watch list. The agent identified by the given implicitName will be registered within the agent tracer and lookups will be initiated in certain update intervals to resolve its current contact address. If the contact address of an agent in the watch list could not be resolved for a certain number of update cycles, it is automatically removed from the list, again. Theadded to the watch list if not already


removeAgentFromWatchList

public void removeAgentFromWatchList(AgentCard card)
Removes an agent from the agent tracer's watch list. If the agent identified by the given agentCard can be found in the watch list, it is removed immediately.


removeAgentFromWatchList

public void removeAgentFromWatchList(byte[] implicitName)
Removes an agent from the agent tracer's watch list. If the agent identified by the given implicitName can be found in the watch list, it is removed immediately.

Parameters:
implicitName - The implicit name of the agent.

refresh

public void refresh()
Initiates a contact address update for all agents in the agent tracer's watch list. This method can be used to refresh the (implicit name, contact address) correlations, even if the update mechanism is deactivated.


list

public SortedMap list()
Returns a copy of the internally used map which holds the (implicit name, contact address) correlations of the last update. The entries of the type Map.Entry consist of the implicit name of the agent (byte[]) as key and the contact address (URL) as corresponding value. If the contact address of an agent could not be resolved the nth time, a URL of following format is returned:
error://unknown/n

Returns:
The sorted map of (implicit name, contact address) correlations.

addListener

public TrustedListener addListener(Listener listener)
Adds a Listener. The Listener will receive events of the type String every time an update has been initiated by the agent tracer's update daemon respectively by a call of refresh. Listener instances passed to this method shall be wrapped in a TrustedListener which is then returned.

Parameters:
listener - The Listener to be registered.
Returns:
The TrustedListener that wraps around the given Listener.
Throws:
NullPointerException - if listener is null.

setUpdateTime

public void setUpdateTime(long updateTime)
Sets the update interval of the agent tracer. The given value determines the interval in which the agent tracer updates the contact addresses of the agents in its watch list. An updateTime of 0 deactivates the update mechanism.


getUpdateTime

public long getUpdateTime()
Returns the update interval of the agent tracer.

Returns:
The update time of the agent tracer or 0 if the update mechanism is deactivated.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.