/** * Checks whether the given module is available. The method returns true if the module is defined and has been * properly initialized. * * @param moduleClass the module class to be checked. * @return true, if the module is available and initialized, false otherwise. */ public boolean isModuleAvailable( final String moduleClass ) { if ( moduleClass == null ) { throw new NullPointerException(); } final PackageState state = modulesByClass.get( moduleClass ); if ( state == null ) { return false; } return state.getState() == PackageState.STATE_INITIALIZED; }
/** * Checks whether the given module is available. The method returns true if the module is defined and has been * properly initialized. * * @param moduleClass the module class to be checked. * @return true, if the module is available and initialized, false otherwise. */ public boolean isModuleAvailable(final String moduleClass) { if (moduleClass == null) { throw new NullPointerException(); } final PackageState state = modulesByClass.get(moduleClass); if (state == null) { return false; } return state.getState() == PackageState.STATE_INITIALIZED; }
/** * Returns all active modules. This array does only contain modules which were successfully configured and * initialized. * * @return the list of all active modules. */ public Module[] getActiveModules() { final ArrayList<Module> mods = new ArrayList<Module>(); for ( int i = 0; i < this.modules.size(); i++ ) { final PackageState state = this.modules.get( i ); if ( state.getState() == PackageState.STATE_INITIALIZED ) { mods.add( state.getModule() ); } } return mods.toArray( new Module[ mods.size() ] ); }
/** * Returns all active modules. This array does only contain modules which were successfully configured and * initialized. * * @return the list of all active modules. */ public Module[] getActiveModules() { final ArrayList<Module> mods = new ArrayList<Module>(); for (int i = 0; i < this.modules.size(); i++) { final PackageState state = this.modules.get(i); if (state.getState() == PackageState.STATE_INITIALIZED) { mods.add(state.getModule()); } } return mods.toArray(new Module[mods.size()]); }
/** * Checks, whether a certain module is available. * * @param moduleDescription the module description of the desired module. * @return true, if the module is available and the version of the module is compatible, false otherwise. */ public boolean isModuleAvailable( final ModuleInfo moduleDescription ) { if ( moduleDescription == null ) { throw new NullPointerException(); } final PackageState[] packageStates = this.modules.toArray( new PackageState[ this.modules.size() ] ); for ( int i = 0; i < packageStates.length; i++ ) { final PackageState state = packageStates[ i ]; if ( state.getModule().getModuleClass().equals( moduleDescription.getModuleClass() ) ) { return ( state.getState() == PackageState.STATE_INITIALIZED ); } } return false; }
/** * Checks, whether a certain module is available. * * @param moduleDescription the module description of the desired module. * @return true, if the module is available and the version of the module is compatible, false otherwise. */ public boolean isModuleAvailable(final ModuleInfo moduleDescription) { if (moduleDescription == null) { throw new NullPointerException(); } final PackageState[] packageStates = this.modules.toArray(new PackageState[this.modules.size()]); for (int i = 0; i < packageStates.length; i++) { final PackageState state = packageStates[i]; if (state.getModule().getModuleClass().equals(moduleDescription.getModuleClass())) { return (state.getState() == PackageState.STATE_INITIALIZED); } } return false; }
/** * Checks, whether the given module is already loaded in either the given tempModules list or the global package * registry. If tmpModules is null, only the previously installed modules are checked. * * @param tempModules a list of previously loaded modules. * @param module the module specification that is checked. * @return true, if the module is already loaded, false otherwise. */ private int containsModule( final ArrayList<Module> tempModules, final ModuleInfo module ) { if ( tempModules != null ) { final ModuleInfo[] mods = tempModules.toArray( new ModuleInfo[ tempModules.size() ] ); for ( int i = 0; i < mods.length; i++ ) { if ( mods[ i ].getModuleClass().equals( module.getModuleClass() ) ) { return RETURN_MODULE_LOADED; } } } final PackageState[] packageStates = this.modules.toArray( new PackageState[ this.modules.size() ] ); for ( int i = 0; i < packageStates.length; i++ ) { if ( packageStates[ i ].getModule().getModuleClass().equals( module.getModuleClass() ) ) { if ( packageStates[ i ].getState() == PackageState.STATE_ERROR ) { return RETURN_MODULE_ERROR; } else { return RETURN_MODULE_LOADED; } } } return RETURN_MODULE_UNKNOWN; }
if (packageStates[i].getState() == PackageState.STATE_ERROR)
for ( int i = 0; i < modulesCount; i++ ) { final PackageState state = modules.get( i ); if ( state.getState() == PackageState.STATE_ERROR ) { errorModules.add( state ); } else {
if (state.getState() == PackageState.STATE_ERROR)
/** * Checks whether the module is configurable. A module is considered configurable if all dependencies exist and are * configured. * * @param state the package state that should be checked. * @return true, if the module can be configured, false otherwise. */ private boolean isConfigurable( final PackageState state ) { final ModuleInfo[] requiredModules = state.getModule().getRequiredModules(); for ( int i = 0; i < requiredModules.length; i++ ) { final ModuleInfo module = requiredModules[ i ]; final String key = module.getModuleClass(); final PackageState dependentState = modulesByClass.get( key ); if ( dependentState == null ) { LOGGER.warn( "Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not found." ); return false; } if ( dependentState.getState() != PackageState.STATE_CONFIGURED ) { LOGGER.warn( "Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not configured." ); return false; } } return true; }
/** * Checks whether the module is configurable. A module is considered configurable if all dependencies exist and * are initialized. * * @param state the package state that should be checked. * @return true, if the module can be configured, false otherwise. */ private boolean isInitializable(final PackageState state) { final ModuleInfo[] requiredModules = state.getModule().getRequiredModules(); for (int i = 0; i < requiredModules.length; i++) { final ModuleInfo module = requiredModules[i]; final String key = module.getModuleClass(); final PackageState dependentState = modulesByClass.get(key); if (dependentState == null) { LOGGER.warn("Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not found."); return false; } if (dependentState.getState() != PackageState.STATE_INITIALIZED) { LOGGER.warn("Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not initializable."); return false; } } return true; }
/** * Checks whether the module is configurable. A module is considered configurable if all dependencies exist and are * initialized. * * @param state the package state that should be checked. * @return true, if the module can be configured, false otherwise. */ private boolean isInitializable( final PackageState state ) { final ModuleInfo[] requiredModules = state.getModule().getRequiredModules(); for ( int i = 0; i < requiredModules.length; i++ ) { final ModuleInfo module = requiredModules[ i ]; final String key = module.getModuleClass(); final PackageState dependentState = modulesByClass.get( key ); if ( dependentState == null ) { LOGGER.warn( "Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not found." ); return false; } if ( dependentState.getState() != PackageState.STATE_INITIALIZED ) { LOGGER.warn( "Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not initializable." ); return false; } } return true; }
/** * Checks whether the module is configurable. A module is considered configurable if all dependencies exist and * are configured. * * @param state the package state that should be checked. * @return true, if the module can be configured, false otherwise. */ private boolean isConfigurable(final PackageState state) { final ModuleInfo[] requiredModules = state.getModule().getRequiredModules(); for (int i = 0; i < requiredModules.length; i++) { final ModuleInfo module = requiredModules[i]; final String key = module.getModuleClass(); final PackageState dependentState = modulesByClass.get(key); if (dependentState == null) { LOGGER.warn("Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not found."); return false; } if (dependentState.getState() != PackageState.STATE_CONFIGURED) { LOGGER.warn("Required dependency '" + key + "' for module '" + state.getModule().getModuleClass() + " not configured."); return false; } } return true; }