com.googlecode.fascinator.common.harvester.impl
Class GenericHarvester

java.lang.Object
  extended by com.googlecode.fascinator.common.harvester.impl.GenericHarvester
All Implemented Interfaces:
Harvester, Plugin

public abstract class GenericHarvester
extends java.lang.Object
implements Harvester

Generic Harvester implementation that provides common functionality for subclasses.

Author:
Oliver Lucido

Constructor Summary
GenericHarvester(java.lang.String id, java.lang.String name)
          Constructor
 
Method Summary
 java.util.Set<java.lang.String> getDeletedObjectIdList()
          Gets a list of deleted digital object IDs.
 java.lang.String getId()
          Gets an identifier for Harvester plugin
 JsonSimpleConfig getJsonConfig()
          Get config file
 java.lang.String getName()
          Get a name for Harvester plugin
 java.util.Set<java.lang.String> getObjectId(java.io.File uploadedFile)
          Get an individual uploaded file as a digital object.
 PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 Storage getStorage()
          Get storage instance that the Harvester will use to manage objects.
 boolean hasMoreDeletedObjects()
          Tests whether there are more objects to retrieve.
abstract  void init()
          Abstract method for Harvester plugin
 void init(java.io.File jsonFile)
          Initialises the plugin using the specified JSON configuration
 void init(java.lang.String jsonString)
          Initialises the plugin using the specified JSON String
 void setStorage(Storage storage)
          Sets the Storage instance that the Harvester will use to manage objects.
 void shutdown()
          Shuts down the plugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.googlecode.fascinator.api.harvester.Harvester
getObjectIdList, hasMoreObjects
 

Constructor Detail

GenericHarvester

public GenericHarvester(java.lang.String id,
                        java.lang.String name)
Constructor

Parameters:
id - Harvester Id
name - Harvester Name
Method Detail

getObjectId

public java.util.Set<java.lang.String> getObjectId(java.io.File uploadedFile)
                                            throws HarvesterException
Get an individual uploaded file as a digital object. For consistency this should be in a list.

Specified by:
getObjectId in interface Harvester
Returns:
a list of one object ID
Throws:
HarvesterException - if there was an error retrieving the objects

getDeletedObjectIdList

public java.util.Set<java.lang.String> getDeletedObjectIdList()
                                                       throws HarvesterException
Gets a list of deleted digital object IDs. If there are no deleted objects, this method should return an empty list, not null.

Specified by:
getDeletedObjectIdList in interface Harvester
Returns:
a list of objects IDs, possibly empty
Throws:
HarvesterException - if there was an error retrieving the objects

hasMoreDeletedObjects

public boolean hasMoreDeletedObjects()
Tests whether there are more objects to retrieve. This method should return true if called before getObjects.

Specified by:
hasMoreDeletedObjects in interface Harvester
Returns:
true if there are more objects to retrieve, false otherwise

getStorage

public Storage getStorage()
                   throws HarvesterException
Get storage instance that the Harvester will use to manage objects.

Returns:
storage instance
Throws:
HarvesterException - if storage plugin is not set

setStorage

public void setStorage(Storage storage)
Sets the Storage instance that the Harvester will use to manage objects.

Specified by:
setStorage in interface Harvester
Parameters:
storage - a storage instance

getId

public java.lang.String getId()
Gets an identifier for Harvester plugin

Specified by:
getId in interface Plugin
Returns:
the plugin type id

getName

public java.lang.String getName()
Get a name for Harvester plugin

Specified by:
getName in interface Plugin
Returns:
the plugin name

getPluginDetails

public PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface Plugin
Returns:
a PluginDescription

init

public void init(java.io.File jsonFile)
          throws PluginException
Initialises the plugin using the specified JSON configuration

Specified by:
init in interface Plugin
Parameters:
jsonFile - JSON configuration file
Throws:
PluginException - if there was an error during initialisation

init

public void init(java.lang.String jsonString)
          throws PluginException
Initialises the plugin using the specified JSON String

Specified by:
init in interface Plugin
Parameters:
jsonFile - JSON configuration file
Throws:
PluginException - if there was an error during initialisation

init

public abstract void init()
                   throws HarvesterException
Abstract method for Harvester plugin

Throws:
HarvesterException - if there was an error during initialisation

shutdown

public void shutdown()
              throws PluginException
Shuts down the plugin

Specified by:
shutdown in interface Plugin
Throws:
PluginException - if there was an error during shutdown

getJsonConfig

public JsonSimpleConfig getJsonConfig()
                               throws HarvesterException
Get config file

Returns:
config file
Throws:
HarvesterException - if there was an error during retrieval


Copyright © 2009-2013. All Rights Reserved.