Class 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 Detail

      • read

        public HeritrixTemplate read​(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 Iterator<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).
      • 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 class TemplateDAO
        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 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​(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​(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.