Implement your own Provider 

Curiosity is an extensible platform: using .NET, you can create any provider you want.

An example custom provider implementation is available as a Visual Studio 2005 solution; this provider pushes the extracted data into a simple Microsoft Jet database.

In order to create a provider you must implement the com.goCuriosity.providers.IProvider interface (please, refer to the example solution for further details), which is located in the CuriosityIProvider.dll assembly (installed with Curiosity).

Then, you msut create an installer which installs your class library assembly in the Global Assembly Cache (gac) of the target machine.

Finally, you must add (as usual) the provider definition to the curiosity.xml configuration, as in the following example:

<provider>
  <class>namespace.of.yourProvider</class>
  <gac>GacNameOfYourProvider</gac>
  ...
</provider>

Recovery framework

Optionally, you can add to your Provider support for the recovery framework - which is aimed at creating so called "recovery points" in case of failure of providing actions (e.g. if the smtp server is down, in case of a mail based Provider), which will be passed to the Provider itself at the subsequent Curiosity execution in order to try a recover.

The IProvider.provide() method has a ref parameter named of type List<RecoveryPoint>: if a failure happens during the providing action, the Provider can create a proper instance of RecoveryPoint and add it to such recovery points list. Curiosity will take care of passing the archived recovery points to the Provider at the subsequent execution, by means of the IProvider.recover() method: this method should be meant to recover a single RecoveryPoint (the first parameter), by possibly creating new recovery points in case of further failures (to be added to the second ref parameter).

A RecoveryPoint (defined in CuriosityIProvider.dll) just holds information about the providing context (sourceId, providerId) and a reference to a so called recoveryFile: this file should contain the data to be recovered and it's totally up to the Provider to choose how to store such data.

Please, refer to the example solution previously cited for an example implementation.

Remember that, when you define in curiosity.xml a provider that supports recovery, you must use a named provider or you must set alocalName attribute for that provider (and the localName must be unique within all the providers - named and anonymous - defined for a given source).

Within the available providers, the InfoProviderMail, InfoProviderMailWithAttachment, ProviderMailsBag, and the InfoProviderFileFtp support recovery.

next