protected void initListeners( Class<? extends PluginTypeInterface> aClass, Class<? extends PluginTypeInterface> typeToTrack ) { // keep track of new fragments registry.addPluginListener( aClass, new FragmentTypeListener( registry, typeToTrack ) { /** * Keep track of new Fragments, keep note of the method signature's order * @param fragment The plugin fragment to merge * @param plugin The plugin to be merged */ @Override void mergePlugin( PluginInterface fragment, PluginInterface plugin ) { if ( plugin != null ) { plugin.merge( fragment ); } } } ); // start listening to interested parties registry.addPluginListener( typeToTrack, new FragmentTypeListener( registry, aClass ) { /** * Keep track of new Fragments, keep note of the method signature's order * @param plugin The plugin to be merged * @param fragment The plugin fragment to merge */ @Override void mergePlugin( PluginInterface plugin, PluginInterface fragment ) { if ( plugin != null ) { plugin.merge( fragment ); } } } ); }
public static void init() { PluginRegistry.getInstance().addPluginListener( DatabasePluginType.class, new org.pentaho.di.core.plugins.PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) { clearDatabaseInterfacesMap(); } @Override public void pluginRemoved( Object serviceObject ) { clearDatabaseInterfacesMap(); } @Override public void pluginChanged( Object serviceObject ) { clearDatabaseInterfacesMap(); } } ); }
public void reset() { lock.writeLock().lock(); try { extensionPointPluginMap.clear(); registry.addPluginListener( ExtensionPointPluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) { addExtensionPoint( (PluginInterface) serviceObject ); } @Override public void pluginRemoved( Object serviceObject ) { removeExtensionPoint( (PluginInterface) serviceObject ); } @Override public void pluginChanged( Object serviceObject ) { removeExtensionPoint( (PluginInterface) serviceObject ); addExtensionPoint( (PluginInterface) serviceObject ); } } ); } finally { lock.writeLock().unlock(); } } }
registry.addPluginListener( KettleLifecyclePluginType.class, new PluginTypeListener() {
public LifecycleSupport() { lifeListeners = Collections.synchronizedSet( loadPlugins( LifecyclePluginType.class, LifecycleListener.class ) ); final PluginRegistry registry = PluginRegistry.getInstance(); registry.addPluginListener( LifecyclePluginType.class, new PluginTypeListener() { public void pluginAdded( Object serviceObject ) { LifecycleListener listener = null; try { listener = (LifecycleListener) PluginRegistry.getInstance().loadClass( (PluginInterface) serviceObject ); } catch ( KettlePluginException e ) { e.printStackTrace(); return; } lifeListeners.add( listener ); if ( started ) { try { listener.onStart( handler ); } catch ( LifecycleException e ) { e.printStackTrace(); } } } public void pluginRemoved( Object serviceObject ) { lifeListeners.remove( serviceObject ); } public void pluginChanged( Object serviceObject ) { } } ); }
private SpoonPluginManager() { PluginRegistry pluginRegistry = getPluginRegistry(); pluginRegistry.addPluginListener( SpoonPluginType.class, this ); List<PluginInterface> plugins = pluginRegistry.getPlugins( SpoonPluginType.class ); for ( PluginInterface plug : plugins ) { pluginAdded( plug ); } } }
@Before public void setUpPluginRegistry() throws Exception { // Intercept access to registry registry = LifecycleSupport.registry = KettleLifecycleSupport.registry = mock( PluginRegistry.class ); registeredPlugins = new ArrayList<PluginInterface>(); when( registry.getPlugins( KettleLifecyclePluginType.class ) ).thenReturn( registeredPlugins ); typeListenerRegistration = ArgumentCaptor.forClass( PluginTypeListener.class ); doNothing().when( registry ).addPluginListener( eq( KettleLifecyclePluginType.class ), typeListenerRegistration.capture() ); }
PluginRegistry.getInstance().addPluginListener( StepPluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) { PluginRegistry.getInstance().addPluginListener( JobEntryPluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) {
private ExtensionPointMap( PluginRegistry pluginRegistry ) { this.registry = pluginRegistry; extensionPointPluginMap = HashBasedTable.create(); registry.addPluginListener( ExtensionPointPluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) { addExtensionPoint( (PluginInterface) serviceObject ); } @Override public void pluginRemoved( Object serviceObject ) { removeExtensionPoint( (PluginInterface) serviceObject ); } @Override public void pluginChanged( Object serviceObject ) { removeExtensionPoint( (PluginInterface) serviceObject ); addExtensionPoint( (PluginInterface) serviceObject ); } } ); List<PluginInterface> extensionPointPlugins = registry.getPlugins( ExtensionPointPluginType.class ); for ( PluginInterface extensionPointPlugin : extensionPointPlugins ) { addExtensionPoint( extensionPointPlugin ); } }
pluginRegistry.addPluginListener( CartePluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) { try {
registry.addPluginListener( DatabasePluginType.class, new DatabaseTypeListener( registry ) { @Override public void databaseTypeAdded( String pluginName, DatabaseInterface databaseInterface ) {
PluginRegistry.getInstance().addPluginListener( StepPluginType.class, new PluginTypeListener() { @Override public void pluginAdded( Object serviceObject ) {