Package org.dlese.dpc.vocab
Class LoadMetadataOPML
java.lang.Object
org.dlese.dpc.vocab.LoadMetadataOPML
- All Implemented Interfaces:
ContentHandler
Loads metadata groups from files specified by a given XML configuration
file.
- Author:
- Ryan Deardorff
-
Constructor Summary
ConstructorsConstructorDescriptionLoadMetadataOPML(boolean debug) Constructor for the LoadMetadataVocabs object that does nothing (uses getMetadataVocabInstance() method to load and retrieve an instance of a vocab). -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) (SAX) Element data (characters between tags)void(SAX) Required by SAX, but not used herevoidendElement(String namespaceURI, String localName, String qName) (SAX) Invoked upon closing tag of an XML elementvoidendPrefixMapping(String prefix) (SAX) Required by SAX, but not used hereGets the configFile attribute of the LoadMetadataVocabs objectstatic StringReturn a string for the current time and date, sutiable for display in log files and output to standout:Gets the message attribute of the LoadMetadataVocabs objectstatic MetadataVocabgetMetadataVocabInstance(String configFile) Gets the metadataVocabInstance attribute of the LoadMetadataOPML classstatic voidgetMetadataVocabInstance(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.voidignorableWhitespace(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.voidload()Load (or reload) the vocabularyvoidprocessingInstruction(String target, String data) (SAX) Required by SAX, but not used herevoidsetDocumentLocator(Locator locator) (SAX) Sets the SAX locator, which indicates the current position of the parser within the document (line number, column number).voidskippedEntity(String name) (SAX) Required by SAX, but not used herevoid(SAX) Required by SAX, but not used herevoidstartElement(String namespaceURI, String localName, String qName, Attributes atts) (SAX) Invoked upon opening tag of an XML elementvoidstartPrefixMapping(String prefix, String uri) (SAX) Required by SAX, but not used hereMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
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 Details
-
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:
configFile- Base loader file (lists groups/fields listings)contextAttributeName- The MetadataVocab instance is stored in app scope as thisservletContext- The java servlet context in which to store the loaded vocabulariesvocabTextFile- Optional (can be NULL) file where vocabs get listed as text strings (for use by log analysis/reporting)debug-
-
getMetadataVocabInstance
Gets the metadataVocabInstance attribute of the LoadMetadataOPML class- Parameters:
configFile-- Returns:
- The metadataVocabInstance value
-
load
public void load()Load (or reload) the vocabulary -
getMessage
Gets the message attribute of the LoadMetadataVocabs object- Returns:
- The message value
-
getConfigFile
Gets the configFile attribute of the LoadMetadataVocabs object- Returns:
- The configFile value
-
setDocumentLocator
(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:
setDocumentLocatorin interfaceContentHandler- Parameters:
locator- The new documentLocator value
-
startDocument
(SAX) Required by SAX, but not used here- Specified by:
startDocumentin interfaceContentHandler- Throws:
SAXException
-
endDocument
(SAX) Required by SAX, but not used here- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException
-
startPrefixMapping
(SAX) Required by SAX, but not used here- Specified by:
startPrefixMappingin interfaceContentHandler- Parameters:
prefix-uri-- Throws:
SAXException
-
endPrefixMapping
(SAX) Required by SAX, but not used here- Specified by:
endPrefixMappingin interfaceContentHandler- 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:
startElementin interfaceContentHandler- Parameters:
namespaceURI- XML namespacelocalName- local tag nameqName- fully qualified tag nameatts- tag attributes- Throws:
SAXException
-
endElement
(SAX) Invoked upon closing tag of an XML element- Specified by:
endElementin interfaceContentHandler- Parameters:
namespaceURI- XML namespacelocalName- local tag nameqName- fully qualified tag name- Throws:
SAXException
-
characters
(SAX) Element data (characters between tags)- Specified by:
charactersin interfaceContentHandler- Parameters:
ch- character arraystart- starting index of character datalength- length of character data- Throws:
SAXException
-
ignorableWhitespace
(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:
ignorableWhitespacein interfaceContentHandler- Parameters:
ch-start-length-- Throws:
SAXException
-
processingInstruction
(SAX) Required by SAX, but not used here- Specified by:
processingInstructionin interfaceContentHandler- Parameters:
target-data-- Throws:
SAXException
-
skippedEntity
(SAX) Required by SAX, but not used here- Specified by:
skippedEntityin interfaceContentHandler- Parameters:
name-- Throws:
SAXException
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-