dk.netarkivet.harvester.datamodel
Class TemplateDBDAO

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.TemplateDAO
      extended by dk.netarkivet.harvester.datamodel.TemplateDBDAO

public class TemplateDBDAO
extends TemplateDAO

Implements the TemplateDAO with databases. The statements to create the tables are now in scripts/sql/createfullhddb.sql


Constructor Summary
TemplateDBDAO()
          Default constructor.
 
Method Summary
 void create(java.lang.String orderXmlName, HeritrixTemplate orderXml)
          Create a template.
 boolean exists(java.lang.String orderXmlName)
          Return true if the database contains a template with the given name.
 java.util.Iterator<java.lang.String> getAll()
          Returns an iterator with all names of order.xml-templates.
 HeritrixTemplate read(java.lang.String orderXmlName)
          Read an XML order file for the named order XML.
 void update(java.lang.String orderXmlName, HeritrixTemplate orderXml)
          Update a template.
 
Methods inherited from class dk.netarkivet.harvester.datamodel.TemplateDAO
getInstance, iterator, resetSingleton
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateDBDAO

TemplateDBDAO()
Default constructor. Only used by TemplateDAO,getInstance().

Method Detail

read

public HeritrixTemplate read(java.lang.String orderXmlName)
Read an XML order file for the named order XML.

Specified by:
read in class TemplateDAO
Parameters:
orderXmlName - The name of the order.xml document
Returns:
The contents of this order.xml document

getAll

public java.util.Iterator<java.lang.String> getAll()
Returns an iterator with all names of order.xml-templates.

Specified by:
getAll in class TemplateDAO
Returns:
Iterator with all names of templates (without .xml).

exists

public boolean exists(java.lang.String orderXmlName)
Return true if the database contains a template with the given name.

Specified by:
exists in class TemplateDAO
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(java.lang.String orderXmlName,
                   HeritrixTemplate orderXml)
Create a template. The template must not already exist.

Specified by:
create in class TemplateDAO
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(java.lang.String orderXmlName,
                   HeritrixTemplate orderXml)
Update a template. The template must already exist.

Specified by:
update in class TemplateDAO
Parameters:
orderXmlName - Name of the template.
orderXml - XML document that is a Heritrix order.xml template.
Throws:
PermissionDenied - If the template does not exist
IOFailure - If the template could not be
ArgumentNotValid - If the orderXmlName is null or an empty String, or the orderXml is null.