01: package org.netbeans.modules.reportgenerator.generator;
02:
03: import org.netbeans.modules.reportgenerator.api.*;
04: import java.io.File;
05: import java.io.OutputStream;
06:
07: /**
08: * ReportGeneratorFactory is the factory for creating various
09: * types of ReportGenerator.
10: *
11: * Example there could be one for pdf reports, one for html reports etc.
12: * @author radval
13: *
14: */
15: public abstract class ReportGeneratorFactory {
16:
17: private static ReportGeneratorFactory mInstance;
18:
19: public static ReportGeneratorFactory getDefault()
20: throws ReportException {
21:
22: if (mInstance == null) {
23:
24: String implClass = System
25: .getProperty(
26: "org.netbeans.modules.reportgenerator.generator.ReportGeneratorFactory",
27: "org.netbeans.modules.reportgenerator.generator.impl.ReportGeneratorFactoryImpl");
28: try {
29:
30: Class cls = Class.forName(implClass);
31: mInstance = (ReportGeneratorFactory) cls.newInstance();
32:
33: } catch (Exception ex) {
34: throw new ReportException(
35: "Failed to create ReportGeneratorFactory", ex);
36: }
37:
38: }
39: return mInstance;
40: }
41:
42: /**
43: * Get a ReportGenerator for a given type.
44: * @param type ReportType
45: * @param reportFile Report File where report will be generated
46: * @return
47: * @throws ReportException
48: */
49: public abstract ReportGenerator newReportGenerator(ReportType type,
50: File reportFile, ReportCustomizationOptions options)
51: throws ReportException;
52:
53: }
|