public class SFXFileReaderServiceImpl extends Object implements SFXFileReaderService
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.
| Modifier and Type | Field and Description |
|---|---|
protected Document |
doc
The SFX configuration file
|
protected ItemService |
itemService |
| Modifier | Constructor and Description |
|---|---|
protected |
SFXFileReaderServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
String |
doNodes(Node node,
Item item)
Process the item, mapping each of its metadata fields defined in the
configuration file to an OpenURL parameter
|
String |
getAttribute(Node e,
String name)
Returns the value of the node's attribute named
<name> |
Node |
getElement(Node node)
Returns element node
|
String |
getValue(Node node)
Returns the value found in the Text node (if any) in the
node list that's passed in.
|
boolean |
isEmptyTextNode(Node nd)
Is Empty text Node *
|
String |
loadSFXFile(String fileName,
Item item)
Loads the SFX configuration file
|
Document |
parseFile(String fileName)
Parses XML file and returns XML document.
|
protected String |
processFields(Node e,
Item item)
Process the field nodes, mapping each metadata field defined in the
configuration file to an OpenURL parameter
|
protected Document doc
@Autowired(required=true) protected ItemService itemService
public String loadSFXFile(String fileName, Item item) throws IOException
SFXFileReaderServiceloadSFXFile in interface SFXFileReaderServicefileName - The name of the SFX configuration fileitem - The item to process, from which metadata values will be takenIOException - if IO errorpublic Document parseFile(String fileName)
SFXFileReaderServiceparseFile in interface SFXFileReaderServicefileName - XML file to parsepublic String doNodes(Node node, Item item) throws IOException
SFXFileReaderServicedoNodes in interface SFXFileReaderServicenode - DOM node of the mapping pair in the XML file (field element)item - The item to process, from which metadata values will be takenIOException - if IO errorprotected String processFields(Node e, Item item) throws IOException
e - DOM node of the mapping pair in the XML file (field element)item - The item to process, from which metadata values will be takenIOException - if IO errorpublic Node getElement(Node node)
SFXFileReaderServicegetElement in interface SFXFileReaderServicenode - element (it is XML tag)public boolean isEmptyTextNode(Node nd)
SFXFileReaderServiceisEmptyTextNode in interface SFXFileReaderServicend - nodepublic String getAttribute(Node e, String name)
SFXFileReaderService<name>getAttribute in interface SFXFileReaderServicee - nodename - namepublic String getValue(Node node)
SFXFileReaderServicegetValue in interface SFXFileReaderServicenode - nodeCopyright © 2016 DuraSpace. All rights reserved.