|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.infinityloop.downcast.DowncastEngine
public class DowncastEngine
This class provides all necessary methods to access downCast functionality programmatically via a simple Java API.
Follows a minimal skeleton showing how to do a single conversion from file in.xml to out.rtf (debugging turned on):
DownCast.setLicense( "/path/to/downcast.license" ); DowncastEngine dc = new DowncastEngine( true, "downCast" ); dc.convertFile( "/path/to/in.xml", "/path/to/output/", "/path/to/preprocess.xsl" );
Constructor Summary | |
---|---|
DowncastEngine(boolean debug,
java.lang.String instanceIDUser)
Creates a new instance of the DowncastEngine object. |
|
DowncastEngine(java.lang.String instanceIDUser)
Creates a new instance of the DowncastEngine object. |
Method Summary | |
---|---|
static void |
addCatalog(java.lang.String catalogFile)
Adds an (XML-) Catalog to the system. |
void |
addCustomEncoding(java.io.InputStream customEncodingStream)
Adds a custom encoding to the collection of known encodings. |
void |
addCustomEncoding(java.lang.String customEncodingName)
Adds a custom encoding to the collection of known encodings. |
void |
convertFile(java.lang.String srcFile,
java.io.OutputStream destStream,
java.lang.Object procSheet,
java.lang.String parameters)
Convert a document from a file into a Java Stream. |
void |
convertFile(java.lang.String srcFile,
java.lang.String destPath,
java.lang.Object procSheet,
java.lang.String parameters)
Convert a document from a file into a folder. |
void |
convertFile(java.lang.String srcFile,
java.lang.String destPath,
java.lang.String procSheet)
Convert a document from a file into a folder. |
void |
debugMessage(java.lang.String msg)
Makes debugging output. |
static void |
discardCatalogs()
Removes all previously registered catalogs from the catalog system. |
void |
errorMessage(java.lang.String msg)
Makes error output. |
com.sun.resolver.tools.CatalogResolver |
getCatalogResolver()
Returns the Catalog resolver used by the system. |
java.lang.String |
getEnvironmentValue(java.lang.String key)
Returns the value of the environment proeprty specified by the key integer. |
java.lang.Object |
getGlobalParameter(java.lang.String parameter,
java.lang.Object fallback)
Retrieves the current value of the specified global parameter. |
java.lang.String |
getInstanceNameUser()
|
void |
infoMessage(java.lang.String msg)
Makes info output. |
void |
preprocessFile(java.lang.String srcUrl,
java.lang.String destUrl,
java.lang.String xslUrl,
java.lang.String parameters)
Only do the XSLT preprocessing of some file and write the result to a specified location. |
void |
setCustomFontConfiguration(java.io.InputStream customFontConfigStream)
Loads a new custom stdfonts.config configuration. |
void |
setCustomFontConfiguration(java.lang.String customFontConfigName)
Loads a new custom stdfonts.config configuration. |
void |
setDebuggingMode(boolean on)
Sets debugging mode. |
void |
setGlobalParameter(java.lang.String parameter,
java.lang.Object value)
Set global parameter for conversion process. |
static boolean |
setLicense(java.io.InputStream inStream)
sets a specified License file for use as license. |
static boolean |
setLicense(java.lang.String licenseFile)
sets a specified License file for use as license. |
void |
warningMessage(java.lang.String msg)
Makes warning output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DowncastEngine(java.lang.String instanceIDUser) throws ILException
Debugging mode is automatically set to false.
If your license allows, you may instantiate several objects of this kind. They are completely independent from each other, so you may run them in separate threads. However, they share some synchronized code sequences and each instance keeps its document in memory for processing. We recommend serializing any conversion jobs you might have pending (except when you have multi-processor machines).
instanceIDUser
- you may pass an arbitrary string here which helps to identify the server instance in log file and debug message output.
ILException
public DowncastEngine(boolean debug, java.lang.String instanceIDUser) throws ILException
debug
- pass true if you want debug messages output to the log, false otherwise.instanceIDUser
- you may pass an arbitrary string here which helps to identify the server instance in log file and debug message output.
ILException
Method Detail |
---|
public void convertFile(java.lang.String srcFile, java.lang.String destPath, java.lang.String procSheet) throws ILException
This method imports an upCast DTD conforming XML document, processes it and writes the result to the specified destination file.
Any previously read document is replaced by the newly imported one.
The srcFile must be an
The destPath must be an
srcFile
- the (absolute) name (incl. path) of the file to be imported.destPath
- the (absolute) path to where the result should be written to. It will be named basename.rtf
.procSheet
- the (absolute) name (incl. path) of the XSLT processing sheet which should be applied to the source file prior to feeding it the RTF converter
component. Pass null
if you do not want any preprocessing to take place.
ILException
- Throws an appropriate exception if something goes wrong.public void convertFile(java.lang.String srcFile, java.lang.String destPath, java.lang.Object procSheet, java.lang.String parameters) throws ILException
This method imports an upCast DTD conforming XML document, processes it and writes the result to the specified destination file.
Any previously read document is replaced by the newly imported one.
The srcFile must be an
The destPath must be an
srcFile
- the (absolute) name (incl. path) of the file to be imported.destPath
- the (absolute) path to where the result should be written to. It will be named basename.rtf
.procSheet
- the (absolute) name (incl. path) of the XSLT processing sheet which should be applied to the source file prior to feeding it the RTF converter
component. Pass null
if you do not want any preprocessing to take place. Can be a InputStream, String or InputProxy object.parameters
- a String identifying parameters in the form: 'name1="value1" name2="value2" ...' You may use variables il:srcfilename (full XML source file name),
il:destfolder (destination path), il:srcfolder (path to source file).
ILException
- Throws an appropriate exception if something goes wrong.public void convertFile(java.lang.String srcFile, java.io.OutputStream destStream, java.lang.Object procSheet, java.lang.String parameters) throws ILException
This convenience method wrapper imports an upCast DTD conforming XML document, processes it and writes the result to the specified destination Stream.
This is done using temporary files invisible to the user, so the application needs write access to the temporary directory (which it also needs for XSLT
pre-conversion, so nothing is lost here). The magic folder location for this is the "Temporary Items Folder". It can be set at startup using the system
property de.infinityloop.application.tmpdir
.
Any previously read document is replaced by the newly imported one.
The srcFile must be an
The destStream is the OutputStream the data should be written to.
srcFile
- the (absolute) name (incl. path) of the file to be imported.destStream
- the OutputStream where the result should be written to.procSheet
- the (absolute) name (incl. path) of the XSLT processing sheet which should be applied to the source file prior to feeding it the RTF converter
component. Pass null
if you do not want any preprocessing to take place. Can be a InputStream, String or InputProxy object.parameters
- a String identifying parameters in the form: 'name1="value1" name2="value2" ...' You may use variables il:srcfilename (full XML source file name),
il:destfolder (destination path), il:srcfolder (path to source file).
ILException
- Throws an appropriate exception if something goes wrong.public void preprocessFile(java.lang.String srcUrl, java.lang.String destUrl, java.lang.String xslUrl, java.lang.String parameters) throws ILException
srcUrl
- the source XML documentdestUrl
- the destination XML documentxslUrl
- the XSLT processing sheetparameters
- parameter string passed (after parsing it out into individual parameters) as parameters to the transformation
ILException
public void setGlobalParameter(java.lang.String parameter, java.lang.Object value) throws ILException
parameter
- the name of the parameter to be set. For any available parameter names, see the
downCast manual.value
- the value of the parameter. For valid parameter values and value ranges and Object types, see the ILException
- Throws an appropriate exception if anything goes wrong.public java.lang.Object getGlobalParameter(java.lang.String parameter, java.lang.Object fallback) throws ILException
parameter
- the name of the parameter to be retrieved. For any available parameter names, see the
downCast manual.fallback
- the value to be returned when the requested parameter is not available.
ILException
public void debugMessage(java.lang.String msg)
Writes a string to the log file when debug = true. Does nothing otherwise.
public void errorMessage(java.lang.String msg)
Writes a string to the log file.
msg
- the error messagepublic void warningMessage(java.lang.String msg)
Writes a string to the log file.
msg
- the warning messagepublic void infoMessage(java.lang.String msg)
Writes a string to the log file.
msg
- the info messagepublic void setDebuggingMode(boolean on)
on
- if true, debugging output to the downCast log file is turned on, if false, it is turned off.public com.sun.resolver.tools.CatalogResolver getCatalogResolver()
public java.lang.String getInstanceNameUser()
public static boolean setLicense(java.io.InputStream inStream) throws ILException
inStream
- an input stream containing the license data. This might be a FileInputStream if you read from a file or some other stream (e.g. from
getResourceAsStream() when reading from the application's Jar file).
ILException
public static boolean setLicense(java.lang.String licenseFile)
licenseFile
- an absolute path to the license file. This is a convenience function for setLicense( new FileInputStream( inStream ) );
public void addCustomEncoding(java.io.InputStream customEncodingStream) throws ILException
Encodings are global and shared by all concurrent DowncastEngine instances.
customEncodingStream
- the custom encoding
ILException
public void addCustomEncoding(java.lang.String customEncodingName) throws ILException
addCustomEncoding
for details.
customEncodingName
- file name of a custom encoding file
ILException
public void setCustomFontConfiguration(java.io.InputStream customFontConfigStream) throws ILException
This configuration is held separately per DowncastEngine instance.
customFontConfigStream
- the custom stdfonts.config file resp. stream
ILException
public void setCustomFontConfiguration(java.lang.String customFontConfigName) throws ILException
setCustomFontConfiguration
for details.
customFontConfigName
- the custom stdfonts.config file name
ILException
public static void addCatalog(java.lang.String catalogFile)
catalogFile
- the absolute path to the catalog filepublic static void discardCatalogs()
public java.lang.String getEnvironmentValue(java.lang.String key)
gui (batch) java-api
"
null
when WordLink is not available
null
when WordLink is not available or no installed Word application can be found
il-gw.exe
iloop.dll
servicing the C/C++/VB/VBA APIs
null
when MathLink is not available
mt.dll
used; returns null
when MathLink is not available or the mt.dll
is not found
""
if this is the most recent build, or null
if the latest build information could not be determined
java.system.property
key
- a String identifying the desired bit of information.
null
if it could not be determined
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |