/** * Create a new and uninitialized module node factory. */ public ModuleNodeFactory( final AbstractBoot packageManager ) { this.packageManager = packageManager; messages = Messages.getInstance(); activeModules = packageManager.getPackageManager().getAllModules(); Arrays.sort( activeModules, new ModuleSorter() ); globalNodes = new ArrayList<ConfigTreeModuleNode>(); localNodes = new ArrayList<ConfigTreeModuleNode>(); configEntryLookup = new HashMap<String, ConfigDescriptionEntry>(); }
/** * Performs the actual boot process. */ protected void performBoot() { if ( ClassicEngineBoot.isStrictFP() == false ) { ClassicEngineBoot.logger.warn( "The used VM seems to use a non-strict floating point arithmetics" ); // NON-NLS ClassicEngineBoot.logger.warn( "Layouts computed with this Java Virtual Maschine may be invalid." ); // NON-NLS ClassicEngineBoot.logger.warn( "JFreeReport and the library 'iText' depend on the strict floating point rules" ); // NON-NLS ClassicEngineBoot.logger.warn( "of Java1.1 as implemented by the Sun Virtual Maschines." ); // NON-NLS ClassicEngineBoot.logger.warn( "If you are using the BEA JRockit VM, start the Java VM with the option" ); // NON-NLS ClassicEngineBoot.logger.warn( "'-Xstrictfp' to restore the default behaviour." ); // NON-NLS } final PackageManager mgr = getPackageManager(); mgr.addModule( ClassicEngineCoreModule.class.getName() ); mgr.load( "org.pentaho.reporting.engine.classic.core.modules." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.extensions.modules." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.extensions.datasources." ); // NON-NLS mgr.load( "org.pentaho.reporting.engine.classic.core.userdefined.modules." ); // NON-NLS bootAdditionalModules(); mgr.initializeModules(); if ( mgr.isModuleAvailable( ClassicEngineCoreModule.class.getName() ) == false ) { throw new IllegalStateException( "Booting the report-engine failed." ); } StyleKey.lock(); }
/** * Returns the packageManager instance of the package manager. * * @return The package manager. */ public synchronized PackageManager getPackageManager() { if ( this.packageManager == null ) { this.packageManager = new PackageManager( this ); } return this.packageManager; }
/** * Performs the boot. */ protected void performBoot() { final PackageManager packageManager = getPackageManager(); packageManager.load( "org.pentaho.reporting.libraries.resourceloader.modules." ); packageManager.initializeModules(); } }
final Module[] allMods = getAllModules(); final ArrayList<Module> activeModules = new ArrayList<Module>(); if ( isModuleAvailable( allMods[ i ] ) ) { activeModules.add( allMods[ i ] );
if ( acceptVersion( moduleInfo, module ) == false ) { dropFailedModule( state ); return false; final int moduleContained = containsModule( modules, module ); if ( moduleContained == RETURN_MODULE_ERROR ) { dropFailedModule( state ); return false; } else if ( moduleContained == RETURN_MODULE_UNKNOWN ) { module.getClass() ); final PackageState state = new PackageState( module, PackageState.STATE_ERROR ); dropFailedModule( state ); return false; final ModuleInfo[] required = module.getRequiredModules(); for ( int i = 0; i < required.length; i++ ) { if ( loadModule( required[ i ], incompleteModules, modules, true ) == false ) { LOGGER.debug( "Indicated failure for module: " + module.getModuleClass() ); final PackageState state = new PackageState( module, PackageState.STATE_ERROR ); dropFailedModule( state ); return false; if ( loadModule( optional[ i ], incompleteModules, modules, true ) == false ) { LOGGER.debug( "Optional module: " + optional[ i ].getModuleClass() + " was not loaded." ); if ( containsModule( modules, module ) == RETURN_MODULE_UNKNOWN ) {
/** * A helper method that checks, whether a given module is available. The result of this method is undefined if the * system has no been booted yet. * * @param moduleClass * the class-name of the module that should be tested. * @return true, if the module is available and has been initialized correctly, false otherwise. */ public boolean isModuleAvailable( final String moduleClass ) { return getPackageManager().isModuleAvailable( new DefaultModuleInfo( moduleClass, null, null, null ) ); }
/** * Loads all modules mentioned in the report configuration starting with the given prefix. This method is used during * the boot process of JFreeReport. You should never need to call this method directly. * * @param modulePrefix the module prefix. */ public void load( final String modulePrefix ) { if ( modulePrefix == null ) { throw new NullPointerException(); } if ( this.initSections.contains( modulePrefix ) ) { return; } this.initSections.add( modulePrefix ); final Configuration config = this.booter.getGlobalConfig(); final Iterator it = config.findPropertyKeys( modulePrefix ); int count = 0; while ( it.hasNext() ) { final String key = (String) it.next(); if ( key.endsWith( ".Module" ) ) { final String moduleClass = config.getConfigProperty( key ); if ( moduleClass != null && moduleClass.length() > 0 ) { addModule( moduleClass ); count++; } } } LOGGER.debug( "Loaded a total of " + count + " modules under prefix: " + modulePrefix ); }
/** * Configures the module by loading the configuration properties and adding them to the package configuration. * * @param subSystem the subsystem. */ public void configure( final SubSystem subSystem ) { final InputStream in = ObjectUtilities.getResourceRelativeAsStream( "configuration.properties", getClass() ); if ( in == null ) { return; } try { subSystem.getPackageManager().getPackageConfiguration().load( in ); } finally { try { in.close(); } catch ( IOException e ) { // can be ignored ... } } }
public void parseConfiguration( final AbstractBoot boot ) throws IOException { final String domain = boot.getConfigurationDomain(); final Module[] activeModules = boot.getPackageManager().getActiveModules(); for ( int i = 0; i < activeModules.length; i++ ) { final Module activeModule = activeModules[ i ]; final InputStream resourceAsStream = activeModule.getClass().getResourceAsStream( "config-description.xml" ); if ( resourceAsStream != null ) { try { parse( resourceAsStream, domain ); } finally { resourceAsStream.close(); } } } } }
LOGGER.warn( "Module " + module.getName() + " does not define a major version." ); } else { final int compare = acceptVersion( moduleRequirement.getMajorVersion(), module.getMajorVersion() ); if ( compare > 0 ) { LOGGER.warn( "Module " + module.getName() + " does not define a minor version." ); } else { final int compare = acceptVersion( moduleRequirement.getMinorVersion(), module.getMinorVersion() ); if ( compare > 0 ) { LOGGER.debug( "Module " + module.getName() + " does not define a patch level." ); } else { if ( acceptVersion( moduleRequirement.getPatchLevel(), module.getPatchLevel() ) > 0 ) { LOGGER.debug( "Did not accept patchlevel: "
final Module[] allMods = getAllModules(); final ArrayList<Module> activeModules = new ArrayList<Module>(); if (isModuleAvailable(allMods[i]))
if (acceptVersion(moduleInfo, module) == false) + moduleInfo + ", but found Version: \n" + module); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); return false; final int moduleContained = containsModule(modules, module); if (moduleContained == RETURN_MODULE_ERROR) dropFailedModule(state); return false; module.getClass()); final PackageState state = new PackageState(module, PackageState.STATE_ERROR); dropFailedModule(state); return false; for (int i = 0; i < required.length; i++) if (loadModule(required[i], incompleteModules, modules, true) == false) dropFailedModule(state); return false; if (loadModule(optional[i], incompleteModules, modules, true) == false) if (containsModule(modules, module) == RETURN_MODULE_UNKNOWN)
@Test public void testModuleLoaded() { Assert.assertTrue( ClassicEngineBoot.getInstance().getPackageManager().isModuleAvailable( Backlog6746Module.class.getName() )); Assert.assertTrue( ExpressionRegistry.getInstance().getExpressionMetaData( Backlog6746Expression.class.getName() ) != null); }
if (moduleClass != null && moduleClass.length() > 0) addModule(moduleClass); count++;
/** * Configures the module by loading the configuration properties and * adding them to the package configuration. * * @param subSystem the subsystem. */ public void configure(final SubSystem subSystem) { final InputStream in = ObjectUtilities.getResourceRelativeAsStream("configuration.properties", getClass()); if (in == null) { return; } try { subSystem.getPackageManager().getPackageConfiguration().load(in); } finally { try { in.close(); } catch (IOException e) { // can be ignored ... } } }
public void parseConfiguration(final AbstractBoot boot) throws IOException { final String domain = boot.getConfigurationDomain(); final Module[] activeModules = boot.getPackageManager().getActiveModules(); for (int i = 0; i < activeModules.length; i++) { final Module activeModule = activeModules[i]; final InputStream resourceAsStream = activeModule.getClass().getResourceAsStream("config-description.xml"); if (resourceAsStream != null) { try { parse(resourceAsStream, domain); } finally { resourceAsStream.close(); } } } } }
final int compare = acceptVersion(moduleRequirement.getMajorVersion(), module.getMajorVersion()); if (compare > 0) final int compare = acceptVersion(moduleRequirement.getMinorVersion(), module.getMinorVersion()); if (compare > 0) if (acceptVersion(moduleRequirement.getPatchLevel(), module.getPatchLevel()) > 0)
public void testAll() throws Exception { final ArrayList states = new ArrayList(); final Module[] mods = ClassicEngineBoot.getInstance().getPackageManager().getAllModules(); int swingPreviewPos = 0; int fileConfigPos = 0; for ( int i = 0; i < mods.length; i++ ) { states.add( new PackageState( mods[i] ) ); } PackageSorter.sort( states ); for ( int i = 0; i < states.size(); i++ ) { final PackageState state = (PackageState) states.get( i ); if ( state.getModule().getClass().equals( SwingPreviewModule.class ) ) { logger.debug( "SwingPreviewModule: " + i ); swingPreviewPos = i; } if ( state.getModule().getClass().equals( FileConfigStoreModule.class ) ) { logger.debug( "File: " + i ); fileConfigPos = i; } } assertTrue( fileConfigPos < swingPreviewPos ); }
rootProperty.load( staticConfig, source ); globalConfig.insertConfiguration( rootProperty ); globalConfig.insertConfiguration( getPackageManager().getPackageConfiguration() );