|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jpos.config.simple.AbstractRegPopulator | +--jpos.config.simple.xml.XercesRegPopulator
Simple implementation of the JposRegPopulator that loads and saves the entries in XML using the "jpos/res/jcl.dtd" DTD and the XML4J (Xerces) API NOTE: this class must define a public no-argument ctor so that it may be created via reflection when its defined in the jpos.properties as the jpos.config.regPopulatorClass
JposPropertiesConst.JPOS_REG_POPULATOR_CLASS_PROP_NAME
Field Summary | |
static java.lang.String |
DTD_FILE_NAME
|
static java.lang.String |
DTD_FILE_PATH
|
static java.lang.String |
DTD_JAR_FILE_NAME
|
static java.lang.String |
DTD_JPOS_FILE_PATH
|
static java.lang.String |
DTD_JPOS_RES_FILE_PATH
|
static java.lang.String |
XERCES_REG_POPULATOR_NAME_STRING
The default name for the XercesRegPopulator |
Fields inherited from class jpos.config.simple.AbstractRegPopulator |
lastLoadException |
Fields inherited from interface jpos.config.simple.xml.XmlRegPopulator |
DEFAULT_XML_FILE_NAME |
Constructor Summary | |
XercesRegPopulator()
Default ctor |
|
XercesRegPopulator(java.lang.String s)
1-arg constructor that takes the unique ID |
Method Summary | |
protected void |
appendCreationElement(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Appends the |
protected void |
appendJposElement(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Appends the |
protected void |
appendProductElement(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Appends the |
protected void |
appendPropElement(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
java.lang.String propName,
java.lang.Object propValue)
Appends the |
protected void |
appendPropElements(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Appends non-required properties name and value |
protected void |
appendVendorElement(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Appends the |
protected void |
checkAndCreateTempDTD()
Checks if JCL DTD is available "jpos/res/jcl.dtd" if not then creates it extracting it from the JAR file |
protected void |
convertJposEntriesToXml(java.util.Enumeration entries,
java.io.OutputStream os)
Converts an Enumeration of JposEntry objects to XML |
protected org.w3c.dom.Document |
createEmptyDocument()
|
protected void |
extractCreationAttr(JposEntry jposEntry,
org.w3c.dom.Element element)
Get the |
protected void |
extractJposAttr(JposEntry jposEntry,
org.w3c.dom.Element element)
Get the |
protected java.util.Enumeration |
extractJposEntries(org.w3c.dom.Document document)
|
protected void |
extractProductAttr(JposEntry jposEntry,
org.w3c.dom.Element element)
Get the |
protected void |
extractPropAttr(JposEntry jposEntry,
org.w3c.dom.Element element)
Get the |
protected void |
extractVendorAttr(JposEntry jposEntry,
org.w3c.dom.Element element)
Get the |
java.lang.String |
getClassName()
|
java.net.URL |
getEntriesURL()
|
java.lang.String |
getName()
|
protected org.apache.xerces.parsers.DOMParser |
getParser()
|
protected void |
insertDateSavedComment(org.w3c.dom.Document document)
Inserts date and info saved in the XML Document object |
protected void |
insertDTDInfo(org.w3c.dom.Document doc,
org.apache.xml.serialize.OutputFormat outFormat)
Inset DTD information in the XML Document object |
protected void |
insertJposEntriesInDoc(org.w3c.dom.Document doc,
java.util.Enumeration entries)
Insert an Enumeration of |
protected void |
insertJposEntryInDoc(org.w3c.dom.Document doc,
org.w3c.dom.Element jposEntryElement,
JposEntry jposEntry)
Insert the |
void |
load()
Tell the populator to load the entries |
void |
load(java.lang.String xmlFileName)
Loads the entries specified in the xmlFileName NOTE: this method is for testing purposes (use public load() method) |
protected void |
readAndCreateTempDtdFile(java.io.InputStream is)
Reads the DTD file from the InputStream provided and creates a temp |
protected void |
removeTempDTD()
Removes JCL DTD "jpos/res/jcl.dtd" if it was created |
void |
save(java.util.Enumeration entries)
Tell the populator to save the current entries |
void |
save(java.util.Enumeration entries,
java.lang.String xmlFileName)
Tell the populator to save the current entries in the file specified |
protected void |
serializeDocument(org.w3c.dom.Document document,
java.util.Enumeration entries,
java.io.OutputStream os)
Serializes the JposEntry objects to an XML document and save to OutputStream |
Methods inherited from class jpos.config.simple.AbstractRegPopulator |
createURLFromFile, createURLFromFile, findFileInClasspath, findFileInJarZipFiles, getEntries, getJposEntries, getLastLoadException, getPopulatorFileIS, getPopulatorFileName, getPopulatorFileOS, getPopulatorFileURL, getUniqueId, isComposite, isPopulatorFileDefined, setUniqueId, toString |
Methods inherited from class java.lang.Object |
|
Methods inherited from interface jpos.config.JposRegPopulator |
getEntries, getLastLoadException, getUniqueId, isComposite |
Field Detail |
public static final java.lang.String DTD_JPOS_FILE_PATH
public static final java.lang.String DTD_JPOS_RES_FILE_PATH
public static final java.lang.String DTD_JAR_FILE_NAME
public static final java.lang.String DTD_FILE_PATH
public static final java.lang.String DTD_FILE_NAME
public static final java.lang.String XERCES_REG_POPULATOR_NAME_STRING
Constructor Detail |
public XercesRegPopulator()
public XercesRegPopulator(java.lang.String s)
s
- the unique ID stringMethod Detail |
public java.lang.String getClassName()
getClassName
in interface JposRegPopulator
public void save(java.util.Enumeration entries) throws java.lang.Exception
save
in interface JposRegPopulator
save
in class AbstractRegPopulator
entries
- an enumeration of JposEntry objectsjava.lang.Exception
- if any error occurs while savingpublic void save(java.util.Enumeration entries, java.lang.String xmlFileName) throws java.lang.Exception
save
in interface JposRegPopulator
save
in class AbstractRegPopulator
entries
- an enumeration of JposEntry objectsxmlFileName
- the XML file name to save entriesjava.lang.Exception
- if any error occurs while savingpublic void load()
load
in interface JposRegPopulator
load
in class AbstractRegPopulator
public void load(java.lang.String xmlFileName)
load
in interface JposRegPopulator
load
in class AbstractRegPopulator
xmlFileName
- the XML file namepublic java.net.URL getEntriesURL()
getEntriesURL
in interface JposRegPopulator
getEntriesURL
in class AbstractRegPopulator
public java.lang.String getName()
getName
in interface JposRegPopulator
getName
in class AbstractRegPopulator
protected void checkAndCreateTempDTD()
protected void readAndCreateTempDtdFile(java.io.InputStream is) throws java.io.IOException
java.io.IOException
- if anything goes wrongprotected void removeTempDTD()
protected org.apache.xerces.parsers.DOMParser getParser()
protected java.util.Enumeration extractJposEntries(org.w3c.dom.Document document)
document
- the XML document objectprotected void extractCreationAttr(JposEntry jposEntry, org.w3c.dom.Element element)
jposEntry
- the entry to add properties toelement
- the protected void extractVendorAttr(JposEntry jposEntry, org.w3c.dom.Element element)
jposEntry
- the entry to add properties toelement
- the protected void extractJposAttr(JposEntry jposEntry, org.w3c.dom.Element element)
jposEntry
- the entry to add properties toelement
- the protected void extractProductAttr(JposEntry jposEntry, org.w3c.dom.Element element)
jposEntry
- the entry to add properties toelement
- the protected void extractPropAttr(JposEntry jposEntry, org.w3c.dom.Element element) throws JposConfigException
jposEntry
- the entry to add properties toelement
- the JposConfigException
- if the property value does not match the type or is
not a valid value (like for instance an invalid number)protected void convertJposEntriesToXml(java.util.Enumeration entries, java.io.OutputStream os) throws java.lang.Exception
entries
- an Enumeration of JposEntry objectsos
- the OutputStream to stream the entries tojava.lang.Exception
- if something goes wrong serializingprotected void serializeDocument(org.w3c.dom.Document document, java.util.Enumeration entries, java.io.OutputStream os) throws java.lang.Exception
document
- the XML document objectentries
- an Enumeration of JposEntry objectsos
- the OuputStream objectjava.lang.Exception
- anything goes wrong while savingprotected void appendCreationElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void appendVendorElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void appendJposElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void appendProductElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void appendPropElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, java.lang.String propName, java.lang.Object propValue)
doc
- the XML Document objectjposEntryElement
- the propName
- the property namepropValue
- the property valueprotected void appendPropElements(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void insertJposEntryInDoc(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)
doc
- the XML Document objectjposEntryElement
- the jposEntry
- the JposEntry objectprotected void insertJposEntriesInDoc(org.w3c.dom.Document doc, java.util.Enumeration entries)
doc
- the XML Document objectentries
- an Enumeration of JposEntry objectsprotected org.w3c.dom.Document createEmptyDocument()
protected void insertDTDInfo(org.w3c.dom.Document doc, org.apache.xml.serialize.OutputFormat outFormat) throws java.lang.Exception
doc
- the XML Document objectoutFormat
- the OuputFormat objectjava.lang.Exception
- in case something goes wrongprotected void insertDateSavedComment(org.w3c.dom.Document document) throws java.lang.Exception
document
- the XML Document objectjava.lang.Exception
- in case something goes wrong
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |