dk.netarkivet.harvester.datamodel
Class HarvestChannelDAO

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.HarvestChannelDAO
All Implemented Interfaces:
java.lang.Iterable<HarvestChannel>
Direct Known Subclasses:
HarvestChannelDBDAO

public abstract class HarvestChannelDAO
extends java.lang.Object
implements java.lang.Iterable<HarvestChannel>

Abstract class for the DAO handling the persistence of HarvestChannel instances.


Constructor Summary
HarvestChannelDAO()
          Default empty constructor
 
Method Summary
abstract  void create(HarvestChannel harvestChannel)
          Creates a HarvestChannel object in the storage backend.
abstract  boolean defaultFocusedChannelExists()
          Returns true if a default channel exists for focused jobs.
abstract  java.util.Iterator<HarvestChannel> getAll(boolean includeSnapshot)
          Returns harvest channels by type, sorted first by type (focused first, then broad) and then by name.
abstract  HarvestChannel getById(long id)
          Retrieves a HarvestChannel by its UID.
abstract  HarvestChannel getByName(java.lang.String name)
          Retrieves a HarvestChannel by its unique name.
abstract  HarvestChannel getChannelForHarvestDefinition(long harvestDefinitionId)
          Returns the HarvestChannel mapped to the given HarvestDefinition id.
abstract  HarvestChannel getDefaultChannel(boolean snapshot)
          Returns the default HarvestChannel for the given type of harvest.
static HarvestChannelDAO getInstance()
          Gets the HarvestChannelDAO singleton.
abstract  java.util.Iterator<HarvestChannel> iterator()
           
abstract  void update(HarvestChannel harvestChannel)
          Updates a HarvestChannel object in the storage backend.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HarvestChannelDAO

HarvestChannelDAO()
Default empty constructor

Method Detail

getInstance

public static HarvestChannelDAO getInstance()
Gets the HarvestChannelDAO singleton.

Returns:
the HarvestChannelDAO singleton

iterator

public abstract java.util.Iterator<HarvestChannel> iterator()
Specified by:
iterator in interface java.lang.Iterable<HarvestChannel>

getById

public abstract HarvestChannel getById(long id)
                                throws ArgumentNotValid,
                                       UnknownID
Retrieves a HarvestChannel by its UID.

Parameters:
id - the UID to look for
Returns:
the corresponding instance
Throws:
ArgumentNotValid - if not ID is supplied
UnknownID - if the ID is not present in the persistent storage.

getByName

public abstract HarvestChannel getByName(java.lang.String name)
                                  throws ArgumentNotValid,
                                         UnknownID
Retrieves a HarvestChannel by its unique name.

Parameters:
name - the name to look for
Returns:
the corresponding instance
Throws:
ArgumentNotValid - if not name is supplied
UnknownID - if the name is not present in the persistent storage.

create

public abstract void create(HarvestChannel harvestChannel)
                     throws IOFailure
Creates a HarvestChannel object in the storage backend.

Parameters:
harvestChannel - the HarvestChannel object
Throws:
IOFailure

update

public abstract void update(HarvestChannel harvestChannel)
                     throws IOFailure
Updates a HarvestChannel object in the storage backend.

Parameters:
harvestChannel - the HarvestChannel object
Throws:
IOFailure

getAll

public abstract java.util.Iterator<HarvestChannel> getAll(boolean includeSnapshot)
Returns harvest channels by type, sorted first by type (focused first, then broad) and then by name.

Parameters:
includeSnapshot - if true, returns the single snapshot channel in the iterator.
Returns:
an iterator on HarvestChannel.

defaultFocusedChannelExists

public abstract boolean defaultFocusedChannelExists()
Returns true if a default channel exists for focused jobs.

Returns:
true if a default channel exists for focused jobs, false otherwise.

getDefaultChannel

public abstract HarvestChannel getDefaultChannel(boolean snapshot)
Returns the default HarvestChannel for the given type of harvest.

Parameters:
snapshot - snapshot or partial harvest
Returns:
the default HarvestChannel

getChannelForHarvestDefinition

public abstract HarvestChannel getChannelForHarvestDefinition(long harvestDefinitionId)
Returns the HarvestChannel mapped to the given HarvestDefinition id. If no mapping was explicitly defined, returns null.

Parameters:
harvestDefinitionId - the HarvestDefinition id to look for
Returns:
the mapped HarvestChannel id or null