示例#1
0
 /**
  * return all emitter info through BIRT engine emitter extension. If there are several emitters
  * for a same format, then the default emitter specified by EngineConfig is used, if no default
  * emitter is specified in EngineConfig, then the first emitter is used.
  *
  * @return all emitter info through BIRT engine emitter extension
  */
 public EmitterInfo[] getEmitterInfo() {
   if (emitterInfos == null) {
     EngineConfig config = engine.getConfig();
     Map<String, EmitterInfo> emitters = new HashMap<String, EmitterInfo>();
     EmitterInfo[] tempEmitterInfo = extensionMgr.getEmitterInfo();
     for (EmitterInfo emitterInfo : tempEmitterInfo) {
       String format = emitterInfo.getFormat();
       String id = emitterInfo.getID();
       if (!emitters.containsKey(format) || id.equals(config.getDefaultEmitter(format))) {
         emitters.put(format, emitterInfo);
       }
     }
     emitterInfos = new EmitterInfo[emitters.size()];
     emitters.values().toArray(emitterInfos);
     for (EmitterInfo emitterInfo : emitterInfos) {
       String format = emitterInfo.getFormat();
       String id = emitterInfo.getID();
       String defaultEmitter = config.getDefaultEmitter(format);
       if (defaultEmitter != null && !defaultEmitter.equals(id)) {
         logger.log(
             Level.WARNING,
             "Emitter "
                 + defaultEmitter
                 + " doens't exist! Emitter "
                 + id
                 + " is used for "
                 + format
                 + ".");
       }
     }
   }
   return emitterInfos;
 }
示例#2
0
  public IReportDocument openReportDocument(String systemId, IDocArchiveReader archive, Map options)
      throws EngineException {
    if (options == null) {
      options = new HashMap();
    }
    intializeModuleOptions(options);

    ReportDocumentReader reader = new ReportDocumentReader(systemId, engine, archive, options);
    engine.cacheOpenedDocument(reader);

    return reader;
  }
示例#3
0
 /**
  * use the engine config to setup the module options. Engine config contains two properties for
  * the module options:
  * <li>resourceLocator
  * <li>resourceFolder If the options contains no property, copy the property from the engine
  *     config.
  *
  *     <p>Disable Semantic Check as default unless PARSER_SEMANTIC_CHECK_KEY is specified
  *
  * @param options
  */
 protected void intializeModuleOptions(Map options) {
   EngineConfig config = engine.getConfig();
   if (config != null) {
     if (options.get(ModuleOption.RESOURCE_LOCATOR_KEY) == null) {
       IResourceLocator locator = config.getResourceLocator();
       if (locator != null) {
         options.put(ModuleOption.RESOURCE_LOCATOR_KEY, locator);
       }
     }
     if (options.get(ModuleOption.RESOURCE_FOLDER_KEY) == null) {
       String resourcePath = config.getResourcePath();
       if (resourcePath != null) {
         options.put(ModuleOption.RESOURCE_FOLDER_KEY, resourcePath);
       }
     }
   }
   Object semanticCheck = options.get(ModuleOption.PARSER_SEMANTIC_CHECK_KEY);
   if (semanticCheck == null) {
     options.put(ModuleOption.PARSER_SEMANTIC_CHECK_KEY, Boolean.FALSE);
   }
 }
示例#4
0
 /**
  * constructor
  *
  * @param engine the report engine
  */
 public ReportEngineHelper(ReportEngine engine) {
   this.engine = engine;
   this.logger = engine.getLogger();
   this.extensionMgr = ExtensionManager.getInstance();
 }