final ReportProgressDialog dialog,
final SwingGuiContext swingGuiContext) throws ReportProcessingException
{
if (report == null)
{
throw new ReportProcessingException("HtmlStreamExportTask(..): Report-Parameter cannot be null"); //$NON-NLS-1$
}
try
{
this.progressDialog = dialog;
this.report = report;
if (swingGuiContext != null)
{
this.statusListener = swingGuiContext.getStatusListener();
this.messages = new Messages(swingGuiContext.getLocale(), HtmlExportGUIModule.BASE_RESOURCE_CLASS,
ObjectUtilities.getClassLoader(HtmlExportGUIModule.class));
}
else
{
this.messages = new Messages(Locale.getDefault(), HtmlExportGUIModule.BASE_RESOURCE_CLASS,
ObjectUtilities.getClassLoader(HtmlExportGUIModule.class));
}
final Configuration config = report.getConfiguration();
final String targetFileName = config.getConfigProperty
("org.pentaho.reporting.engine.classic.core.modules.gui.html.stream.TargetFileName"); //$NON-NLS-1$
if (targetFileName == null)
{
throw new ReportProcessingException(messages.getErrorString(
"HtmlStreamExportTask.ERROR_0002_TARGET_NOT_SET")); //$NON-NLS-1$
}
final File targetFile = new File(targetFileName).getCanonicalFile();
targetDirectory = targetFile.getParentFile();
suffix = getSuffix(targetFileName);
filename = IOUtils.getInstance().stripFileExtension(targetFile.getName());
if (targetFile.exists())
{
// lets try to delete it ..
if (targetFile.delete() == false)
{
throw new ReportProcessingException(messages.getErrorString(
"HtmlStreamExportTask.ERROR_0003_TARGET_FILE_EXISTS", targetFile.getAbsolutePath())); //$NON-NLS-1$
}
}
}
catch (IOException ioe)
{
throw new ReportProcessingException("Failed to normalize directories.", ioe);
}
}