Define and Use a Provider

Providers are defined in the configuration file in the following way:

<webSource name="aSource">
    <nextstepsList>
        ...
    </nextstepsList>
    <slots level="1">
        ...
    </slots>
   
    <provider>
        <class>com.curiosity.providers.AProvider</class>
        ...
    </provider>
   
</webSource>

where the class is the .NET class name of the provider (you can implement your own provider).

Each provider can have a number of parameters depending on the task it has to accomplish.

A common paramter is the xsl file that the provider must apply to the data before use it:

<xsl>infoToaTask.xsl</xsl>

(A good XSLT Quick Reference can be found here.)

Moreover, if you want to temporarly disable a provider you can use the disabled attribute:

<disabled>true</disabled>

Provider Templates

In order to lesses the burden of manually adding providers to all the sources, you can define (in the section providerTemplates under the curiosity root) some “ provider templates”, combining all the providers attributes that you want:

<curiosity>
    <providerTemplates>
        <template>
            <aliasTag>providerMail</aliasTag>
            <class>...InfoProviderMail</class>
        </template>
        <template>
            <aliasTag>providerFtpRSS</aliasTag>
            <class>...InfoProviderFileFtp</class>
            <xsl>info2rss.xsl</xsl>
        </template>
    </providerTemplates>
</curiosity>

The aliasTag property is the name of the tag that will be used in the sources in order to refer this combination of values.

<webSource name="aSource">
    <nextstepsList>
        ...
    </nextstepsList>
    <slots level="1">
        ...
    </slots>
   
    <providerMail>
        <recipients>aMail@example.org</recipients>
    </providerMail>
    
    <providerFtpRSS>
        ...
    </providerFtpRSS>
   
</webSource>

When you refer a provider by means of the aliasTag, you can override the disabled and xsl properties:

<webSource name="aSource">
    ...
  
    <providerMail>
        <recipients>aMail@example.org</recipients>
        <xsl>aMoreSpecific.xsl</xsl>
    </providerMail>
   
    <providerFtpRSS>
        <disabled>true</disabled>
        ...
    </providerFtpRSS>
  
</webSource>

Named Providers

Sometimes, even if you have defined a provider template, it could happen that you have to repeat the same paramters in several source - for example, if you have a list of emails to which attach a number of sources. Im these cases, the right solution is to define a “named provider” under the providers section (under the curiosty root).

A named provider is just like a template, but you can use aliasTags to define them and you must give them a name.

<curiosity>
    <providers>
        <providerMail name="mailToFriendsList">
            <recipients>a@e.org, b@e.org</recipients>
        </providerMail>
    </providers>
</curiosity>

You can refer the name providers in the source in the following way:

<webSource name="aSource">
    ...
    <activate name="mailToFriendsList" />
    ...
</webSource>

You can ovverride xsl and disabled by means of attriburtes:

<webSource name="aSource">
    ...
    <activate name="mailToFriendsList" xsl="anXsl.xsl" />
    ...
</webSource>

While you must always define providers by hand in the configuration file, Curiosity Studio has a limited capability of handling providers: given a web source, you can assign a list of named providers, and/or you can define a new mail provider specific for that source. That's another reason for defining named providers.

next