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.
Difference between revisions of "SMILA/Documentation/Mock Agent"
< SMILA | Documentation
Line 8: | Line 8: | ||
* Content | * Content | ||
− | == | + | == Agent configuration == |
The example configuration file called "mockAgent.xml" is located at <tt>configuration/org.eclipse.smila.connectivity.framework</tt>. | The example configuration file called "mockAgent.xml" is located at <tt>configuration/org.eclipse.smila.connectivity.framework</tt>. | ||
Line 14: | Line 14: | ||
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>. | ||
− | == | + | == Agent configuration explanation == |
− | The root element of | + | The root element of agent 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 | ||
Line 23: | Line 23: | ||
** <tt>Crawler</tt> – service id a Crawler | ** <tt>Crawler</tt> – service id a Crawler | ||
** <tt>Agent</tt> – service id of an Agent | ** <tt>Agent</tt> – service id of an Agent | ||
− | * <tt>CompoundHandling</tt> – specify if packed data (like a zip containing files) should be unpack and files within should be | + | * <tt>CompoundHandling</tt> – specify if packed data (like a zip 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 69: | Line 69: | ||
</source> | </source> | ||
− | == Output example | + | == Output example == |
− | + | A record created by the MockAgent will have the following structure: | |
<source lang="xml"> | <source lang="xml"> |
Revision as of 04:44, 6 May 2009
Contents
Overview
The MockAgent is a sample implementation of an Agent used for testing. It creates new records in a configurable interval, sending add request to the AgentController. A record can contain the following attributes:
- Identifier
- MimeType
- LastModifiedDate
- Content
Agent configuration
The example configuration file called "mockAgent.xml" is located at configuration/org.eclipse.smila.connectivity.framework.
Defining Schema: org.eclipse.smila.connectivits.framework.agent.mock/schemas/MockDataSourceConnectionConfigSchema.xsd.
Agent configuration explanation
The root element of agent 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 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.
MockAgent configuration example
<DataSourceConnectionConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../org.eclipse.smila.connectivity.framework.agent.rss/schemas/RSSDataSourceConnectionConfigSchema.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 MockAgent will have the following structure:
<Record xmlns="http://www.eclipse.org/smila/record" version="1.0"> <Id xmlns="http://www.eclipse.org/smila/id" version="1.0"> <!-- Element name must be Source, not _Source, it's made due to syntax coloring problem in wiki --> <_Source>mockAgent</_Source> <Key name="Path">1241449855624</Key> </Id> <A n="LastModifiedDate"> <L> <V t="datetime">2009-05-04 16:44:46.541</V> </L> </A> <A n="Path"> <L> <V>1241449855624</V> </L> </A> <A n="MimeType"> <L> <V>text/html</V> </L> </A> <A n="_HASH_TOKEN"> <L> <V> 66f373e6f13498a65c7f5f1cf185611e94ab45630c825cc2028dda38e8245c7 </V> </L> </A> <Attachment>Content</Attachment> </Record>