Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SMILA/Documentation/AgentController"

(API)
(API)
Line 9: Line 9:
 
Javadoc:  
 
Javadoc:  
 
* [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/connectivity/framework/AgentController.html org.eclipse.smila.connectivity.framework.AgentController]
 
* [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/connectivity/framework/AgentController.html org.eclipse.smila.connectivity.framework.AgentController]
* [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/connectivity/framework/AgentControllerCallback.html org.eclipse.smila.connectivity.framework.AgentControllerCallback]
+
* [http://build.eclipse.org/rt/smila/javadoc/current/org/eclipse/smila/connectivity/framework/util/AgentControllerCallback.html org.eclipse.smila.connectivity.framework.util.AgentControllerCallback]
  
 
== Implementations ==
 
== Implementations ==

Revision as of 03:48, 21 April 2011

Overview

The AgentController is a component that manages and monitors Agents. Whenever a new agent task is triggered (via startAgent()) a new instance of the used Agent is created and the agent object hash value is used a an id (called jobId) to identify records created by this agent instance. This jobid is set as an annotation on all records and will also visible on the agent instance in the JMX console.

API

AgentController provides two interfaces, one is used by management clients to start/stop agent instances, the other is used by Agents to execute callback methods on the AgentController itself, executing the ccommon processing logic.

Javadoc:

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 agent run: AgentControllerProcessingLogic.png

  • the Agent is started, initializes DeltaIndexing for the data source by calling DeltaIndexingManager:init(String) 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. It is checked if the record was updated by calling DeltaIndexingManager:checkForUpdate(Id, String)
      • YES: the record is added to the Queue by calling ConnectivityManager:add(Record[]) and updated in the DeltaIndexingManager by calling DeltaIndexingManager:visit(Id, String, boolean)
      • NO: no actions are taken
    • DELETE: an object on the datasource was deleted. An Id object is created for the deleted object. This Id is deleted from both ConnectivityManager and DeltaIndexingManager by calling ConnectivityManager:delete(Id[])and DeltaIndexingManager:delete(Id[]).
    • STOP: the agent is stopped either via an external command or because some fatal errors occured
      • it finishes DeltaIndexing by calling DeltaIndexingManager:finish(String) and ends the thread

The processing logic will be enhanced when CompoundManagement is integrated.

Note

The exact logic depends on the settings of DeltaIndexing in the data source configuration. Depending on the configured value, delta indexing logic is executed fully, partially or not at all.


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