public PluginInterface findPlugin ( Instance instance ) { // Find a plug-in PluginInterface result = null ; if ( this . simulatePlugins ) { this . logger . finer ( "Simulating plugins..." ) ; result = new PluginMock ( ) ; } else { String installerName = null ; if ( instance . getComponent ( ) != null ) installerName = ComponentHelpers . findComponentInstaller ( instance . getComponent ( ) ) ; // Run through available plug-ins for ( PluginInterface pi : this . plugins ) { if ( pi . getPluginName ( ) . equalsIgnoreCase ( installerName ) ) { result = pi ; break ; } } if ( result == null ) this . logger . severe ( "No plugin was found for instance '" + instance . getName ( ) + "' with installer '" + installerName + "'." ) ; } // Initialize the result, if any if ( result != null ) result . setNames ( this . applicationName , this . scopedInstancePath ) ; return result == null ? null : new PluginProxy ( result ) ; }
Finds the right plug - in for an instance .