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

      • doc

        protected Document doc
        The SFX configuration file
      • itemService

        @Autowired(required=true)
        protected ItemService itemService
    • Constructor Detail

      • SFXFileReaderServiceImpl

        protected SFXFileReaderServiceImpl()
    • Method Detail

      • 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
      • 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