Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SMILA/Documentation/AgentController

< SMILA‎ | Documentation
Revision as of 07:53, 4 May 2009 by Unnamed Poltroon (Talk) (New page: == Overview == The AgentController is a component that manages and monitors Agents. == API == <source lang="java"> * * Management interface for the AgentController.: public interf...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Overview

The AgentController is a component that manages and monitors Agents.

API

/**
 * Management interface for the AgentController.
 */
public interface AgentController {
 
  /**
   * Starts an Agent using the given dataSourceId. This method creates a new Thread. If it is called for a dataSourceId
   * that is currently used by another agent a ConnectivityException is thrown. Returns the hashCode of the agent
   * instance used for performance counter.
   * 
   * @param dataSourceId
   *          the ID of the data source
   * @return - the hashcode of the agent instance as int value
   * @throws ConnectivityException
   *           if any error occurs
   */
  int startAgent(String dataSourceId) throws ConnectivityException;
 
  /**
   * Stops an active agent using the given dataSourceId.
   * 
   * @param dataSourceId
   *          the ID of the data source
   * @throws ConnectivityException
   *           if any error occurs
   */
  void stopAgent(String dataSourceId) throws ConnectivityException;
 
  /**
   * Checks if there are any active agents.
   * 
   * @return true if there are active agents, false otherwise
   * @throws ConnectivityException
   *           if any error occurs
   */
  boolean hasActiveAgents() throws ConnectivityException;
 
  /**
   * Returns a Collection of Strings containing the dataSourceIds of the currently active agents.
   * 
   * @return a Collection of Strings containing the dataSourceIds
   * @throws ConnectivityException
   *           if any error occurs
   */
  Collection<String> getActiveAgents() throws ConnectivityException;
 
  /**
   * returns the AgentController known Agents.
   * 
   * @return Collection with Strings
   */
  Collection<String> getAvailableAgents();
}
 
}

Implementations

It is possible to provide different implementations for the AgentController interface. At the moment there is one implementation available.

org.eclipse.smila.connectivity.framework.impl

This bundle contains the default implementation of the AgentController interface.

The AgentController implements the general processing logic common for all types of Agents. Its interface is a pure management interface that can be accessed by its Java interface or its wrapping JMX interface. It has references to the following OSGi services:

  • ConnectivityManager
  • Agent ComponentFactory
  • ConfigurationManagement (t.b.d.)
  • CompoundManagement (t.b.d.)

Agent Factories register themselves at the AgentController. Each time an agent is started with a datasource for a specific type of agent, a new instance of that Agent type is created via the Agent ComponentFactory. This allows parallel watching of datasources with the same type (e.g. several rss feeds). Note that it is not possible to start muptiple agents on the same data source concurrently!


This chart shows the current AgentController processing logic for one crawl run: AgentControllerProcessingLogic.png

  • the Agent is started and waits for events in a separate thread. One of the following events can occur:
    • ADD: a new or updated object on the datasource was detected. A record object is created and it is added to the ConnectivityManager. Note that for each object DeltaIndexing is initialized and finished, thus adding delta indexing information about the record to the DeltaIndexingManager!.
    • DELETE: an object on the datasource was deleted. An Id is creeated for the deleted object and send to the ConnectivityManager. Note that for each object DeltaIndexing is initialized and finished, thus removing delta indexing information about the id from the DeltaIndexingManager!.
    • STOP: the agent is stopped either via an external command or because some fatal errors occured

The processing logic will be enhanced as soon as CompoundManagement is available.

Configuration

There are no configuration options available for this bundle.

JMX interface

/**
 * The Interface AgentControllerAgent.
 */
public interface AgentControllerAgent {
 
  /**
   * Start agent.
   * 
   * @param dataSourceId
   *          the data source id
   * 
   * @return the string
   */
  String startAgent(final String dataSourceId);
 
  /**
   * Stop agent.
   * 
   * @param dataSourceId
   *          the data source id
   * 
   * @return the string
   */
  String stopAgent(final String dataSourceId);
 
  /**
   * Gets the active agents status.
   * 
   * @return the active agents status
   */
  String getActiveAgentTaskStatus();
 
  /**
   * Gets the active agents.
   * 
   * @return the active agents
   */
  String[] getActiveAgentTasks();
 
  /**
   * returns all Agents that have connected to the AgentController.
   * 
   * @return List with Strings of all available Agents
   */
  String[] getAvailableAgents();
 
}


Here is a screenshot of the AgentController in the JMX Console:

AgentControllerJMX.png

Back to the top