Java Code Examples for org.pentaho.di.core.plugins.PluginRegistry#getPlugins()
The following examples show how to use
org.pentaho.di.core.plugins.PluginRegistry#getPlugins() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpoonUiExtenderPluginType.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public List<SpoonUiExtenderPluginInterface> getRelevantExtenders( Class<?> clazz, String uiEvent ) { PluginRegistry instance = PluginRegistry.getInstance(); List<PluginInterface> pluginInterfaces = instance.getPlugins( SpoonUiExtenderPluginType.class ); List<SpoonUiExtenderPluginInterface> relevantPluginInterfaces = new ArrayList<SpoonUiExtenderPluginInterface>( ); if ( pluginInterfaces != null ) { for ( PluginInterface pluginInterface : pluginInterfaces ) { try { Object loadClass = instance.loadClass( pluginInterface ); SpoonUiExtenderPluginInterface spoonUiExtenderPluginInterface = (SpoonUiExtenderPluginInterface) loadClass; Set<String> events = spoonUiExtenderPluginInterface.respondsTo().get( clazz ); if ( events != null && events.contains( uiEvent ) ) { relevantPluginInterfaces.add( spoonUiExtenderPluginInterface ); } } catch ( KettlePluginException e ) { e.printStackTrace(); } } } return relevantPluginInterfaces; }
Example 2
Source File: BeamKettle.java From kettle-beam with Apache License 2.0 | 5 votes |
private static PluginInterface findPlugin( PluginRegistry registry, Class<? extends PluginTypeInterface> pluginTypeClass, String pluginClassName ) { PluginMainClassType classType = pluginTypeClass.getAnnotation( PluginMainClassType.class ); // System.out.println("Found class type : "+classType+" as main plugin class"); List<PluginInterface> plugins = registry.getPlugins( pluginTypeClass ); // System.out.println("Found "+plugins.size()+" plugins of type "+pluginTypeClass); for ( PluginInterface plugin : plugins ) { String mainClassName = plugin.getClassMap().get( classType.value() ); if ( mainClassName != null && pluginClassName.equals( mainClassName ) ) { return plugin; } } return null; }
Example 3
Source File: StringEvaluatorIT.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void loadValueMetaPlugins() { // Need to load the ValueMeta plugins PluginRegistry registry = PluginRegistry.getInstance(); assertNotNull( "Registry singleton was not found!", registry ); // Register a new plugin type... // PluginRegistry.addPluginType( ValueMetaPluginType.getInstance() ); // Plugin Registry should initialize without exception Exception initException = null; try { PluginRegistry.init(); } catch ( Exception e ) { initException = e; } assertNull( initException ); // There will always be a PluginRegistryPluginType, so see if we enough plugin types here. // List<Class<? extends PluginTypeInterface>> pluginTypes = registry.getPluginTypes(); assertTrue( "At least two plugin types expected in the registry", pluginTypes.size() > 1 ); // ... and have at least 1 ValueMetaPlugin List<PluginInterface> valueMetaPlugins = registry.getPlugins( ValueMetaPluginType.class ); assertTrue( "Size of plugins list expected to be >1", valueMetaPlugins.size() > 1 ); }
Example 4
Source File: SpoonPluginManager.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private SpoonPluginManager() { PluginRegistry pluginRegistry = getPluginRegistry(); pluginRegistry.addPluginListener( SpoonPluginType.class, this ); List<PluginInterface> plugins = pluginRegistry.getPlugins( SpoonPluginType.class ); for ( PluginInterface plug : plugins ) { pluginAdded( plug ); } }
Example 5
Source File: GUIResource.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Load all step images from files. */ private void loadJobEntryImages() { imagesJobentries = new Hashtable<>(); imagesJobentriesSmall = new Hashtable<>(); // // // // JOB ENTRY IMAGES TO LOAD // // PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> plugins = registry.getPlugins( JobEntryPluginType.class ); for ( PluginInterface plugin : plugins ) { if ( "SPECIAL".equals( plugin.getIds()[ 0 ] ) ) { continue; } SwtUniversalImage image = null; Image smallImage; String filename = plugin.getImageFile(); try { ClassLoader classLoader = registry.getClassLoader( plugin ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); } catch ( Exception t ) { log.logError( "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[ 0 ], t ); } finally { if ( image == null ) { log.logError( "Unable to load image [" + filename + "] for plugin " + plugin.getIds()[ 0 ] ); image = SwtSvgImageUtil.getMissingImage( display ); } } // Calculate the smaller version of the image @ 16x16... // Perhaps we should make this configurable? smallImage = image.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE ); imagesJobentries.put( plugin.getIds()[ 0 ], image ); imagesJobentriesSmall.put( plugin.getIds()[ 0 ], smallImage ); } }
Example 6
Source File: ExtensionPointMap.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * Reinitialize the extension point plugins map */ public void reInitialize() { lock.writeLock().lock(); try { extensionPointPluginMap = HashBasedTable.create(); final PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> extensionPointPlugins = registry.getPlugins( ExtensionPointPluginType.class ); for ( PluginInterface extensionPointPlugin : extensionPointPlugins ) { addExtensionPoint( extensionPointPlugin ); } } finally { lock.writeLock().unlock(); } }
Example 7
Source File: KettleDatabaseRepositoryCreationHelper.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Update the list in R_JOBENTRY_TYPE * * @param create * * @exception KettleException * if something went wrong during the update. */ public void updateJobEntryTypes( List<String> statements, boolean dryrun, boolean create ) throws KettleException { synchronized ( repository ) { // We should only do an update if something has changed... PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> jobPlugins = registry.getPlugins( JobEntryPluginType.class ); for ( int i = 0; i < jobPlugins.size(); i++ ) { PluginInterface jobPlugin = jobPlugins.get( i ); String type_desc = jobPlugin.getIds()[0]; String type_desc_long = jobPlugin.getName(); ObjectId id = null; if ( !create ) { id = repository.jobEntryDelegate.getJobEntryTypeID( type_desc ); } if ( id == null ) { // Not found, we need to add this one... // We need to add this one ... id = new LongObjectId( i + 1 ); if ( !create ) { id = repository.connectionDelegate.getNextJobEntryTypeID(); } RowMetaAndData table = new RowMetaAndData(); table.addValue( new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_ID_JOBENTRY_TYPE ), id ); table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_CODE ), type_desc ); table.addValue( new ValueMetaString( KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_DESCRIPTION ), type_desc_long ); if ( dryrun ) { String sql = database.getSQLOutput( null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE, table.getRowMeta(), table.getData(), null ); statements.add( sql ); } else { database.prepareInsert( table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE ); database.setValuesInsert( table ); database.insertRow(); database.closeInsert(); } } } } }
Example 8
Source File: PropsUI.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@SuppressWarnings( "unchecked" ) protected synchronized void init() { super.createLogChannel(); properties = new Properties(); pluginHistory = new ArrayList<ObjectUsageCount>(); setDefault(); loadProps(); addDefaultEntries(); loadPluginHistory(); loadScreens(); loadLastUsedFiles(); loadLastUsedRepoFiles(); loadOpenTabFiles(); resetRecentSearches(); PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> plugins = registry.getPlugins( LifecyclePluginType.class ); List<GUIOption<Object>> leditables = new ArrayList<GUIOption<Object>>(); for ( PluginInterface plugin : plugins ) { if ( !plugin.getClassMap().keySet().contains( GUIOption.class ) ) { continue; } try { GUIOption<Object> loaded = registry.loadClass( plugin, GUIOption.class ); if ( loaded != null ) { leditables.add( loaded ); } } catch ( ClassCastException cce ) { // Not all Lifecycle plugins implement GUIOption, keep calm and carry on LogChannel.GENERAL.logDebug( "Plugin " + plugin.getIds()[ 0 ] + " does not implement GUIOption, it will not be editable" ); } catch ( Exception e ) { LogChannel.GENERAL.logError( "Unexpected error loading class for plugin " + plugin.getName(), e ); } } editables = Collections.unmodifiableList( leditables ); }
Example 9
Source File: GUIResource.java From pentaho-kettle with Apache License 2.0 | 4 votes |
/** * Load all step images from files. */ private void loadStepImages() { // imagesSteps.clear(); // imagesStepsSmall.clear(); // // STEP IMAGES TO LOAD // PluginRegistry registry = PluginRegistry.getInstance(); List<PluginInterface> steps = registry.getPlugins( StepPluginType.class ); for ( PluginInterface step : steps ) { if ( imagesSteps.get( step.getIds()[ 0 ] ) != null ) { continue; } SwtUniversalImage image = null; Image smallImage; String filename = step.getImageFile(); try { ClassLoader classLoader = registry.getClassLoader( step ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); } catch ( Exception t ) { log.logError( String.format( "Error occurred loading image [%s] for plugin %s", filename, step ), t ); } finally { if ( image == null ) { log.logError( String.format( "Unable to load image file [%s] for plugin %s", filename, step ) ); image = SwtSvgImageUtil.getMissingImage( display ); } } // Calculate the smaller version of the image @ 16x16... // Perhaps we should make this configurable? // smallImage = image.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE ); imagesSteps.put( step.getIds()[ 0 ], image ); imagesStepsSmall.put( step.getIds()[ 0 ], smallImage ); } }