Class HarvestChannelDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.HarvestChannelDAO
-
- All Implemented Interfaces:
DAO
,Iterable<HarvestChannel>
- Direct Known Subclasses:
HarvestChannelDBDAO
public abstract class HarvestChannelDAO extends Object implements DAO, Iterable<HarvestChannel>
Abstract class for the DAO handling the persistence ofHarvestChannel
instances.- Author:
- ngiraud
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
create(HarvestChannel harvestChannel)
Creates aHarvestChannel
object in the storage backend.abstract boolean
defaultFocusedChannelExists()
Returns true if a default channel exists for focused jobs.abstract 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 aHarvestChannel
by its UID.abstract HarvestChannel
getByName(String name)
Retrieves aHarvestChannel
by its unique name.abstract HarvestChannel
getChannelForHarvestDefinition(long harvestDefinitionId)
Returns theHarvestChannel
mapped to the givenHarvestDefinition
id.abstract HarvestChannel
getDefaultChannel(boolean snapshot)
Returns the defaultHarvestChannel
for the given type of harvest.static HarvestChannelDAO
getInstance()
Gets theHarvestChannelDAO
singleton.abstract Iterator<HarvestChannel>
iterator()
abstract void
update(HarvestChannel harvestChannel)
Updates aHarvestChannel
object in the storage backend.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
getInstance
public static HarvestChannelDAO getInstance()
Gets theHarvestChannelDAO
singleton.- Returns:
- the
HarvestChannelDAO
singleton
-
iterator
public abstract Iterator<HarvestChannel> iterator()
- Specified by:
iterator
in interfaceIterable<HarvestChannel>
-
getById
public abstract HarvestChannel getById(long id) throws ArgumentNotValid, UnknownID
Retrieves aHarvestChannel
by its UID.- Parameters:
id
- the UID to look for- Returns:
- the corresponding instance
- Throws:
ArgumentNotValid
- if not ID is suppliedUnknownID
- if the ID is not present in the persistent storage.
-
getByName
public abstract HarvestChannel getByName(String name) throws ArgumentNotValid, UnknownID
Retrieves aHarvestChannel
by its unique name.- Parameters:
name
- the name to look for- Returns:
- the corresponding instance
- Throws:
ArgumentNotValid
- if not name is suppliedUnknownID
- if the name is not present in the persistent storage.
-
create
public abstract void create(HarvestChannel harvestChannel) throws IOFailure
Creates aHarvestChannel
object in the storage backend.- Parameters:
harvestChannel
- theHarvestChannel
object- Throws:
IOFailure
-
update
public abstract void update(HarvestChannel harvestChannel) throws IOFailure
Updates aHarvestChannel
object in the storage backend.- Parameters:
harvestChannel
- theHarvestChannel
object- Throws:
IOFailure
-
getAll
public abstract 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 defaultHarvestChannel
for the given type of harvest.- Parameters:
snapshot
- snapshot or partial harvest- Returns:
- the default
HarvestChannel
-
getChannelForHarvestDefinition
public abstract HarvestChannel getChannelForHarvestDefinition(long harvestDefinitionId)
Returns theHarvestChannel
mapped to the givenHarvestDefinition
id. If no mapping was explicitly defined, returns null.- Parameters:
harvestDefinitionId
- theHarvestDefinition
id to look for- Returns:
- the mapped
HarvestChannel
id or null
-
-