oracle.ifs.agents.common
Interface Agent

All Known Implementing Classes:
IfsAgent

public interface Agent

An Agent is an interface that defines a specific task that is managed by ServerManager.

Most implementations of agents will use the base implementation, oracle.ifs.agents.common.IfsAgent, but any other implementations of this interface will be supported by ServerManager.


Method Summary
 AgentLogger getAgentLogger()
          Gets the logger used by the Agent.
 java.lang.String getName()
          Gets the name of this Agent.
 ParameterTable getParameterTable()
          Gets the AgentManager ParameterTable.
 int getPriority()
          Gets the priority of this Agent.
 boolean isAlive()
          Gets whether this Agent is alive.
 boolean isSuspended()
          Gets whether this Agent is suspended.
 void postRun()
          Performs post-run tasks for this Agent.
 void register()
          Registers this agent with iFS.
 void restart()
          Restarts this Agent.
 void resume()
          Resumes this Agent.
 void run()
          Runs this Agent.
 void setAgentLogger(AgentLogger logger)
          Sets the logger to be used by the Agent.
 void setPriority(int priority)
          Sets the priority of this Agent.
 void start()
          Starts this Agent.
 void stop()
          Stops this Agent.
 void suspend()
          Suspends this Agent.
 void terminate()
          Terminates this Agent.
 

Method Detail


getName


public java.lang.String getName()
Gets the name of this Agent.
Returns:
the name

getParameterTable


public ParameterTable getParameterTable()
Gets the AgentManager ParameterTable. This ParameterTable should reflect the settings for the specific agent, which will include any settings for the ServerManager directly and any parameters (or overrides to ServerManager settings) introduced in the agent section. The information needed to construct such a ParameterTable are provided when the Agent instance is constructed.
Returns:
the ParameterTable

getAgentLogger


public AgentLogger getAgentLogger()
Gets the logger used by the Agent. This is typically set when the agent instance is constructed.

Returns:
logger the AgentLogger used by the Agent for logging.

setAgentLogger


public void setAgentLogger(AgentLogger logger)
                    throws IfsException
Sets the logger to be used by the Agent. This overrides any logger that was set when the agent was constructed.

Parameters:
logger - the AgentLogger to be used for logging.
Throws:
IfsException - if the operation fails

register


public void register()
              throws IfsException
Registers this agent with iFS. This should create a SERVERDETAIL instance that contains information "published" by the agent.

Throws:
IfsException - (IFS-46013) if the operation fails

getPriority


public int getPriority()
                throws IfsException
Gets the priority of this Agent.

The priority must be between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY, inclusive.

Returns:
the priority
Throws:
IfsException - (IFS-46013) if the operation fails

setPriority


public void setPriority(int priority)
                 throws IfsException
Sets the priority of this Agent.

The priority must be between Thread.MIN_PRIORITY and Thread.MAX_PRIORITY, inclusive.

Parameters:
priority - the priority
Throws:
IfsException - (IFS-46014) if the operation fails

start


public void start()
           throws IfsException
Starts this Agent.

Attempting to start an already-started Agent has no effect.

Throws:
IfsException - (IFS-46020) if the operation fails

restart


public void restart()
             throws IfsException
Restarts this Agent. This is effectively equivalent to a stop request followed by a start request.

Attempting to restart an Agent that is stopped is treated as a start request.

Throws:
IfsException - (IFS-46020) if the operation fails

stop


public void stop()
          throws IfsException
Stops this Agent.

Attempting to stop an unstarted or an already-stopped Agent has no effect.

Throws:
IfsException - (IFS-46021) if the operation fails

terminate


public void terminate()
               throws IfsException
Terminates this Agent. This is called when ServerManager shuts down, and is equivalent to a stop with a notifcation to the agent not to bother updating any published agent information.
Throws:
IfsException - (IFS-46021) if the operation fails

suspend


public void suspend()
             throws IfsException
Suspends this Agent.

Attempting to suspend an unstarted, stopped, or already-suspended Agent has no effect.

Throws:
IfsException - (IFS-46022) if the operation fails

resume


public void resume()
            throws IfsException
Resumes this Agent.

Attempting to resume an unstarted, stopped, or unsuspended Agent has no effect.

Throws:
IfsException - (IFS-46023) if the operation fails

isAlive


public boolean isAlive()
                throws IfsException
Gets whether this Agent is alive.

An Agent is alive if it has been started and has not stopped or been requested to stop.

Returns:
whether it is alive
Throws:
IfsException - (IFS-46030) if the operation fails

isSuspended


public boolean isSuspended()
                    throws IfsException
Gets whether this Agent is suspended.

An Agent is suspended if it has been started and then suspended, and has not resumed or stopped.

Returns:
whether it is suspended
Throws:
IfsException - (IFS-46031) if the operation fails

run


public void run()
         throws IfsException
Runs this Agent.

Override this method with the tasks to be performed by this Agent. If this method returns (either explicitly or by throwing an Error), postRun is invoked and the Agent is stopped.

postRun


public void postRun()
             throws IfsException
Performs post-run tasks for this Agent.

Override this method with the tasks to be performed when this Agent is stopped. An Agent stops when stop is invoked, or when run either returns or throws an Error. When this occurs, required clean-up tasks, such as disconnecting a LibrarySession, can be performed in this method.