|
Oracle Fusion Middleware Java API Reference for Oracle Business Intelligence Publisher 11g Release 1 (11.1.1) E17789-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.xdo.template.FOProcessor
public class FOProcessor
The class FOProcessor class is the front-end class to use FO Processing engine. To use FOProcessor class, users have to instanciate this class and set parameters such as input, output and control parameters.
After setting the parameters, you can start processing by calling generate() method.
Typical usage is following:
FOProcessor processor = new FOProcessor();
processor.setData("/home/sample.xml");
processor.setTemplate("/home/sample.xsl");
// Instead of XML and XSL combination, you can set XSL-FO file
// directly by calling setData() method and setTemplate(null).
processor.setData("/home/sample.fo");
processor.setTemplate((String)null);
// set XDO Configuration file
String configFilePath = "/home/xdo.cfg";
processor.setConfig(confgFilePath);
processor.setOutput("/home/sample.pdf");
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
try
{
processor.generate();
}
catch (XDOException e)
{
e.printStackTrace();
System.exit(1);
}
Stream data are also allowed to be set.
FOProcessor processor = new FOProcessor();
processor.setData(xmlInputStream);
processor.setTemplate(xslInputStream);
// Instead of XML and XSL combination, you can set XSL-FO file
// directly by calling setData() method and setTemplate(null).
processor.setData(foInputStream);
processor.setTemplate((InputStream)null);
// set XDO Configuration file
String configFilePath = "/home/xdo.cfg";
processor.setConfig(confgFilePath);
processor.setOutput(pdfOutputStream);
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
try
{
processor.generate();
}
catch (XDOException e)
{
e.printStackTrace();
System.exit(1);
}
If you want to generate one output from multiple input, you can set an array of each input data type as input. In this case, this processor handles the first input file as a master and appends other files to it. Processor does not resolve naming confliction. If the same name/id is used in the two documents, the method ends successfully but generated output may have a problem.
String[] xmlInput = {"data/firstpart.xml", "data/secondpart.xml", "data/alreadyfo.fo"}; String[] xslInput = {"data/template.xsl", "data/template.xsl", null}; // null needs for xsl-fo inputFOProcessor processor = new FOProcessor();
processor.setData(xmlInput);
processor.setTemplate(xslInput);
processor.setOutput("/tmp/output.pdf");
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
try
{
processor.generate();
}
catch (XDOException e)
{
e.printStackTrace();
System.exit(1);
}
An example of running FOProcessor on a different thread is as follow (since 5.7):
FOProcessor processor = new FOProcessor();
// Get PipeOutputStream from FOProcessor
OutputStream[] xmlOutStreams = processor.getPipeDataStream(1);
// set Template file
processor.setTemplate("/home/sample.xsl");
// set XDO Configuration file
String configFilePath = "/home/xdo.cfg";
processor.setConfig(confgFilePath);
processor.setOutput("/home/sample.pdf");
processor.setOutputFormat(FOProcessor.FORMAT_PDF);
// Create or obtain a new Thread
Thread tFo = new Thread(processor);
// Setting up DataTemplate
DataTemplate dt = new DataTemplate(...);
dt.setOutput(xmlOutStreams[0]); // connecting pipe streams
// run FOProcessor and DataTemplate
try
{
tFo.start(); // run FOProcessor
dt.processData();
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
// Wait for FOProcessor to complete
tFo.join();
// Check if there is any exception
if (processor.getException() != null)
{
System.exit(1);
}
An example of running FOProcessor for image output(since 11.2):
FOProcessor processor = new FOProcessor();
// set the input, which is in a xsl-fo format
processor.setData("C:\\template.fo") ;
// no need to set a template as this is not xsl with xml data
processor.setTemplate((String)null);
// set additional configuration for image geneartion
Properties props = new Properties();
// pixcel height
props.put(PropertyConstants.PDF2X_PAGE_HEIGHT, "170");
// pixcel width
props.put(PropertyConstants.PDF2X_PAGE_WIDTH, "103");
// 72 dpi intermediate output quality
props.put(PropertyConstants.PDF2X_OUTPUT_RESOLUTION, "72");
// first page only
props.put(PropertyConstants.PDF2X_PAGE_RANGES, "1");
processor.setConfig(props);
// write the output image to a file
processor.setOutput("C:\\template.png");
// set the output format
processor.setOutputFormat(FOProcessor.FORMAT_IMAGE_PNG);
processor.generate();
Field Summary | |
---|---|
static byte |
FORMAT_AWT AWT format constant |
static byte |
FORMAT_EXCEL EXCEL format constant |
static byte |
FORMAT_EXCEL_MHTML MHTML constant for Excel chart support |
static byte |
FORMAT_FO FO format constant (19 to keep in sync with existing OA constant) |
static byte |
FORMAT_HTML HTML format constant |
static byte |
FORMAT_IMAGE_BMP |
static byte |
FORMAT_IMAGE_GIF |
static byte |
FORMAT_IMAGE_JPG |
static byte |
FORMAT_IMAGE_PNG |
static byte |
FORMAT_MHTML Generic MHTML format constant |
static byte |
FORMAT_PagedHTML HTML format constant |
static byte |
FORMAT_PDF PDF format constant |
static byte |
FORMAT_PDFZ PDFZ format constant |
static byte |
FORMAT_PPTMHT Power point constant |
static byte |
FORMAT_PPTX Power point 2007 constant |
static byte |
FORMAT_RTF RTF format constant |
static byte |
FORMAT_UIX UIX format constant (Actual output is not supported. |
static byte |
FORMAT_USERSPECIFIED User specfied format (Not supported) |
static byte |
FORMAT_XLSX XLSX constant for Excel 2007 support |
Constructor Summary | |
---|---|
FOProcessor() Constructor with default settings |
Method Summary | |
---|---|
void |
cancelProcess() Upon receiving this call, FOProcessor will terminate as soon as it is safe to stop. |
void |
generate() Starts FO processing. |
java.lang.String |
getCompletionStatus(java.lang.String name) Return the completion status as a String object. |
java.io.OutputStream[] |
getPipeDataStream(int count) Return the requested number of OutputStream to prepare running the FOProcessor in a different thread. |
java.lang.Exception |
getRunException() Return an Execption instance after running it on a different thread. |
int |
getTotalPageNumber() This method returns the total page number on the last generated output. |
static void |
main(java.lang.String[] args) |
boolean |
process() Deprecated. Use generate() |
void |
run() This method is implemented to support running FOProcessor on a different thread (interface Runnable). |
void |
setConfig(java.io.InputStream docLevelInputStream) Sets the configuration for the document to be processed. |
void |
setConfig(java.util.Properties prop) Sets properties for this object. |
void |
setConfig(java.lang.String docLevelConfigPath) Sets the configuration for the document to be processed. |
void |
setData(java.io.InputStream stream) Sets XML Data Input Stream. |
void |
setData(java.io.InputStream[] xmlInput) Sets XML Data Input Streams. |
void |
setData(java.io.Reader reader) Sets XML Data Reader. |
void |
setData(java.io.Reader[] xmlReaders) Sets XML Data Input Readers. |
void |
setData(java.lang.String xmlFile) Sets Input XML File. |
void |
setData(java.lang.String[] xmlFilepaths) Sets Input XML Files. |
void |
setLocale(java.util.Locale locale) Sets the locale. |
void |
setLocale(java.lang.String locale) Sets the locale setting. |
void |
setOutput(java.io.OutputStream stream) Sets output stream. |
void |
setOutput(java.lang.String outFile) Sets output file path. |
boolean |
setOutputFormat(byte formatID) Sets the output format type. |
void |
setTemplate(java.io.InputStream stream) Sets Input Stream for XSL data. |
void |
setTemplate(java.io.InputStream[] xslInput) Sets array of InputStream for input XSL data. |
void |
setTemplate(java.io.Reader reader) Sets Reader for XSL data. |
void |
setTemplate(java.io.Reader[] xslReaders) Sets array of Reader for input XSL data. |
void |
setTemplate(java.lang.String xslFile) Sets Input XSL File. |
void |
setTemplate(java.lang.String[] xslFilepaths) Sets Input XSL Files. |
void |
setXLIFF(java.io.InputStream stream) Sets Input Stream for XLIFF data. |
void |
setXLIFF(java.io.InputStream[] xliffInput) Sets array of InputStream for input XLIFF data. |
void |
setXLIFF(java.io.Reader reader) Sets Input Stream for XLIFF data. |
void |
setXLIFF(java.io.Reader[] xliffReaders) Sets array of Reader for input XLIFF data. |
void |
setXLIFF(java.lang.String xliffFile) Sets XLIFF File. |
void |
setXLIFF(java.lang.String[] xliffFilepaths) Sets array of file path strings forinput XLIFF data. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte FORMAT_AWT
public static final byte FORMAT_PDF
public static final byte FORMAT_RTF
public static final byte FORMAT_HTML
public static final byte FORMAT_PagedHTML
public static final byte FORMAT_UIX
public static final byte FORMAT_EXCEL
public static final byte FORMAT_EXCEL_MHTML
public static final byte FORMAT_FO
public static final byte FORMAT_PPTMHT
public static final byte FORMAT_PPTX
public static final byte FORMAT_MHTML
public static final byte FORMAT_XLSX
public static final byte FORMAT_PDFZ
public static final byte FORMAT_IMAGE_PNG
public static final byte FORMAT_IMAGE_JPG
public static final byte FORMAT_IMAGE_BMP
public static final byte FORMAT_IMAGE_GIF
public static final byte FORMAT_USERSPECIFIED
Constructor Detail |
---|
public FOProcessor()
Method Detail |
---|
public void setLocale(java.lang.String locale)
locale
- local Stringpublic void setLocale(java.util.Locale locale)
locale
- java localepublic void setConfig(java.io.InputStream docLevelInputStream)
configStream
- InputStream for the document level configurationpublic void setConfig(java.lang.String docLevelConfigPath)
configFilePath
- file path for the document level configurationpublic void setData(java.lang.String xmlFile)
xmlFile
- xml input file pathpublic void setData(java.io.InputStream stream)
stream
- input stream for xml inputpublic void setData(java.io.Reader reader)
reader
- Reader for xml inputpublic void setData(java.io.InputStream[] xmlInput)
xmlInput
- InputStream array of XML data sourcepublic void setData(java.io.Reader[] xmlReaders)
xmlReaders
- Reader array of XML data sourcepublic void setData(java.lang.String[] xmlFilepaths)
xmlFilepaths
- filepath string array of XML data sourcepublic void setTemplate(java.lang.String xslFile)
xslFile
- xsl input file pathpublic void setTemplate(java.io.InputStream stream)
stream
- input stream for xsl inputpublic void setTemplate(java.io.Reader reader)
reader
- reader for xsl inputpublic void setTemplate(java.io.InputStream[] xslInput)
xslInput
- InputStream array of XSL templatespublic void setTemplate(java.io.Reader[] xslReaders)
xslReaders
- Reader array of XSL templatespublic void setTemplate(java.lang.String[] xslFilepaths)
xslFilepaths
- filepath string array of XSL templatespublic void setXLIFF(java.lang.String xliffFile)
xliffFile
- xliff file pathpublic void setXLIFF(java.io.InputStream stream)
stream
- input stream for xsl inputpublic void setXLIFF(java.io.Reader reader)
reader
- reader for xsl inputpublic void setXLIFF(java.io.InputStream[] xliffInput)
xliffInput
- InputStream array of XLIFF datapublic void setXLIFF(java.io.Reader[] xliffReaders)
xliffReaders
- Reader array of XLIFF datapublic void setXLIFF(java.lang.String[] xliffFilepaths)
xliffFilepaths
- filepath string array for XLIFFpublic void setOutput(java.lang.String outFile)
outFile
- output file pathpublic void setOutput(java.io.OutputStream stream)
stream
- output stream namepublic boolean setOutputFormat(byte formatID)
formatID
- Format ID (byte)public boolean process()
public void generate() throws XDOException
XDOException
public void cancelProcess()
public java.io.OutputStream[] getPipeDataStream(int count)
count
- number of requested OutputStream. Normally it is set to 1.public void run()
This method is implemented to support running FOProcessor on a different thread (interface Runnable).
Do not call this method directly. Please see the example for running FOProcessor on a different thread for details.
run
in interface java.lang.Runnable
public java.lang.Exception getRunException()
public int getTotalPageNumber()
public void setConfig(java.util.Properties prop)
prop
- Properties to be set.public static void main(java.lang.String[] args)
public java.lang.String getCompletionStatus(java.lang.String name)
name
- the name of the status. If it is set to null, will return default status.
|
Oracle Fusion Middleware Java API Reference for Oracle Business Intelligence Publisher 11g Release 1 (11.1.1) E17789-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |