|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object eu.clarin.cmdi.mdservice.action.MDTransformer
public class MDTransformer
Helper class, encapsulating the xsl-transformations handling the contract is, that the requester passes a key, which can be resolved to a xsl-script (momentary mapped in properties: Admin.getConfig()) Bad things happen, if the key or the appropriate xsl-file do not exist
Field Summary | |
---|---|
private static MDTransformer |
singleton
|
private java.net.URL |
srcFile
|
(package private) javax.xml.transform.TransformerFactory |
tfactory
|
Constructor Summary | |
---|---|
MDTransformer()
|
Method Summary | |
---|---|
static MDTransformer |
getMDTransformer()
|
private java.lang.String |
getXSLPath(java.lang.String key)
get the path to the transform-xsl file from properties, based on the key |
private javax.xml.transform.stream.StreamSource |
getXSLStreamSource(java.lang.String key)
|
java.io.InputStream |
transformXML(java.io.InputStream xmlStream,
java.lang.String transkey)
just a wrapper for the main method translating the output-stream into a input-stream (expected by the Controller-Actions to return as response) |
void |
transformXML(java.io.InputStream in,
java.lang.String transkey,
java.io.OutputStream out)
The main method for transforming, applies the appropriate (based on the transkey) stylesheet on the xml-stream and writes the result into the output stream. |
java.lang.String |
transformXML(java.lang.String xml,
java.lang.String transkey)
this is for xml present as string. |
java.io.InputStream |
transformXML(java.net.URL xmlFile,
java.lang.String transkey)
another wrapper for the main method allowing to directly pass a URL to the source-xml |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.net.URL srcFile
private static MDTransformer singleton
javax.xml.transform.TransformerFactory tfactory
Constructor Detail |
---|
public MDTransformer()
Method Detail |
---|
public static MDTransformer getMDTransformer()
private java.lang.String getXSLPath(java.lang.String key)
key
-
private javax.xml.transform.stream.StreamSource getXSLStreamSource(java.lang.String key)
public void transformXML(java.io.InputStream in, java.lang.String transkey, java.io.OutputStream out) throws javax.xml.transform.TransformerException, java.io.IOException
in
- InpuStream with xmltranskey
- this defines the stylesheet to use and is also passed to the stylesheet as "format"-parameterout
- the stream to write the output to
javax.xml.transform.TransformerException
java.io.IOException
public java.io.InputStream transformXML(java.io.InputStream xmlStream, java.lang.String transkey) throws java.io.IOException, java.lang.InterruptedException, javax.xml.transform.TransformerException
xmlStream
- the source xml streamtranskey
-
java.io.IOException
java.lang.InterruptedException
javax.xml.transform.TransformerException
public java.io.InputStream transformXML(java.net.URL xmlFile, java.lang.String transkey) throws java.io.IOException, java.lang.InterruptedException, javax.xml.transform.TransformerException
xmlFile
- URL of the source-filetranskey
-
javax.xml.transform.TransformerException
java.io.IOException
java.lang.InterruptedException
public java.lang.String transformXML(java.lang.String xml, java.lang.String transkey)
xml
- xml as stringtranskey
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |