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.
Difference between revisions of "SMILA/Documentation/Mock Agent"
< SMILA | Documentation
m |
|||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
− | The | + | The Mock agent is a sample implementation of an agent used for testing. It creates new records in a configurable interval and sends add requests to the AgentController. |
+ | |||
A record can contain the following attributes: | A record can contain the following attributes: | ||
* Identifier | * Identifier | ||
Line 10: | Line 11: | ||
== Agent configuration == | == Agent configuration == | ||
− | The example configuration file | + | The example configuration file is located at <tt>configuration/org.eclipse.smila.connectivity.framework/mockAgent.xml</tt>. |
Defining Schema: <tt>org.eclipse.smila.connectivits.framework.agent.mock/schemas/MockDataSourceConnectionConfigSchema.xsd</tt>. | Defining Schema: <tt>org.eclipse.smila.connectivits.framework.agent.mock/schemas/MockDataSourceConnectionConfigSchema.xsd</tt>. | ||
Line 16: | Line 17: | ||
== Agent configuration explanation == | == Agent configuration explanation == | ||
− | The root element of | + | The root element of the configuration is <tt>DataSourceConnectionConfig</tt> and contains the following sub elements: |
* <tt>DataSourceID</tt> – the identification of a data source | * <tt>DataSourceID</tt> – the identification of a data source | ||
* <tt>SchemaID</tt> – specifies the schema for the data source | * <tt>SchemaID</tt> – specifies the schema for the data source | ||
* <tt>DataConnectionID</tt> – describes which agent or crawler should be used | * <tt>DataConnectionID</tt> – describes which agent or crawler should be used | ||
− | ** <tt>Crawler</tt> – service | + | ** <tt>Crawler</tt> – service ID a crawler |
− | ** <tt>Agent</tt> – service | + | ** <tt>Agent</tt> – service ID of an agent |
− | * <tt>CompoundHandling</tt> – specify if packed data (like a | + | * <tt>CompoundHandling</tt> – specify if packed data (like a ZIP container containing files) should be unpack and files within should be processed(YES or NO). |
* <tt>Attributes</tt> – list all attributes provided by the data source | * <tt>Attributes</tt> – list all attributes provided by the data source | ||
** <tt>Attribute</tt> | ** <tt>Attribute</tt> | ||
Line 35: | Line 36: | ||
** <tt>SleepTime</tt> – the number of seconds to wait betweeen creation of records. | ** <tt>SleepTime</tt> – the number of seconds to wait betweeen creation of records. | ||
− | + | == Mock agent configuration example == | |
− | == | + | |
<source lang="xml"> | <source lang="xml"> | ||
Line 71: | Line 71: | ||
== Output example == | == Output example == | ||
− | A record created by the | + | A record created by the Mock agent will have the following structure: |
<source lang="xml"> | <source lang="xml"> | ||
− | <Record xmlns="http://www.eclipse.org/smila/record" version=" | + | <Record xmlns="http://www.eclipse.org/smila/record" version="2.0"> |
− | < | + | <Val key="_recordid">mockAgent:<Path=1241449855624></Val> |
− | + | <Val key="_source">mockAgent</Val> | |
− | + | <Val key="LastModifiedDate" type="datetime">2009-05-04 16:44:46.541</Val> | |
− | + | <Val key="Path">1241449855624</Val> | |
− | + | <Val key="MimeType">text/html</Val> | |
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<Attachment>Content</Attachment> | <Attachment>Content</Attachment> | ||
</Record> | </Record> |
Revision as of 10:41, 20 April 2011
Contents
Overview
The Mock agent is a sample implementation of an agent used for testing. It creates new records in a configurable interval and sends add requests to the AgentController.
A record can contain the following attributes:
- Identifier
- MimeType
- LastModifiedDate
- Content
Agent configuration
The example configuration file is located at configuration/org.eclipse.smila.connectivity.framework/mockAgent.xml.
Defining Schema: org.eclipse.smila.connectivits.framework.agent.mock/schemas/MockDataSourceConnectionConfigSchema.xsd.
Agent configuration explanation
The root element of the configuration is DataSourceConnectionConfig and contains the following sub elements:
- DataSourceID – the identification of a data source
- SchemaID – specifies the schema for the data source
- DataConnectionID – describes which agent or crawler should be used
- Crawler – service ID a crawler
- Agent – service ID of an agent
- CompoundHandling – specify if packed data (like a ZIP container containing files) should be unpack and files within should be processed(YES or NO).
- Attributes – list all attributes provided by the data source
- Attribute
- Type (required) – the data type (String, Integer or Date).
- Name (required) – attributes name.
- HashAttribute – specify if a hash should be created (true or false).
- KeyAttribute – creates a key for this object, for example for record id (true or false).
- Attachment – specify if the attribute return the data as attachment of record.
- Attribute
- Process – contains parameters for the agent business logic.
- SleepTime – the number of seconds to wait betweeen creation of records.
Mock agent configuration example
<DataSourceConnectionConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../org.eclipse.smila.connectivity.framework.agent.mock/schemas/MockDataSourceConnectionConfigSchema.xsd" > <DataSourceID>mockAgent</DataSourceID> <SchemaID>org.eclipse.smila.connectivity.framework.agent.mock</SchemaID> <DataConnectionID> <Agent>MockAgent</Agent> </DataConnectionID> <CompoundHandling>Yes</CompoundHandling> <Attributes> <Attribute Type="Date" Name="LastModifiedDate" HashAttribute="true"> <MockAttributes>LastModifiedDate</MockAttributes> </Attribute> <Attribute Type="String" Name="Path" KeyAttribute="true"> <MockAttributes>Identifier</MockAttributes> </Attribute> <Attribute Type="String" Name="Content" Attachment="true" MimeTypeAttribute="MimeType"> <MockAttributes>Content</MockAttributes> </Attribute> <Attribute Type="String" Name="MimeType"> <MockAttributes>MimeType</MockAttributes> </Attribute> </Attributes> <Process> <SleepTime>60</SleepTime> </Process> </DataSourceConnectionConfig>
Output example
A record created by the Mock agent will have the following structure:
<Record xmlns="http://www.eclipse.org/smila/record" version="2.0"> <Val key="_recordid">mockAgent:<Path=1241449855624></Val> <Val key="_source">mockAgent</Val> <Val key="LastModifiedDate" type="datetime">2009-05-04 16:44:46.541</Val> <Val key="Path">1241449855624</Val> <Val key="MimeType">text/html</Val> <Attachment>Content</Attachment> </Record>