org.pentaho.reporting.engine.classic.core.modules.parser.bundle.writer
Class ResourceWriter

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.modules.parser.bundle.writer.ResourceWriter
All Implemented Interfaces:
BundleWriterHandler

public class ResourceWriter
extends Object
implements BundleWriterHandler

A handler that writes resources into the document bundle based on the resource keys found inside the report definition.

Author:
David Kincade

Constructor Summary
ResourceWriter()
           
 
Method Summary
static String derivePatternFromPath(org.pentaho.reporting.libraries.repository.MimeRegistry mimeRegistry, String mimeType, String path)
           
 int getProcessingOrder()
          Returns a relatively low ing order indicating this BundleWriterHandler should be one of the first processed.
static boolean isEmbeddedKey(MasterReport report, org.pentaho.reporting.libraries.resourceloader.ResourceKey resourceKey)
           
 String writeReport(org.pentaho.reporting.libraries.docbundle.WriteableDocumentBundle bundle, BundleWriterState state)
          Writes a certain aspect into a own file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceWriter

public ResourceWriter()
Method Detail

getProcessingOrder

public int getProcessingOrder()
Returns a relatively low ing order indicating this BundleWriterHandler should be one of the first processed. This is due to the fact that any Resource which is writen into the DocumentBundle will cause the report's definition to be modified with a new Resource Key.

Specified by:
getProcessingOrder in interface BundleWriterHandler
Returns:
the relative processing order for this BundleWriterHandler

writeReport

public String writeReport(org.pentaho.reporting.libraries.docbundle.WriteableDocumentBundle bundle,
                          BundleWriterState state)
                   throws IOException,
                          BundleWriterException
Writes a certain aspect into a own file. The name of file inside the bundle is returned as string. The file name returned is always absolute and can be made relative by using the IOUtils of LibBase. If the writer-handler did not generate a file on its own, it should return null.

Specified by:
writeReport in interface BundleWriterHandler
Parameters:
bundle - the bundle where to write to.
state - the writer state to hold the current processing information.
Returns:
the name of the newly generated file or null if no file was created.
Throws:
IOException - if any error occured
BundleWriterException - if a bundle-management error occured.

isEmbeddedKey

public static boolean isEmbeddedKey(MasterReport report,
                                    org.pentaho.reporting.libraries.resourceloader.ResourceKey resourceKey)

derivePatternFromPath

public static String derivePatternFromPath(org.pentaho.reporting.libraries.repository.MimeRegistry mimeRegistry,
                                           String mimeType,
                                           String path)