Class SFXFileReaderServiceImpl

java.lang.Object
org.dspace.app.sfx.SFXFileReaderServiceImpl
All Implemented Interfaces:
SFXFileReaderService

public class SFXFileReaderServiceImpl extends Object implements 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
  • Field Details

  • Constructor Details

    • SFXFileReaderServiceImpl

      protected SFXFileReaderServiceImpl()
  • Method Details

    • loadSFXFile

      public String loadSFXFile(String fileName, Item item) throws IOException
      Description copied from interface: SFXFileReaderService
      Loads the SFX configuration file
      Specified by:
      loadSFXFile in interface SFXFileReaderService
      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

      public Document parseFile(String fileName)
      Description copied from interface: SFXFileReaderService
      Parses XML file and returns XML document.
      Specified by:
      parseFile in interface SFXFileReaderService
      Parameters:
      fileName - XML file to parse
      Returns:
      XML document or null if error occurred. The error is caught and logged.
    • doNodes

      public String doNodes(Node node, Item item) throws IOException
      Description copied from interface: SFXFileReaderService
      Process the item, mapping each of its metadata fields defined in the configuration file to an OpenURL parameter
      Specified by:
      doNodes in interface SFXFileReaderService
      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
    • processFields

      protected String processFields(Node e, Item item) throws IOException
      Process the field nodes, mapping each metadata field defined in the configuration file to an OpenURL parameter
      Parameters:
      e - 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:
      assembled OpenURL query.
      Throws:
      IOException - if IO error
    • getElement

      public Node getElement(Node node)
      Description copied from interface: SFXFileReaderService
      Returns element node
      Specified by:
      getElement in interface SFXFileReaderService
      Parameters:
      node - element (it is XML tag)
      Returns:
      Element node otherwise null
    • isEmptyTextNode

      public boolean isEmptyTextNode(Node nd)
      Description copied from interface: SFXFileReaderService
      Is Empty text Node *
      Specified by:
      isEmptyTextNode in interface SFXFileReaderService
      Parameters:
      nd - node
      Returns:
      true or false
    • getAttribute

      public String getAttribute(Node e, String name)
      Description copied from interface: SFXFileReaderService
      Returns the value of the node's attribute named <name>
      Specified by:
      getAttribute in interface SFXFileReaderService
      Parameters:
      e - node
      name - name
      Returns:
      value
    • getValue

      public String getValue(Node node)
      Description copied from interface: SFXFileReaderService
      Returns the value found in the Text node (if any) in the node list that's passed in.
      Specified by:
      getValue in interface SFXFileReaderService
      Parameters:
      node - node
      Returns:
      value