Class TemplateDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.TemplateDAO
-
- All Implemented Interfaces:
DAO
- Direct Known Subclasses:
TemplateDBDAO
public abstract class TemplateDAO extends Object implements DAO
DAO methods for reading templates only. Implemented as a Singleton
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
create(String orderXmlName, HeritrixTemplate orderXml)
Create a orderxml-template with a given name.abstract boolean
exists(String orderXmlName)
Check, if there exists a orderxml-template with a given name.abstract Iterator<String>
getAll()
Returns an iterator with all names of order.xml-templates.abstract Iterator<String>
getAll(boolean active)
Returns an iterator with names of either all active or all inactive order.xml-templates.static TemplateDAO
getInstance()
Gets the TemplateDAO singleton.Iterator<HeritrixTemplate>
iterator()
Returns an iterator of all templates.abstract HeritrixTemplate
read(String orderXmlName)
Read an orderxml template for the named order XML.abstract void
update(String orderXmlName, HeritrixTemplate orderXml)
Update a specific orderxml-template to contain the contents of the orderXml argument.
-
-
-
Method Detail
-
getInstance
public static TemplateDAO getInstance()
Gets the TemplateDAO singleton.- Returns:
- the singleton.
-
read
public abstract HeritrixTemplate read(String orderXmlName)
Read an orderxml template for the named order XML.- Parameters:
orderXmlName
- The name of the order.xml document- Returns:
- The contents of this order.xml document
-
getAll
public abstract Iterator<String> getAll()
Returns an iterator with all names of order.xml-templates.- Returns:
- Iterator
with all names of templates (without .xml).
-
getAll
public abstract Iterator<String> getAll(boolean active)
Returns an iterator with names of either all active or all inactive order.xml-templates.- Parameters:
active
- true if active templates are wanted, false otherwise.- Returns:
- Iterator
with all names of templates (without .xml).
-
iterator
public Iterator<HeritrixTemplate> iterator()
Returns an iterator of all templates. Note that this is not the most efficient way of getting all names of templates, for that just use getAll(). Implements the Iterable interface.- Returns:
- A list of all current templates.
-
exists
public abstract boolean exists(String orderXmlName)
Check, if there exists a orderxml-template with a given name.- Parameters:
orderXmlName
- a given orderxml name- Returns:
- true, if there exists a orderxml-template with this name
-
create
public abstract void create(String orderXmlName, HeritrixTemplate orderXml)
Create a orderxml-template with a given name.- Parameters:
orderXmlName
- the given nameorderXml
- the Document containing the contents of this new orderxml-template
-
update
public abstract void update(String orderXmlName, HeritrixTemplate orderXml)
Update a specific orderxml-template to contain the contents of the orderXml argument.- Parameters:
orderXmlName
- the name of a specific orderxml-templateorderXml
- the new contents of this template
-
-