Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpos.config.simple.xml
Class XercesRegPopulator

    java.lang.Object
      |
      +--jpos.config.simple.AbstractRegPopulator
            |
            +--jpos.config.simple.xml.XercesRegPopulator

All Implemented Interfaces:
  JposRegPopulator, XmlRegPopulator

public class XercesRegPopulator
extends AbstractRegPopulator
implements XmlRegPopulator

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

Since:
  1.2 (NY 2K meeting)
Author:
  E. Michael Maximilien (maxim@us.ibm.com)
See Also:
  `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 element to the document
`protected void` | `appendJposElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)` Appends the element to the document
`protected void` | `appendProductElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)` Appends the element to the document
`protected void` | `appendPropElement(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, java.lang.String propName, java.lang.Object propValue)` Appends the element to the document
`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 element to the document
`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 element attributes and adds corresponding properties to JposEntry
`protected void` | `extractJposAttr(JposEntry jposEntry, org.w3c.dom.Element element)` Get the element attributes and adds corresponding properties to JposEntry
`protected java.util.Enumeration` | `extractJposEntries(org.w3c.dom.Document document)`
`protected void` | `extractProductAttr(JposEntry jposEntry, org.w3c.dom.Element element)` Get the element attributes and adds corresponding properties to JposEntry
`protected void` | `extractPropAttr(JposEntry jposEntry, org.w3c.dom.Element element)` Get the element attributes and adds corresponding properties to JposEntry
`protected void` | `extractVendorAttr(JposEntry jposEntry, org.w3c.dom.Element element)` Get the element attributes and adds corresponding properties to JposEntry
`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 objects in the XML document
`protected void` | `insertJposEntryInDoc(org.w3c.dom.Document doc, org.w3c.dom.Element jposEntryElement, JposEntry jposEntry)` Insert the in the XML document object
`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
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface jpos.config.JposRegPopulator
`getEntries, getLastLoadException, getUniqueId, isComposite`

Field Detail

### DTD_JPOS_FILE_PATH

    public static final java.lang.String DTD_JPOS_FILE_PATH

### DTD_JPOS_RES_FILE_PATH

    public static final java.lang.String DTD_JPOS_RES_FILE_PATH

### DTD_JAR_FILE_NAME

    public static final java.lang.String DTD_JAR_FILE_NAME

### DTD_FILE_PATH

    public static final java.lang.String DTD_FILE_PATH

### DTD_FILE_NAME

    public static final java.lang.String DTD_FILE_NAME

### XERCES_REG_POPULATOR_NAME_STRING

    public static final java.lang.String XERCES_REG_POPULATOR_NAME_STRING

  The default name for the XercesRegPopulator
  Since:
    1.3 (Washington DC 2001 meeting)

Constructor Detail

### XercesRegPopulator

    public XercesRegPopulator()

  Default ctor
  Since:
    1.2 (NY 2K meeting)

### XercesRegPopulator

    public XercesRegPopulator(java.lang.String s)

  1-arg constructor that takes the unique ID
  Parameters:
    `s` - the unique ID string
  Since:
    1.3 (Washington DC 2001)

Method Detail

### getClassName

    public java.lang.String getClassName()

  Specified by:
    `getClassName` in interface `JposRegPopulator`
  Returns:
    the fully qualified class name implementing the JposRegPopulator interface
  Since:
    1.3 (Washington DC 2001 meeting)

### save

    public void save(java.util.Enumeration entries)
              throws java.lang.Exception

  Tell the populator to save the current entries
  Specified by:
    `save` in interface `JposRegPopulator`
  Overrides:
    `save` in class `AbstractRegPopulator`
  Parameters:
    `entries` - an enumeration of JposEntry objects
  Throws:
    `java.lang.Exception` - if any error occurs while saving
  Since:
    1.2 (NY 2K meeting)

### save

    public void save(java.util.Enumeration entries,
                     java.lang.String xmlFileName)
              throws java.lang.Exception

  Tell the populator to save the current entries in the file specified
  Specified by:
    `save` in interface `JposRegPopulator`
  Overrides:
    `save` in class `AbstractRegPopulator`
  Parameters:
    `entries` - an enumeration of JposEntry objects
    `xmlFileName` - the XML file name to save entries
  Throws:
    `java.lang.Exception` - if any error occurs while saving
  Since:
    1.3 (SF 2K meeting)

### load

    public void load()

  Tell the populator to load the entries
  Specified by:
    `load` in interface `JposRegPopulator`
  Overrides:
    `load` in class `AbstractRegPopulator`
  Since:
    1.2 (NY 2K meeting)

### load

    public void load(java.lang.String xmlFileName)

  Loads the entries specified in the xmlFileName NOTE: this method is for testing purposes (use public load() method)
  Specified by:
    `load` in interface `JposRegPopulator`
  Overrides:
    `load` in class `AbstractRegPopulator`
  Parameters:
    `xmlFileName` - the XML file name
  Since:
    1.3 (SF 2K meeting)

### getEntriesURL

    public java.net.URL getEntriesURL()

  Specified by:
    `getEntriesURL` in interface `JposRegPopulator`
  Overrides:
    `getEntriesURL` in class `AbstractRegPopulator`
  Returns:
    the URL pointing to the entries file loaded or saved
  Since:
    1.2 (NY 2K meeting)

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `JposRegPopulator`
  Overrides:
    `getName` in class `AbstractRegPopulator`
  Returns:
    the name of this populator. This should be a short descriptive name
  Since:
    1.3 (Washington DC 2001 meeting)

### checkAndCreateTempDTD

    protected void checkAndCreateTempDTD()

  Checks if JCL DTD is available "jpos/res/jcl.dtd" if not then creates it extracting it from the JAR file
  Since:
    1.2 (SF 2K meeting)

### readAndCreateTempDtdFile

    protected void readAndCreateTempDtdFile(java.io.InputStream is)
                                     throws java.io.IOException

  Reads the DTD file from the InputStream provided and creates a temp
  Throws:
    `java.io.IOException` - if anything goes wrong
  Since:
    1.2 (SF 2K meeting)

### removeTempDTD

    protected void removeTempDTD()

  Removes JCL DTD "jpos/res/jcl.dtd" if it was created
  Since:
    1.2 (SF 2K meeting)

### getParser

    protected org.apache.xerces.parsers.DOMParser getParser()

  Returns:
    the DOM parser object
  Since:
    1.2 (NY 2K meeting)

### extractJposEntries

    protected java.util.Enumeration extractJposEntries(org.w3c.dom.Document document)

  Parameters:
    `document` - the XML document object
  Returns:
    an enumeration of JposEntry objects read from the XML document object
  Since:
    1.2 (NY 2K meeting)

### extractCreationAttr

    protected void extractCreationAttr(JposEntry jposEntry,
                                       org.w3c.dom.Element element)

  Get the element attributes and adds corresponding properties to JposEntry
  Parameters:
    `jposEntry` - the entry to add properties to
    `element` - the XML element
  Since:
    1.2 (NY 2K meeting)

### extractVendorAttr

    protected void extractVendorAttr(JposEntry jposEntry,
                                     org.w3c.dom.Element element)

  Get the element attributes and adds corresponding properties to JposEntry
  Parameters:
    `jposEntry` - the entry to add properties to
    `element` - the XML element
  Since:
    1.2 (NY 2K meeting)

### extractJposAttr

    protected void extractJposAttr(JposEntry jposEntry,
                                   org.w3c.dom.Element element)

  Get the element attributes and adds corresponding properties to JposEntry
  Parameters:
    `jposEntry` - the entry to add properties to
    `element` - the XML element
  Since:
    1.2 (NY 2K meeting)

### extractProductAttr

    protected void extractProductAttr(JposEntry jposEntry,
                                      org.w3c.dom.Element element)

  Get the element attributes and adds corresponding properties to JposEntry
  Parameters:
    `jposEntry` - the entry to add properties to
    `element` - the XML element
  Since:
    1.2 (NY 2K meeting)

### extractPropAttr

    protected void extractPropAttr(JposEntry jposEntry,
                                   org.w3c.dom.Element element)
                            throws JposConfigException

  Get the element attributes and adds corresponding properties to JposEntry
  Parameters:
    `jposEntry` - the entry to add properties to
    `element` - the XML element
  Throws:
    `JposConfigException` - if the property value does not match the type or is not a valid value (like for instance an invalid number)
  Since:
    1.2 (NY 2K meeting)

### convertJposEntriesToXml

    protected void convertJposEntriesToXml(java.util.Enumeration entries,
                                           java.io.OutputStream os)
                                    throws java.lang.Exception

  Converts an Enumeration of JposEntry objects to XML
  Parameters:
    `entries` - an Enumeration of JposEntry objects
    `os` - the OutputStream to stream the entries to
  Throws:
    `java.lang.Exception` - if something goes wrong serializing
  Since:
    1.2 (NY 2K meeting)

### serializeDocument

    protected void serializeDocument(org.w3c.dom.Document document,
                                     java.util.Enumeration entries,
                                     java.io.OutputStream os)
                              throws java.lang.Exception

  Serializes the JposEntry objects to an XML document and save to OutputStream
  Parameters:
    `document` - the XML document object
    `entries` - an Enumeration of JposEntry objects
    `os` - the OuputStream object
  Throws:
    `java.lang.Exception` - anything goes wrong while saving
  Since:
    1.2 (NY 2K meeting)

### appendCreationElement

    protected void appendCreationElement(org.w3c.dom.Document doc,
                                         org.w3c.dom.Element jposEntryElement,
                                         JposEntry jposEntry)

  Appends the element to the document
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### appendVendorElement

    protected void appendVendorElement(org.w3c.dom.Document doc,
                                       org.w3c.dom.Element jposEntryElement,
                                       JposEntry jposEntry)

  Appends the element to the document
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### appendJposElement

    protected void appendJposElement(org.w3c.dom.Document doc,
                                     org.w3c.dom.Element jposEntryElement,
                                     JposEntry jposEntry)

  Appends the element to the document
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### appendProductElement

    protected void appendProductElement(org.w3c.dom.Document doc,
                                        org.w3c.dom.Element jposEntryElement,
                                        JposEntry jposEntry)

  Appends the element to the document
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### appendPropElement

    protected void appendPropElement(org.w3c.dom.Document doc,
                                     org.w3c.dom.Element jposEntryElement,
                                     java.lang.String propName,
                                     java.lang.Object propValue)

  Appends the element to the document
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `propName` - the property name
    `propValue` - the property value
  Since:
    1.2 (NY 2K meeting)

### appendPropElements

    protected void appendPropElements(org.w3c.dom.Document doc,
                                      org.w3c.dom.Element jposEntryElement,
                                      JposEntry jposEntry)

  Appends non-required properties name and value
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### insertJposEntryInDoc

    protected void insertJposEntryInDoc(org.w3c.dom.Document doc,
                                        org.w3c.dom.Element jposEntryElement,
                                        JposEntry jposEntry)

  Insert the in the XML document object
  Parameters:
    `doc` - the XML Document object
    `jposEntryElement` - the XML Element object
    `jposEntry` - the JposEntry object
  Since:
    1.2 (NY 2K meeting)

### insertJposEntriesInDoc

    protected void insertJposEntriesInDoc(org.w3c.dom.Document doc,
                                          java.util.Enumeration entries)

  Insert an Enumeration of objects in the XML document
  Parameters:
    `doc` - the XML Document object
    `entries` - an Enumeration of JposEntry objects
  Since:
    1.2 (NY 2K meeting)

### createEmptyDocument

    protected org.w3c.dom.Document createEmptyDocument()

  Returns:
    an empty XML Document object
  Since:
    1.2 (NY 2K meeting)

### insertDTDInfo

    protected void insertDTDInfo(org.w3c.dom.Document doc,
                                 org.apache.xml.serialize.OutputFormat outFormat)
                          throws java.lang.Exception

  Inset DTD information in the XML Document object
  Parameters:
    `doc` - the XML Document object
    `outFormat` - the OuputFormat object
  Throws:
    `java.lang.Exception` - in case something goes wrong
  Since:
    1.2 (NY 2K meeting)

### insertDateSavedComment

    protected void insertDateSavedComment(org.w3c.dom.Document document)
                                   throws java.lang.Exception

  Inserts date and info saved in the XML Document object
  Parameters:
    `document` - the XML Document object
  Throws:
    `java.lang.Exception` - in case something goes wrong
  Since:
    1.2 (NY 2K meeting)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

This API and code belongs to the JavaPOS committee please see LISCENCE file for details