de.fhg.igd.semoa.server
Interface Guard

All Known Implementing Classes:
GuardFilter

public interface Guard

This class the interface for the GuardFilter, which holds up incoming and outgoing agents for auditing purpose.

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

Method Summary
 void activate(boolean flag)
          This method activates or deactivates the guard filter.
 TrustedListener addListener(Listener listener)
          Adds a Listener.
 AgentContext getAgentContext(String name)
          Returns the AgentContext to the agent with the given name, if the agents is waiting at the guard.
 SortedSet getAgentNames()
          Returns the names of all agents, which are waiting at the guard.
 boolean isActivated()
          Returns the current state of the guard filter.
 boolean rejectAgent(String name)
          Descards the agent with the given name.
 boolean rejectAllAgents()
          Descards all agents.
 boolean releaseAgent(String name)
          Releases the agent with the given name by letting it pass the filter.
 boolean releaseAllAgents()
          Releases all agent by letting it pass the filter.
 

Method Detail

activate

public void activate(boolean flag)
This method activates or deactivates the guard filter. Iff the filter es deactivated agents pass without delay.

Parameters:
flag - true to activate false to deactivate the filter.

isActivated

public boolean isActivated()
Returns the current state of the guard filter.

Returns:
true if the filter is activated, false otherwise.

addListener

public TrustedListener addListener(Listener listener)
Adds a Listener. The Listener will receive events of the type String every time an a change has occured within the agent name list. 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.

getAgentNames

public SortedSet getAgentNames()
Returns the names of all agents, which are waiting at the guard. The Set is sorted according to the agents entry time.

Returns:
A SortedSet containing entries of the type String.

getAgentContext

public AgentContext getAgentContext(String name)
Returns the AgentContext to the agent with the given name, if the agents is waiting at the guard.

Parameters:
name - The agent's name.
Returns:
The AgentContext of the waiting agent, null otherwise.

releaseAgent

public boolean releaseAgent(String name)
Releases the agent with the given name by letting it pass the filter.

Parameters:
name - The agent's name.
Returns:
true if the agent with the given name was waiting, false otherwise.

releaseAllAgents

public boolean releaseAllAgents()
Releases all agent by letting it pass the filter.

Returns:
true if at least one agent was waiting, false otherwise.

rejectAgent

public boolean rejectAgent(String name)
Descards the agent with the given name. The filter finally rejects the agent.

Parameters:
name - The agent's name.
Returns:
true if the agent with the given name was waiting, false otherwise.

rejectAllAgents

public boolean rejectAllAgents()
Descards all agents. The filter finally rejects them.

Returns:
true if at least one agent waiting, false otherwise.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.