public static void initializeOptionalExpressionsMetaData( final String source ) throws ModuleInitializeException { final URL expressionMetaSource = ObjectUtilities.getResource( source, ElementMetaDataParser.class ); if ( expressionMetaSource == null ) { throw new ModuleInitializeException( "Error: Could not find the expression meta-data description file: " + source ); } try { ExpressionRegistry.getInstance().registerFromXml( expressionMetaSource ); } catch ( Exception e ) { logger.debug( "Failed:", e ); throw new ModuleInitializeException( "Error: Could not parse the expression meta-data description file", e ); } }
public static void initializeOptionalDataFactoryMetaData( final String source ) throws ModuleInitializeException { final URL expressionMetaSource = ObjectUtilities.getResource( source, ElementMetaDataParser.class ); if ( expressionMetaSource == null ) { throw new ModuleInitializeException( "Error: Could not find the datafactory meta-data description file" ); } try { DataFactoryRegistry.getInstance().registerFromXml( expressionMetaSource ); } catch ( Exception e ) { logger.debug( "Failed:", e ); throw new ModuleInitializeException( "Error: Could not parse the datafactory meta-data description file", e ); } } }
/** * Tries to load an module initializer and uses this initializer to initialize the module. * * @param classname the class name of the initializer. * @throws ModuleInitializeException if an error occures * @deprecated Use the method that provides a class-context instead. */ protected void performExternalInitialize( final String classname ) throws ModuleInitializeException { try { final ModuleInitializer mi = ObjectUtilities.loadAndInstantiate( classname, AbstractModule.class, ModuleInitializer.class ); if ( mi == null ) { throw new ModuleInitializeException( "Failed to load specified initializer class." ); } mi.performInit(); } catch ( ModuleInitializeException mie ) { throw mie; } catch ( Exception e ) { throw new ModuleInitializeException( "Failed to load specified initializer class.", e ); } }
public static void initializeOptionalElementMetaData( final String source ) throws ModuleInitializeException { final URL metaDataSource = ObjectUtilities.getResource( source, ElementMetaDataParser.class ); if ( metaDataSource == null ) { throw new ModuleInitializeException( "Error: Could not find the optional element meta-data description file: " + source ); } try { ElementTypeRegistry.getInstance().registerFromXml( metaDataSource ); } catch ( Exception e ) { logger.debug( "Failed:", e ); throw new ModuleInitializeException( "Error: Could not parse the element meta-data description file", e ); } }
/** * Executes an weakly referenced external initializer. The initializer will be loaded using reflection and will be * executed once. If the initializing fails with any exception, the module will become unavailable. * * @param classname the classname of the <code>ModuleInitializer</code> implementation * @param context the class-loader context from where to load the module's classes. * @throws ModuleInitializeException if an error occured or the initializer could not be found. */ protected void performExternalInitialize( final String classname, final Class<?> context ) throws ModuleInitializeException { try { final ModuleInitializer mi = ObjectUtilities.loadAndInstantiate( classname, context, ModuleInitializer.class ); if ( mi == null ) { throw new ModuleInitializeException( "Failed to load specified initializer class." ); } mi.performInit(); } catch ( ModuleInitializeException mie ) { throw mie; } catch ( Exception e ) { throw new ModuleInitializeException( "Failed to load specified initializer class.", e ); } }
public static void initializeOptionalReportPreProcessorMetaData( final String source ) throws ModuleInitializeException { final URL reportPreProcessorMetaSource = ObjectUtilities.getResource( source, ElementMetaDataParser.class ); if ( reportPreProcessorMetaSource == null ) { throw new ModuleInitializeException( "Error: Could not find the core report-preprocessor meta-data description file: " + source ); } try { ReportPreProcessorRegistry.getInstance().registerFromXml( reportPreProcessorMetaSource ); } catch ( Exception e ) { logger.debug( "Failed:", e ); throw new ModuleInitializeException( "Error: Could not parse the report-preprocessor meta-data description file", e ); } }
public static void initializeOptionalReportProcessTaskMetaData( final String source ) throws ModuleInitializeException { final URL reportPreProcessorMetaSource = ObjectUtilities.getResource( source, ElementMetaDataParser.class ); if ( reportPreProcessorMetaSource == null ) { throw new ModuleInitializeException( "Error: Could not find the core report-process-task meta-data description file: " + source ); } try { ReportProcessTaskRegistry.getInstance().registerFromXml( reportPreProcessorMetaSource ); } catch ( Exception e ) { logger.debug( "Failed:", e ); throw new ModuleInitializeException( "Error: Could not parse the report-process-task meta-data description file", e ); } }
throw new ModuleInitializeException( "Failed to create the file config storage.", e ); //$NON-NLS-1$ throw new ModuleInitializeException( "Unable to create the specified directory." ); //$NON-NLS-1$ throw new ModuleInitializeException( "Unable to access the specified directory." ); //$NON-NLS-1$
/** * Executes an weakly referenced external initializer. The initializer will be loaded using reflection and will * be executed once. If the initializing fails with any exception, the module will become unavailable. * * @param classname the classname of the <code>ModuleInitializer</code> implementation * @param context the class-loader context from where to load the module's classes. * @throws ModuleInitializeException if an error occured or the initializer could not be found. */ protected void performExternalInitialize(final String classname, final Class<?> context) throws ModuleInitializeException { try { final ModuleInitializer mi = ObjectUtilities.loadAndInstantiate(classname, context, ModuleInitializer.class); if (mi == null) { throw new ModuleInitializeException("Failed to load specified initializer class."); } mi.performInit(); } catch (ModuleInitializeException mie) { throw mie; } catch (Exception e) { throw new ModuleInitializeException("Failed to load specified initializer class.", e); } }
/** * Initializes the module. Use this method to perform all initial setup operations. This method is called only once in * a modules lifetime. If the initializing cannot be completed, throw a ModuleInitializeException to indicate the * error,. The module will not be available to the system. * * @param subSystem * the subSystem. * @throws ModuleInitializeException * if an error ocurred while initializing the module. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { final ClassLoader classLoader = ObjectUtilities.getClassLoader( getClass() ); final InputStream in = classLoader.getResourceAsStream( BSHExpression.BSHHEADERFILE ); if ( in == null ) { throw new ModuleInitializeException( "Unable to locate BSHHeaderFile. " + //$NON-NLS-1$ "This file is required to execute the BeanShellExpressions." ); //$NON-NLS-1$ } try { Class.forName( "bsh.Interpreter", false, classLoader ); //$NON-NLS-1$ } catch ( Exception e ) { throw new ModuleInitializeException( "Unable to load the bean shell interpreter class. " + //$NON-NLS-1$ "This class is required to execute the BeanShellExpressions." ); //$NON-NLS-1$ } ElementMetaDataParser .initializeOptionalExpressionsMetaData( "org/pentaho/reporting/engine/classic/core/modules/misc/beanshell/meta-expressions.xml" ); } }
/** * Loads the default module description from the file "module.properties". This file must be in the same package as * the implementing class. * * @throws ModuleInitializeException if an error occurs. */ protected void loadModuleInfo() throws ModuleInitializeException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream( "module.properties", getClass() ); if ( in == null ) { throw new ModuleInitializeException ( "File 'module.properties' not found in module package." ); } loadModuleInfo( in ); }
/** * Tries to load an module initializer and uses this initializer to initialize * the module. * * @param classname the class name of the initializer. * @throws ModuleInitializeException if an error occures * @deprecated Use the method that provides a class-context instead. */ protected void performExternalInitialize(final String classname) throws ModuleInitializeException { try { final ModuleInitializer mi = ObjectUtilities.loadAndInstantiate(classname, AbstractModule.class, ModuleInitializer.class); if (mi == null) { throw new ModuleInitializeException("Failed to load specified initializer class."); } mi.performInit(); } catch (ModuleInitializeException mie) { throw mie; } catch (Exception e) { throw new ModuleInitializeException("Failed to load specified initializer class.", e); } }
/** * Loads the default module description from the file "module.properties". This file * must be in the same package as the implementing class. * * @throws ModuleInitializeException if an error occurs. */ protected void loadModuleInfo() throws ModuleInitializeException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream("module.properties", getClass()); if (in == null) { throw new ModuleInitializeException ("File 'module.properties' not found in module package."); } loadModuleInfo(in); }
/** * Creates a new module definition based on the 'coremodule.properties' file of this package. * * @throws ModuleInitializeException * if the file could not be loaded. */ public ClassicEngineCoreModule() throws ModuleInitializeException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream( "coremodule.properties", ClassicEngineCoreModule.class ); if ( in == null ) { throw new ModuleInitializeException( "File 'coremodule.properties' not found in JFreeReport package." ); } loadModuleInfo( in ); }
/** * Initializes the module. Use this method to perform all initial setup operations. This method is called only once in * a modules lifetime. If the initializing cannot be completed, throw a ModuleInitializeException to indicate the * error,. The module will not be available to the system. * * @param subSystem * the subSystem. * @throws ModuleInitializeException * if an error ocurred while initializing the module. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { if ( AbstractModule.isClassLoadable( "org.apache.poi.hssf.usermodel.HSSFWorkbook", ExcelTableModule.class ) == false ) { throw new ModuleInitializeException( "Unable to load POI classes." ); } ElementMetaDataParser .initializeOptionalReportProcessTaskMetaData( "org/pentaho/reporting/engine/classic/core/modules/output/table/xls/meta-report-process-tasks.xml" ); } }
this.requiredModules = dependentModules.toArray( new ModuleInfo[ dependentModules.size() ] ); } catch ( IOException ioe ) { throw new ModuleInitializeException( "Failed to load properties", ioe ); } finally { try {
/** * Initializes the module. Use this method to perform all initial setup operations. This method is called only once in * a modules lifetime. If the initializing cannot be completed, throw a ModuleInitializeException to indicate the * error,. The module will not be available to the system. * * @param subSystem * the subSystem. * @throws ModuleInitializeException * if an error ocurred while initializing the module. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { try { final ClassLoader classLoader = ObjectUtilities.getClassLoader( getClass() ); Class.forName( "org.apache.bsf.BSFManager", false, classLoader ); //$NON-NLS-1$ } catch ( Exception e ) { throw new ModuleInitializeException( "Unable to load the bean scripting framework manager class. " + //$NON-NLS-1$ "This class is required to execute the BSFExpressions." ); //$NON-NLS-1$ } ElementMetaDataParser .initializeOptionalExpressionsMetaData( "org/pentaho/reporting/engine/classic/core/modules/misc/bsf/meta-expressions.xml" ); ElementMetaDataParser .initializeOptionalReportPreProcessorMetaData( "org/pentaho/reporting/engine/classic/core/modules/misc/bsf/meta-report-preprocessors.xml" ); } }
throw new ModuleInitializeException("Failed to load properties", ioe);
/** * Initialialize the font factory when this class is loaded and the system property of * <code>"org.pentaho.reporting.engine.classic.core.modules.output.pageable.itext.PDFOutputTarget.AutoInit"</code> is * set to <code>true</code>. * * @throws ModuleInitializeException * if an error occured. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { if ( AbstractModule.isClassLoadable( "com.lowagie.text.Document", BaseFontModule.class ) == false ) { throw new ModuleInitializeException( "Unable to load iText classes. " + "Check your classpath configuration." ); } if ( "onInit".equals( subSystem.getGlobalConfig().getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.output.support.itext.AutoInit" ) ) ) { BaseFontModule.getFontRegistry(); } } }
/** * Initalizes the module. This performs the external initialization and checks that an JAXP1.1 parser is available. * * @param subSystem * the subsystem for this module. * @throws ModuleInitializeException * if an error occured. */ public void initialize( final SubSystem subSystem ) throws ModuleInitializeException { if ( AbstractModule.isClassLoadable( "org.xml.sax.ext.LexicalHandler", ExtParserModule.class ) == false ) { throw new ModuleInitializeException( "Unable to load JAXP-1.1 classes. " + "Check your classpath and XML parser configuration." ); } SubReportReadHandlerFactory.getInstance() .setElementHandler( NAMESPACE, "sub-report", ExtSubReportReadHandler.class ); DataFactoryReadHandlerFactory.getInstance().setElementHandler( NAMESPACE, "data-factory", DataFactoryRefReadHandler.class ); SubReportXmlResourceFactory.register( ExtSubReportXmlFactoryModule.class ); MasterReportXmlResourceFactory.register( ExtReportXmlFactoryModule.class ); performExternalInitialize( ExtParserModuleInit.class.getName(), ExtParserModule.class ); }