dk.netarkivet.harvester.datamodel
Class TemplateDAO

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.TemplateDAO
Direct Known Subclasses:
TemplateDBDAO

public abstract class TemplateDAO
extends java.lang.Object

DAO methods for reading templates only. Implemented as a Singleton


Constructor Summary
TemplateDAO()
          Constructor for TemplateDAO.
 
Method Summary
abstract  void create(java.lang.String orderXmlName, HeritrixTemplate orderXml)
          Create a orderxml-template with a given name.
abstract  boolean exists(java.lang.String orderXmlName)
          Check, if there exists a orderxml-template with a given name.
abstract  java.util.Iterator<java.lang.String> getAll()
          Returns an iterator with all names of order.xml-templates.
static TemplateDAO getInstance()
          Gets the TemplateDAO singleton.
 java.util.Iterator<HeritrixTemplate> iterator()
          Returns an iterator of all templates.
abstract  HeritrixTemplate read(java.lang.String orderXmlName)
          Read an orderxml template for the named order XML.
(package private) static void resetSingleton()
          Resets the singleton.
abstract  void update(java.lang.String orderXmlName, HeritrixTemplate orderXml)
          Update a specific orderxml-template to contain the contents of the orderXml argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateDAO

TemplateDAO()
Constructor for TemplateDAO. The real construction is done inside the getInstance method.

Method Detail

getInstance

public static TemplateDAO getInstance()
Gets the TemplateDAO singleton.

Returns:
the singleton.

read

public abstract HeritrixTemplate read(java.lang.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 java.util.Iterator<java.lang.String> getAll()
Returns an iterator with all names of order.xml-templates.

Returns:
Iterator with all names of templates (without .xml).

iterator

public java.util.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(java.lang.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(java.lang.String orderXmlName,
                            HeritrixTemplate orderXml)
Create a orderxml-template with a given name.

Parameters:
orderXmlName - the given name
orderXml - the Document containing the contents of this new orderxml-template

update

public abstract void update(java.lang.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-template
orderXml - the new contents of this template

resetSingleton

static void resetSingleton()
Resets the singleton. Only for use from tests.