Class TemplateDBDAO
- java.lang.Object
-
- dk.netarkivet.harvester.datamodel.TemplateDAO
-
- dk.netarkivet.harvester.datamodel.TemplateDBDAO
-
- All Implemented Interfaces:
DAO
public class TemplateDBDAO extends TemplateDAO
Implements the TemplateDAO with databases.The statements to create the tables are now in scripts/sql/createfullhddb.sql
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create(String orderXmlName, HeritrixTemplate orderXml)
Create a template.boolean
exists(String orderXmlName)
Return true if the database contains a template with the given name.Iterator<String>
getAll()
Returns an iterator with all names of order.xml-templates.Iterator<String>
getAll(boolean active)
Returns an iterator with names of either all active or all inactive order.xml-templates.HeritrixTemplate
read(String orderXmlName)
Read an XML order file for the named order XML.void
update(String orderXmlName, HeritrixTemplate orderXml)
Update a template.-
Methods inherited from class dk.netarkivet.harvester.datamodel.TemplateDAO
getInstance, iterator
-
-
-
-
Method Detail
-
read
public HeritrixTemplate read(String orderXmlName)
Read an XML order file for the named order XML.- Specified by:
read
in classTemplateDAO
- Parameters:
orderXmlName
- The name of the order.xml document- Returns:
- The contents of this order.xml document
-
getAll
public Iterator<String> getAll()
Returns an iterator with all names of order.xml-templates.- Specified by:
getAll
in classTemplateDAO
- Returns:
- Iterator
with all names of templates (without .xml).
-
getAll
public Iterator<String> getAll(boolean active)
Description copied from class:TemplateDAO
Returns an iterator with names of either all active or all inactive order.xml-templates.- Specified by:
getAll
in classTemplateDAO
- Parameters:
active
- true if active templates are wanted, false otherwise.- Returns:
- Iterator
with all names of templates (without .xml).
-
exists
public boolean exists(String orderXmlName)
Return true if the database contains a template with the given name.- Specified by:
exists
in classTemplateDAO
- Parameters:
orderXmlName
- Name of an order.xml template (without .xml).- Returns:
- True if such a template exists.
- Throws:
ArgumentNotValid
- If the orderXmlName is null or an empty String
-
create
public void create(String orderXmlName, HeritrixTemplate orderXml)
Create a template. The template must not already exist.- Specified by:
create
in classTemplateDAO
- Parameters:
orderXmlName
- Name of the template.orderXml
- XML documents that is a Heritrix order.xml template.- Throws:
ArgumentNotValid
- If the orderXmlName is null or an empty String, or the orderXml is null.
-
update
public void update(String orderXmlName, HeritrixTemplate orderXml)
Update a template. The template must already exist.- Specified by:
update
in classTemplateDAO
- Parameters:
orderXmlName
- Name of the template.orderXml
- XML document that is a Heritrix order.xml template.- Throws:
PermissionDenied
- If the template does not existIOFailure
- If the template could not beArgumentNotValid
- If the orderXmlName is null or an empty String, or the orderXml is null.
-
-