protected void initializeUberspector ( String classname ) { // Avoids direct recursive calls if ( ! StringUtils . isEmpty ( classname ) && ! classname . equals ( this . getClass ( ) . getCanonicalName ( ) ) ) { Uberspect u = instantiateUberspector ( classname ) ; if ( u == null ) { return ; } // Set the log and runtime services, if applicable if ( u instanceof UberspectLoggable ) { ( ( UberspectLoggable ) u ) . setLog ( this . log ) ; } if ( u instanceof RuntimeServicesAware ) { ( ( RuntimeServicesAware ) u ) . setRuntimeServices ( this . runtime ) ; } // Initialize the uberspector try { u . init ( ) ; // Add it to the array this . uberspectors . add ( u ) ; } catch ( Exception e ) { this . log . warn ( e . getMessage ( ) ) ; // If the initialization failed, don't add this uberspector to the chain. } } }
Instantiates and initializes an uberspector class and adds it to the array . Also set the log and runtime services if the class implements the proper interfaces .