Interface SFXFileReaderService

  • All Known Implementing Classes:
    SFXFileReaderServiceImpl

    public interface SFXFileReaderService
    XML configuration file reader for DSpace metadata fields (DC) mapping to OpenURL parameters.

    This class reads the [dspace]/config/sfx.xml configuration file, which contains pairs of DSpace item metadata values and OpenURL parameter names. Then it takes an item and constructs an OpenURL for it with values of parameters filled in from the paired metadata fields.

    Version:
    $Revision$
    Author:
    Stuart Lewis, Graham Triggs
    • Method Detail

      • loadSFXFile

        String loadSFXFile​(String fileName,
                           Item item)
                    throws IOException
        Loads the SFX configuration file
        Parameters:
        fileName - The name of the SFX configuration file
        item - The item to process, from which metadata values will be taken
        Returns:
        the SFX string
        Throws:
        IOException - if IO error
      • parseFile

        Document parseFile​(String fileName)
        Parses XML file and returns XML document.
        Parameters:
        fileName - XML file to parse
        Returns:
        XML document or null if error occurred. The error is caught and logged.
      • doNodes

        String doNodes​(Node node,
                       Item item)
                throws IOException
        Process the item, mapping each of its metadata fields defined in the configuration file to an OpenURL parameter
        Parameters:
        node - DOM node of the mapping pair in the XML file (field element)
        item - The item to process, from which metadata values will be taken
        Returns:
        processed fields.
        Throws:
        IOException - if IO error
      • getElement

        Node getElement​(Node node)
        Returns element node
        Parameters:
        node - element (it is XML tag)
        Returns:
        Element node otherwise null
      • isEmptyTextNode

        boolean isEmptyTextNode​(Node nd)
        Is Empty text Node *
        Parameters:
        nd - node
        Returns:
        true or false
      • getAttribute

        String getAttribute​(Node e,
                            String name)
        Returns the value of the node's attribute named <name>
        Parameters:
        e - node
        name - name
        Returns:
        value
      • getValue

        String getValue​(Node node)
        Returns the value found in the Text node (if any) in the node list that's passed in.
        Parameters:
        node - node
        Returns:
        value