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()
           
 
Method Summary
 void create(java.lang.String orderXmlName, HeritrixTemplate orderXml)
          Create a template.
 void delete(java.lang.String orderXmlName)
          Delete a template entirely from the database.
 java.lang.String describeUsages(java.lang.String orderXmlName)
          Describe where a given template has been used.
 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()
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.

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.

describeUsages

public java.lang.String describeUsages(java.lang.String orderXmlName)
Describe where a given template has been used.

Specified by:
describeUsages in class TemplateDAO
Parameters:
orderXmlName - Name of the template.
Returns:
A string describing the usages of the template, or null if it is not used.

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:
ArgumentNotValid - if not valid order.xml

delete

public void delete(java.lang.String orderXmlName)
Delete a template entirely from the database.

Specified by:
delete in class TemplateDAO
Parameters:
orderXmlName - Name of the template to delete.
Throws:
ArgumentNotValid - if the template is in use.