private static void initializeDefaultModules ( SecurityContext context ) { if ( context . isInitialized ( ) ) { return ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "SecurityContext default module initializer starting" ) ; } String moduleName ; // Loop through the module names for ( int i = 0 ; i < DEFAULT_MODULES . length ; i ++ ) { moduleName = DEFAULT_MODULES [ i ] ; try { LOGGER . debug ( moduleName + MODULE_INITIALIZER_CLASS ) ; // Get a class instance for the module initializer Class < ? > clazz = Class . forName ( moduleName + MODULE_INITIALIZER_CLASS ) ; // Get the method instance for the module initializer's initialization method Method method = clazz . getMethod ( MODULE_INITIALIZER_METHOD , ( Class [ ] ) null ) ; // Invoke the initialization method Object invokeResult = method . invoke ( clazz . newInstance ( ) , ( Object [ ] ) null ) ; // Validate that the result of the initialization is a valid module context if ( invokeResult instanceof AbstractModuleContext ) { // Register the module context context . registerModuleContext ( moduleName , ( AbstractModuleContext ) invokeResult ) ; } else { throw new IllegalArgumentException ( "Initializer method did not return correct type" ) ; } if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "SecurityContext module " + moduleName + " initialized" ) ; } } catch ( ClassNotFoundException cnfe ) { LOGGER . warn ( "SecurityContext module " + moduleName + " not found, skipping." ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Stack trace: " , cnfe ) ; } } catch ( NoSuchMethodException nsme ) { LOGGER . warn ( "SecurityContext module " + moduleName + " does not support default initialization, skipping." , nsme ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Stack trace: " , nsme ) ; } } catch ( Throwable t ) { LOGGER . error ( "Error initializing SecurityContext module " + moduleName , t ) ; } finally { } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "SecurityContext default module initializer ending" ) ; } }
Initialize and register the contexts for modules that by default are initialized with the security context