public void execute() throws MojoExecutionException, MojoFailureException
{
// configure fopFactory as desired
FopFactory fopFactory = FopFactory.newInstance();
getLog().debug( " FopXmlFile properties: "
+ Arrays.asList( fopXmlFiles ) );
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
// configure foUserAgent as desired
File outDir = new File( builddir );
outDir.mkdirs();
for ( int i = 0; i < fopXmlFiles.length; i++ )
{
File outFile = new File( builddir, fopXmlFiles[i].getOutputFile() );
File xsltfile = new File( basedir, fopXmlFiles[i].getXsltStylesheet() );
File xmlfile = new File( basedir, fopXmlFiles[i].getXmlInputFile() );
OutputFileType outputFileType =
OutputFileType.valueOf( fopXmlFiles[i].getOutputFileType() );
// Setup output
OutputStream out = null;
try
{
out = new java.io.FileOutputStream( outFile );
out = new java.io.BufferedOutputStream( out );
} catch ( FileNotFoundException e )
{
getLog()
.error( "Failed to open outputfile "
+ outFile.getAbsolutePath()
+ " reason: "+ e.getMessage(), e );
}
if ( out != null )
{
// Construct fop with desired output format
try
{
Fop fop = null;
if ( OutputFileType.PDF.equals( outputFileType ) )
{
fop = fopFactory.newFop( MimeConstants.MIME_PDF,
foUserAgent, out );
}
// Setup XSLT
TransformerFactory factory = TransformerFactory