|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.reverseXSL.transform.Transformer
public class Transformer
Executes message transformations, which may comprise a Parsing step and an XSLT step (or only one of, or none at all = pass-through). The Parsing step takes a non-XML file and generates an XML document according to a Parser DEFinition file. The XSLT step transforms the generated XML document into another XML document, else any kind of text-based document format.
Transformation steps are selected and executed as defined in the Mapping Selection Table.
IMPORTANT NOTE: the free software version ignores the XSLT step. Only the Parsing step, when specified, is performed. In this context, any post-parsing XSL transformation shall be invoked via the java API for XML processing (JAXP)
factory methods on the means to set the source of meta data, notably the Mapping Selection Table.
Method Summary | |
---|---|
java.lang.StringBuffer |
getLog()
get a printable log of the Transformer activities during the last call to transform(InputStream, OutputStream) . |
java.lang.String |
getName()
get the name of the Mapping Selection Table entry that has just been used to transform the last message. |
Parser.ExceptionListIterator |
getParserExceptionListIterator()
Browse the detail, exception per exception with possible nested causes, of the Parser warnings and errors. |
java.lang.String |
getParserExceptionListXML()
Returns an XML document representation of all Parser warnings and errors in sequence. |
int |
getParserExceptionsCount()
Whenever transform(InputStream, OutputStream) is invoked, it returns the total count of parser exceptions (below thresholds, otherwise
an exception would have been thrown). |
int |
printableTransform(java.io.InputStream in,
java.lang.StringBuffer out)
A variant of transform(InputStream, OutputStream) that guarantees
a nice indentation of XML outputs; neutral operation for other brands. |
void |
reset()
Reset the Transformer state and free associated resources. |
void |
setLocalMessageReferences(java.lang.String id,
java.util.Date d)
Impose a fixed message ID and fixed date as message references. |
void |
setLocalMessageReferences(java.lang.String base,
java.text.DecimalFormat df)
Defines the message ID from a base string that will be followed by a decimal format. |
java.lang.String |
toString()
|
int |
transform(java.io.InputStream in,
java.io.OutputStream out)
Reads a message from the InputStream (till no more bytes are available) and then transforms it according to Parsing and XSL Transformation steps defined in the Mapping Selection Table. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.lang.StringBuffer getLog()
transform(InputStream, OutputStream)
. Parser warnings are also detailed.
public java.lang.String getName()
public Parser.ExceptionListIterator getParserExceptionListIterator()
public java.lang.String getParserExceptionListXML() throws javax.xml.transform.TransformerException, javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException
- (not about ReverseXSL Transformer) when the JAXP libraries fail to build the XML representation of the Exception List
javax.xml.parsers.ParserConfigurationException
- (not about ReverseXSL Parser) when the JAXP libraries fail to build the XML representation of the Exception Listpublic int getParserExceptionsCount()
transform(InputStream, OutputStream)
is invoked, it returns the total count of parser exceptions (below thresholds, otherwise
an exception would have been thrown). This method simply 'reminds' about the value returned by the last run.
transform(InputStream, OutputStream)
public int printableTransform(java.io.InputStream in, java.lang.StringBuffer out) throws java.io.IOException, TransformerException, ParserException, javax.xml.parsers.ParserConfigurationException, javax.xml.parsers.FactoryConfigurationError, javax.xml.transform.TransformerFactoryConfigurationError, javax.xml.transform.TransformerException
transform(InputStream, OutputStream)
that guarantees
a nice indentation of XML outputs; neutral operation for other brands.
This method is only good for printing the output or displaying it. It is NOT recommended to use it in production as only a subset of the XML standard (good for all regular XML uses but...) is supported in the final formatting. Moreover, this operation inflates the output with a hell of extra space characters.
in
- reading input message bytes from FileInputStream, ByteArrayInputStream, StringBufferInputStream, other implementationsout
- transformed output is now directed to a StringBuffer (printable!)
thresholds
,
otherwise an exception is thrown)
java.io.IOException
ParserException
TransformerException
javax.xml.transform.TransformerException
- (XSLT related)
javax.xml.transform.TransformerFactoryConfigurationError
- (XSLT related)
javax.xml.parsers.FactoryConfigurationError
- (XSLT related)
javax.xml.parsers.ParserConfigurationException
- (XSLT related)TransformerFactory.setParserExceptionThresholds(int, int)
public void reset()
The internal counter is not reset.
public void setLocalMessageReferences(java.lang.String id, java.util.Date d)
The message ID and date will appear in Tranformer traces.
id
- message ID as stringd
- a java Date for referencepublic void setLocalMessageReferences(java.lang.String base, java.text.DecimalFormat df)
Set once and applies to all subsequent invocations of Tranformer.transform().
The message ID and date will appear in Tranformer traces.
base
- String, to be used as unique tag or thread ID per Transformerdf
- decimal format, e.g. new DecimalFormat("00000")
public java.lang.String toString()
toString
in class java.lang.Object
public int transform(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException, TransformerException, ParserException, javax.xml.parsers.ParserConfigurationException, javax.xml.parsers.FactoryConfigurationError, javax.xml.transform.TransformerFactoryConfigurationError, javax.xml.transform.TransformerException
The OutputStream receives the transformed data.
in
- reading input message bytes from FileInputStream, ByteArrayInputStream, StringBufferInputStream, other implementationsout
- writing transformed output bytes to FileOutputStream, ByteArrayOutputStream, PrintStream, other implementations
thresholds
,
otherwise an exception is thrown)
java.io.IOException
ParserException
- (ReverseXSL related) thrown when the tolerance thresholds
for Parser exceptions set by TransformerFactory.setParserExceptionThresholds(int, int)
have been exceeded, else the DEFinition for the relevant message indicated to throw the exception in case of Parsing failures.
TransformerException
- (ReverseXSL related) most likely when the meta-data resources cannot be loaded.
javax.xml.transform.TransformerException
- (XSLT related)
javax.xml.transform.TransformerFactoryConfigurationError
- (XSLT related)
javax.xml.parsers.FactoryConfigurationError
- (XSLT related)
javax.xml.parsers.ParserConfigurationException
- (XSLT related)TransformerFactory.setParserExceptionThresholds(int, int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |