private BundleWriterHandler[] masterWriter;
private BundleWriterHandler[] subreportWriter;
public BundleWriter()
{
final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig();
final Iterator masterKeys = configuration.findPropertyKeys(MASTER_HANDLER_PREFIX);
final ArrayList masterWriterList = new ArrayList();
while (masterKeys.hasNext())
{
final String key = (String) masterKeys.next();
final String className = configuration.getConfigProperty(key);
final BundleWriterHandler handler = (BundleWriterHandler)
ObjectUtilities.loadAndInstantiate(className, BundleWriter.class, BundleWriterHandler.class);
if (handler != null)
{
masterWriterList.add(handler);
}
}
masterWriter = (BundleWriterHandler[]) masterWriterList.toArray(new BundleWriterHandler[masterWriterList.size()]);
if (masterWriter.length == 0)
{
throw new IllegalStateException("Bundle-Writer configuration is invalid.");
}
// Sort the list of BundleWriterHandlers so the processing occurs in a better defined order
sortBundleWriterHandlers(masterWriter);
masterWriterList.clear();
final Iterator subKeys = configuration.findPropertyKeys(SUBREPORT_HANDLER_PREFIX);
while (subKeys.hasNext())
{
final String key = (String) subKeys.next();
final String className = configuration.getConfigProperty(key);
final BundleWriterHandler handler = (BundleWriterHandler)
ObjectUtilities.loadAndInstantiate(className, BundleWriter.class, BundleWriterHandler.class);
if (handler != null)
{
masterWriterList.add(handler);