Skip to content

Create your own Provider

LukasKnuth edited this page Aug 31, 2011 · 1 revision

The library comes with the abstract Provider-class which can easily be used to create own Providers to check for updates on other (maybe your own) sites/blogs/whatever.

This article explains the methods provided by the abstract Provider-class and what they should do.

What does what

The Provider-class is abstract, which means it should be extended by another class to make it become "alive". An abstract Java-class is like a template.

When extending the Provider-class, you'll need to override the following methods:

  • doCheck() <- Called by the UpdateCheck-class to perform the check.
  • getName() <- Returns the name of your Provider (not used yet but maybe later).

The doCheck()-method throws two exceptions which are used to inform the UpdateCheck-class (and the user of your Provider) that and what has gone wrong when trying to check for a new Update.

  • UpdateRequestException <- Should be thrown when there was a problem requesting something from a server (for example if the Server was not reachable).
  • UpdateResponseException <- Should be thrown when the response from the Server/Service/whatever could not be processed (for example if a XML-response could not be parsed).

How to use

After you created your provider, you'll be able to feed it to the UpdateCheck-class just like you would do when using a standard Provider (example).