DLESE Tools
v1.6.0

org.dlese.dpc.vocab
Class LoadMetadataOPML

java.lang.Object
  extended by org.dlese.dpc.vocab.LoadMetadataOPML
All Implemented Interfaces:
ContentHandler

public class LoadMetadataOPML
extends Object
implements ContentHandler

Loads metadata groups from files specified by a given XML configuration file.

Author:
Ryan Deardorff

Constructor Summary
LoadMetadataOPML(boolean debug)
          Constructor for the LoadMetadataVocabs object that does nothing (uses getMetadataVocabInstance() method to load and retrieve an instance of a vocab).
 
Method Summary
 void characters(char[] ch, int start, int length)
          (SAX) Element data (characters between tags)
 void endDocument()
          (SAX) Required by SAX, but not used here
 void endElement(String namespaceURI, String localName, String qName)
          (SAX) Invoked upon closing tag of an XML element
 void endPrefixMapping(String prefix)
          (SAX) Required by SAX, but not used here
 String getConfigFile()
          Gets the configFile attribute of the LoadMetadataVocabs object
static String getDateStamp()
          Return a string for the current time and date, sutiable for display in log files and output to standout:
 String getMessage()
          Gets the message attribute of the LoadMetadataVocabs object
static MetadataVocab getMetadataVocabInstance(String configFile)
          Gets the metadataVocabInstance attribute of the LoadMetadataOPML class
static void getMetadataVocabInstance(String configFile, String contextAttributeName, ServletContext servletContext, String vocabTextFile, boolean debug)
          Loads an instance of a MetadataVocab object and sets it as a servlet context attribute.
 void ignorableWhitespace(char[] ch, int start, int length)
          (SAX) Reports any whitespace that is ignored because it falls outside of the DTD or schema definition--usefull for re-generating the file with indents intact, though.
 void load()
          Load (or reload) the vocabulary
 void processingInstruction(String target, String data)
          (SAX) Required by SAX, but not used here
 void setDocumentLocator(Locator locator)
          (SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number).
 void skippedEntity(String name)
          (SAX) Required by SAX, but not used here
 void startDocument()
          (SAX) Required by SAX, but not used here
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          (SAX) Invoked upon opening tag of an XML element
 void startPrefixMapping(String prefix, String uri)
          (SAX) Required by SAX, but not used here
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadMetadataOPML

public LoadMetadataOPML(boolean debug)
Constructor for the LoadMetadataVocabs object that does nothing (uses getMetadataVocabInstance() method to load and retrieve an instance of a vocab).

Parameters:
debug -
Method Detail

getMetadataVocabInstance

public static void getMetadataVocabInstance(String configFile,
                                            String contextAttributeName,
                                            ServletContext servletContext,
                                            String vocabTextFile,
                                            boolean debug)
Loads an instance of a MetadataVocab object and sets it as a servlet context attribute.

Parameters:
servletContext - The java servlet context in which to store the loaded vocabularies
vocabTextFile - Optional (can be NULL) file where vocabs get listed as text strings (for use by log analysis/reporting)
contextAttributeName - The MetadataVocab instance is stored in app scope as this
configFile - Base loader file (lists groups/fields listings)
debug -

getMetadataVocabInstance

public static MetadataVocab getMetadataVocabInstance(String configFile)
Gets the metadataVocabInstance attribute of the LoadMetadataOPML class

Parameters:
configFile -
Returns:
The metadataVocabInstance value

load

public void load()
Load (or reload) the vocabulary


getMessage

public String getMessage()
Gets the message attribute of the LoadMetadataVocabs object

Returns:
The message value

getConfigFile

public String getConfigFile()
Gets the configFile attribute of the LoadMetadataVocabs object

Returns:
The configFile value

setDocumentLocator

public void setDocumentLocator(Locator locator)
(SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number). Could be used to indicate the spot where an error occured.

Specified by:
setDocumentLocator in interface ContentHandler
Parameters:
locator - The new documentLocator value

startDocument

public void startDocument()
                   throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
startPrefixMapping in interface ContentHandler
Parameters:
prefix -
uri -
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
endPrefixMapping in interface ContentHandler
Parameters:
prefix -
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
(SAX) Invoked upon opening tag of an XML element

Specified by:
startElement in interface ContentHandler
Parameters:
namespaceURI - XML namespace
localName - local tag name
qName - fully qualified tag name
atts - tag attributes
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
(SAX) Invoked upon closing tag of an XML element

Specified by:
endElement in interface ContentHandler
Parameters:
namespaceURI - XML namespace
localName - local tag name
qName - fully qualified tag name
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
(SAX) Element data (characters between tags)

Specified by:
characters in interface ContentHandler
Parameters:
ch - character array
start - starting index of character data
length - length of character data
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
(SAX) Reports any whitespace that is ignored because it falls outside of the DTD or schema definition--usefull for re-generating the file with indents intact, though.

Specified by:
ignorableWhitespace in interface ContentHandler
Parameters:
ch -
start -
length -
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
processingInstruction in interface ContentHandler
Parameters:
target -
data -
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
(SAX) Required by SAX, but not used here

Specified by:
skippedEntity in interface ContentHandler
Parameters:
name -
Throws:
SAXException

getDateStamp

public static String getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:

Returns:
The dateStamp value

DLESE Tools
v1.6.0