private ObjectId[] loadPluginsIds( List<PluginInterface> plugins, boolean create ) throws KettleException { ObjectId[] ids = new ObjectId[ plugins.size() ]; if ( create ) { return ids; } Map<String, LongObjectId> stepTypeCodeToIdMap = repository.stepDelegate.getStepTypeCodeToIdMap(); int index = 0; for ( PluginInterface sp : plugins ) { ids[index++] = stepTypeCodeToIdMap.get( sp.getIds()[0] ); } return ids; }
public void fillOptionsAndCodesByPlugins( List<PluginInterface> plugins ) { int pluginIndex = 0; for ( PluginInterface plugin : plugins ) { options[ StepPartitioningMeta.methodDescriptions.length + pluginIndex ] = plugin.getDescription(); codes[ StepPartitioningMeta.methodCodes.length + pluginIndex ] = plugin.getIds()[ 0 ]; pluginIndex++; } }
/** * Uses a trans variable called "engine" to determine which engine to use. */ private Predicate<PluginInterface> useThisEngine() { return plugin -> Arrays.stream( plugin.getIds() ) .filter( id -> id.equals( ( transMeta.getVariable( "engine" ) ) ) ) .findAny() .isPresent(); }
public static String[] getValueMetaNames() { List<String> strings = new ArrayList<String>(); List<PluginInterface> plugins = pluginRegistry.getPlugins( ValueMetaPluginType.class ); for ( PluginInterface plugin : plugins ) { int id = Integer.valueOf( plugin.getIds()[0] ); if ( id > 0 && id != ValueMetaInterface.TYPE_SERIALIZABLE ) { strings.add( plugin.getName() ); } } return strings.toArray( new String[strings.size()] ); }
public static String[] getAllValueMetaNames() { List<String> strings = new ArrayList<String>(); List<PluginInterface> plugins = pluginRegistry.getPlugins( ValueMetaPluginType.class ); for ( PluginInterface plugin : plugins ) { String id = plugin.getIds()[0]; if ( !( "0".equals( id ) ) ) { strings.add( plugin.getName() ); } } return strings.toArray( new String[strings.size()] ); }
/** * Add the extension point plugin to the map * * @param extensionPointPlugin */ public void addExtensionPoint( PluginInterface extensionPointPlugin ) { lock.writeLock().lock(); try { for ( String id : extensionPointPlugin.getIds() ) { extensionPointPluginMap.put( extensionPointPlugin.getName(), id, createLazyLoader( extensionPointPlugin ) ); } } finally { lock.writeLock().unlock(); } }
public static String getValueMetaName( int type ) { for ( PluginInterface plugin : pluginRegistry.getPlugins( ValueMetaPluginType.class ) ) { if ( Integer.toString( type ).equals( plugin.getIds()[0] ) ) { return plugin.getName(); } } return "-"; }
public static int getIdForValueMeta( String valueMetaName ) { for ( PluginInterface plugin : pluginRegistry.getPlugins( ValueMetaPluginType.class ) ) { if ( valueMetaName != null && valueMetaName.equalsIgnoreCase( plugin.getName() ) ) { return Integer.valueOf( plugin.getIds()[0] ); } } return ValueMetaInterface.TYPE_NONE; }
/** * Remove the extension point plugin from the map * * @param extensionPointPlugin */ public void removeExtensionPoint( PluginInterface extensionPointPlugin ) { lock.writeLock().lock(); try { for ( String id : extensionPointPlugin.getIds() ) { extensionPointPluginMap.remove( extensionPointPlugin.getName(), id ); } } finally { lock.writeLock().unlock(); } }
public static Image getImage( Shell shell, PluginInterface plugin ) { String id = plugin.getIds()[0]; if ( id != null ) { return GUIResource.getInstance().getImagesJobentries().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); } return null; }
@Override public void pluginAdded( Object serviceObject ) { PluginInterface left = (PluginInterface) serviceObject; PluginInterface right = registry.findPluginWithId( typeToTrack, left.getIds()[0] ); mergePlugin( left, right ); }
@SuppressWarnings( "unchecked" ) public String getPlugins() { List<PluginInterface> plugins = pluginRegistry.getPlugins( RepositoryPluginType.class ); JSONArray list = new JSONArray(); for ( PluginInterface pluginInterface : plugins ) { if ( !pluginInterface.getIds()[0].equals( "PentahoEnterpriseRepository" ) ) { JSONObject repoJSON = new JSONObject(); repoJSON.put( "id", pluginInterface.getIds()[ 0 ] ); repoJSON.put( "name", pluginInterface.getName() ); repoJSON.put( "description", pluginInterface.getDescription() ); list.add( repoJSON ); } } return list.toString(); }
private Map<String, SwingUniversalImage> loadStepImages() { Map<String, SwingUniversalImage> map = new HashMap<>(); for ( PluginInterface plugin : PluginRegistry.getInstance().getPlugins( StepPluginType.class ) ) { try { SwingUniversalImage image = getUniversalImageIcon( plugin ); for ( String id : plugin.getIds() ) { map.put( id, image ); } } catch ( Exception e ) { log.logError( "Unable to load step icon image for plugin: " + plugin.getName() + " (id=" + plugin.getIds()[0] + ")", e ); } } return map; }
private void addStepItem( final TreeItem categoryItem, final PluginInterface step ) { final Image stepImage = GUIResource.getInstance().getImagesStepsSmall().get( step.getIds()[ 0 ] ); String pluginName = step.getName(); String pluginDescription = step.getDescription(); if ( filterMatch( pluginName ) || filterMatch( pluginDescription ) ) { createTreeItem( categoryItem, pluginName, stepImage, step.getIds()[ 0 ] ); coreStepToolTipMap.put( pluginName, pluginDescription ); } }
private Image getImage() { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); String id = plugin.getIds()[ 0 ]; if ( id != null ) { return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); } return null; } }
private Image getImage() { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); String id = plugin.getIds()[ 0 ]; if ( id != null ) { return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); } return null; } }
protected Image getImage() { final PluginInterface plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); final String id = plugin.getIds()[ 0 ]; if ( id != null ) { return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); } return null; }
private Image getImage() { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); String id = plugin.getIds()[ 0 ]; if ( id != null ) { return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE ); } return null; }
private void setDeprecationAndSuggestedStep() { PluginRegistry registry = PluginRegistry.getInstance(); final List<PluginInterface> deprecatedSteps = registry.getPluginsByCategory( StepPluginType.class, BaseMessages.getString( PKG, "BaseStep.Category.Deprecated" ) ); for ( PluginInterface p : deprecatedSteps ) { String[] ids = p.getIds(); if ( !ArrayUtils.isEmpty( ids ) && ids[0].equals( this.stepid ) ) { this.isDeprecated = true; this.suggestion = registry.findPluginWithId( StepPluginType.class, this.stepid ) != null ? registry.findPluginWithId( StepPluginType.class, this.stepid ).getSuggestion() : ""; break; } } }
private void setShellImage( Shell shell ) { if ( stepMeta != null ) { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); createHelpButton( shell, stepMeta, plugin ); String id = plugin.getIds()[ 0 ]; if ( id != null ) { shell.setImage( GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ) ); } } }