/** * 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 ); } }
/** * 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 ); } }
/** * 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); } }
/** * 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); } }