org.davesag.generica.util.harvester
Interface MediaHarvester

All Known Implementing Classes:
AbstractMediaHarvester

public interface MediaHarvester

The MediaHarvester interface and inner factory class allow us to make media harvester plugins for the system. Media harvesters take a URL and return a fully populated media. Ideally they will do this in a fancy multithreaded way.

Since:
Visuality Lite 1.0.0
Version:
CVS Revision $Id: MediaHarvester.java,v 1.3 2004/03/30 10:13:00 norm Exp $
Author:
Dave Sag http://www.davesag.com

Nested Class Summary
static class MediaHarvester.Factory
          A simple Factory class that loads the named media harvester.
 
Method Summary
 Media getMedia(String url)
          Any implementing class must be able to populate a complete media object given a url.
 void setBasePath(String path)
          Set the base path to write the saved media file to.
 

Method Detail

setBasePath

public void setBasePath(String path)
                 throws IOException
Set the base path to write the saved media file to.

Parameters:
path - The base path for media to be saved to disk.
Throws:
IOException - if the path could not be found.

getMedia

public Media getMedia(String url)
               throws MalformedURLException
Any implementing class must be able to populate a complete media object given a url. It is expected that your implimentation will connect to the url and parse it in according to a preagreed XML DTD. This can not be relied upon however but the user is encouraged to work towards a standard. In the interim we suggest the following very simple xml dtd.
            <?xml version="1.0" encoding="utf-8"?>
            <!DOCTYPE medias [
              <!ELEMENT media-collection (media*)>
              <!ELEMENT media (meta-data+)>
              <!ATTLIST media title CDATA #REQUIRED> 
              <!ATTLIST media media-id CDATA #REQUIRED> 
              <!ATTLIST media source-url CDATA #REQUIRED> 
              <!ATTLIST media linkback-url CDATA #REQUIRED> 
              <!ATTLIST media mime-type CDATA #REQUIRED> 
              <!ELEMENT meta-data EMPTY>
              <!ATTLIST meta-data name CDATA #REQUIRED>
              <!ATTLIST meta-data value CDATA #REQUIRED>
            ]>
 

Parameters:
url - The url to look for the media, or more info about the media
Returns:
A populated Media object.
Throws:
MalformedURLException - if the url provided was junk.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.