Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.txt2xml.config
Class ProcessorFactory  view ProcessorFactory download ProcessorFactory.java

java.lang.Object
  extended byorg.txt2xml.config.ProcessorFactory

public class ProcessorFactory
extends java.lang.Object

Create a Processor from a configuration file.

Config file of the form:

     <txt2xml>
 *****
     </txt2xml>
 


Field Summary
private static ProcessorFactory instance
           
private static java.util.logging.Logger LOG
           
private static java.lang.String PROCESSOR_ELEMENT
           
private static java.lang.String ROOT_ELEMENT
           
private static java.lang.String TYPE_ATTRIBUTE
           
private static java.util.Properties typeMap
           
private static java.lang.String TYPES_CONFIG_NAME
           
 
Constructor Summary
private ProcessorFactory()
           
 
Method Summary
 org.txt2xml.core.Processor createProcessor(java.io.Reader configReader)
           Read the configuration and return the Processor defined: this will include sub-Processors or following Processors if defined in the config.
 org.txt2xml.core.Processor createProcessor(java.net.URL configUrl)
           Read the configuration and return the Processor defined: this will include sub-Processors or following Processors if defined in the config.
static ProcessorFactory getInstance()
           
protected  org.txt2xml.core.Processor readProcessor(org.jdom.Element processorElement)
           Read config for a Processor in the passed "Processor" Element and return the Processor defined there, including sub-Processors.
protected  org.txt2xml.core.Processor readProcessorSequenceFrom(org.jdom.Element parentElement)
           Read config contained by the passed parent Element and return the sequence of Processors defined there, which might include sub-Processors and following Processors if defined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final java.util.logging.Logger LOG

ROOT_ELEMENT

private static final java.lang.String ROOT_ELEMENT
See Also:
Constant Field Values

PROCESSOR_ELEMENT

private static final java.lang.String PROCESSOR_ELEMENT
See Also:
Constant Field Values

TYPE_ATTRIBUTE

private static final java.lang.String TYPE_ATTRIBUTE
See Also:
Constant Field Values

TYPES_CONFIG_NAME

private static final java.lang.String TYPES_CONFIG_NAME
See Also:
Constant Field Values

typeMap

private static java.util.Properties typeMap

instance

private static final ProcessorFactory instance
Constructor Detail

ProcessorFactory

private ProcessorFactory()
Method Detail

getInstance

public static ProcessorFactory getInstance()

createProcessor

public org.txt2xml.core.Processor createProcessor(java.io.Reader configReader)
                                           throws ConfigException

Read the configuration and return the Processor defined: this will include sub-Processors or following Processors if defined in the config.


createProcessor

public org.txt2xml.core.Processor createProcessor(java.net.URL configUrl)
                                           throws ConfigException

Read the configuration and return the Processor defined: this will include sub-Processors or following Processors if defined in the config.


readProcessorSequenceFrom

protected org.txt2xml.core.Processor readProcessorSequenceFrom(org.jdom.Element parentElement)
                                                        throws ConfigException

Read config contained by the passed parent Element and return the sequence of Processors defined there, which might include sub-Processors and following Processors if defined.

Note that non-"Processor" elements are silently ignored.


readProcessor

protected org.txt2xml.core.Processor readProcessor(org.jdom.Element processorElement)
                                            throws ConfigException

Read config for a Processor in the passed "Processor" Element and return the Processor defined there, including sub-Processors.

The type of a Processor is read from the processor_types.properties configuration. The following types are pre-defined but can be overriden in a "processor_types.properties" file:

  • RegexDelimited -> org.txt2xml.core.RegexDelimitedProcessor
Processors are created using java.beans.Beans.instantiate() so serialised Processors can be loaded with the appropriate config. See JDK javadoc.