public PurRepositoryProxy( PluginRegistry registry ) throws KettlePluginException { PluginInterface purPlugin = registry.findPluginWithId( RepositoryPluginType.class, PUR_PLUGIN_ID ); purPluginClassLoader = registry.getClassLoader( purPlugin ); }
public PluginInterface findPluginWithId( Class<? extends PluginTypeInterface> pluginType, String pluginId, boolean waitForPluginToBeAvailable ) { PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitForPluginToBeAvailable && pluginInterface == null ? waitForPluginToBeAvailable( pluginType, pluginId, WAIT_FOR_PLUGIN_TO_BE_AVAILABLE_LIMIT ) : pluginInterface; }
public static final int getMethodType( String description ) { for ( int i = 0; i < methodDescriptions.length; i++ ) { if ( methodDescriptions[i].equalsIgnoreCase( description ) ) { return i; } } for ( int i = 0; i < methodCodes.length; i++ ) { if ( methodCodes[i].equalsIgnoreCase( description ) ) { return i; } } PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId( PartitionerPluginType.class, description ); if ( plugin != null ) { return PARTITIONING_METHOD_SPECIAL; } return PARTITIONING_METHOD_NONE; }
/** * Gets the plug-in type description * * @return the plug-in type description */ public String getTypeDesc() { PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId( JobEntryPluginType.class, configId ); return plugin.getDescription(); }
@Override public void pluginAdded( Object serviceObject ) { PluginInterface left = (PluginInterface) serviceObject; PluginInterface right = registry.findPluginWithId( typeToTrack, left.getIds()[0] ); mergePlugin( left, right ); }
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 PluginInterface waitForPluginToBeAvailable( Class<? extends PluginTypeInterface> pluginType, String pluginId, int waitLimit ) { int timeToSleep = 50; try { Thread.sleep( timeToSleep ); waitLimit -= timeToSleep; } catch ( InterruptedException e ) { log.logError( e.getLocalizedMessage(), e ); Thread.currentThread().interrupt(); return null; } PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitLimit <= 0 && pluginInterface == null ? null : pluginInterface != null ? pluginInterface : waitForPluginToBeAvailable( pluginType, pluginId, waitLimit ); } }
/** * @return entry in JobEntryInterface.typeCode[] for native jobs, entry.getTypeCode() for plugins */ public String getTypeDesc() { PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId( JobEntryPluginType.class, entry.getPluginId() ); return plugin.getDescription(); }
public void helpStep() { final StepMeta stepMeta = (StepMeta) selectionObject; PluginInterface stepPlugin = PluginRegistry.getInstance().findPluginWithId( StepPluginType.class, stepMeta.getStepID() ); HelpUtils.openHelpDialog( shell, stepPlugin ); }
public static final String getMethod( String name ) { if ( Utils.isEmpty( name ) ) { return methodCodes[PARTITIONING_METHOD_NONE]; } for ( int i = 0; i < methodDescriptions.length; i++ ) { if ( methodDescriptions[i].equalsIgnoreCase( name ) ) { return methodCodes[i]; } } for ( int i = 0; i < methodCodes.length; i++ ) { if ( methodCodes[i].equalsIgnoreCase( name ) ) { return methodCodes[i]; } } PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.findPluginWithName( PartitionerPluginType.class, name ); if ( plugin != null ) { return name; } plugin = registry.findPluginWithId( PartitionerPluginType.class, name ); if ( plugin != null ) { return name; } return methodCodes[PARTITIONING_METHOD_NONE]; }
private void setDeprecationAndSuggestedJobEntry() { PluginRegistry registry = PluginRegistry.getInstance(); final List<PluginInterface> deprecatedJobEntries = registry.getPluginsByCategory( JobEntryPluginType.class, BaseMessages.getString( JobMeta.class, "JobCategory.Category.Deprecated" ) ); for ( PluginInterface p : deprecatedJobEntries ) { String[] ids = p.getIds(); if ( !ArrayUtils.isEmpty( ids ) && ids[0].equals( this.entry != null ? this.entry.getPluginId() : "" ) ) { this.isDeprecated = true; this.suggestion = registry.findPluginWithId( JobEntryPluginType.class, this.entry.getPluginId() ) != null ? registry.findPluginWithId( JobEntryPluginType.class, this.entry.getPluginId() ).getSuggestion() : ""; break; } } } }
@Override public String toString() { // The rule name with an indication of whether or not this rule is enabled should do for now. // String pluginId = PluginRegistry.getInstance().getPluginId( this ); PluginInterface plugin = PluginRegistry.getInstance().findPluginWithId( ImportRulePluginType.class, pluginId ); return plugin.getName() + " (" + ( enabled ? "enabled" : "disabled" ) + ")."; }
public void loadXML( Node rulesNode ) throws KettleException { List<Node> ruleNodes = XMLHandler.getNodes( rulesNode, BaseImportRule.XML_TAG ); for ( Node ruleNode : ruleNodes ) { String id = XMLHandler.getTagValue( ruleNode, "id" ); PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.findPluginWithId( ImportRulePluginType.class, id ); if ( plugin == null ) { throw new KettleException( "The import rule of type '" + id + "' could not be found in the plugin registry." ); } ImportRuleInterface rule = (ImportRuleInterface) registry.loadClass( plugin ); rule.loadXML( ruleNode ); getRules().add( rule ); } }
public static void init( String encoderPluginId ) throws KettleException { if ( Utils.isEmpty( encoderPluginId ) ) { throw new KettleException( "Unable to initialize the two way password encoder: No encoder plugin type specified." ); } PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.findPluginWithId( TwoWayPasswordEncoderPluginType.class, encoderPluginId ); if ( plugin == null ) { throw new KettleException( "Unable to find plugin with ID '" + encoderPluginId + "'" ); } encoder = (TwoWayPasswordEncoderInterface) registry.loadClass( plugin ); // Load encoder specific options... // encoder.init(); }
public void createPartitioner( String method ) throws KettlePluginException { methodType = getMethodType( method ); switch ( methodType ) { case PARTITIONING_METHOD_SPECIAL: { PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.findPluginWithId( PartitionerPluginType.class, method ); partitioner = (Partitioner) registry.loadClass( plugin ); partitioner.setId( plugin.getIds()[0] ); break; } case PARTITIONING_METHOD_NONE: default: partitioner = null; } if ( partitioner != null ) { partitioner.setMeta( this ); } }
PluginInterface jobPlugin = registry.findPluginWithId( JobEntryPluginType.class, typeId ); JobEntryInterface jobMetaInterface = null; boolean isMissing = jobPlugin == null;
String stype = XMLHandler.getTagValue( entrynode, "type" ); PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface jobPlugin = registry.findPluginWithId( JobEntryPluginType.class, stype, true ); if ( jobPlugin == null ) { String name = XMLHandler.getTagValue( entrynode, "name" );
jobPlugin = registry.findPluginWithId( JobEntryPluginType.class, JobMeta.STRING_SPECIAL );
@Override public void refresh( AbstractMeta meta, TreeNode treeNode, String filter ) { TransMeta transMeta = (TransMeta) meta; for ( int i = 0; i < transMeta.nrSteps(); i++ ) { StepMeta stepMeta = transMeta.getStep( i ); if ( stepMeta.isMissing() ) { continue; } PluginInterface stepPlugin = PluginRegistry.getInstance().findPluginWithId( StepPluginType.class, stepMeta.getStepID() ); if ( !filterMatch( stepMeta.getName(), filter ) ) { continue; } Image stepIcon = GUIResource.getInstance().getImagesStepsSmall().get( stepPlugin.getIds()[ 0 ] ); if ( stepIcon == null ) { stepIcon = GUIResource.getInstance().getImageFolder(); } TreeNode childTreeNode = createTreeNode( treeNode, stepMeta.getName(), stepIcon ); childTreeNode.setData( "StepId", stepMeta.getStepID() ); if ( stepMeta.isShared() ) { childTreeNode.setFont( GUIResource.getInstance().getFontBold() ); } if ( !stepMeta.isDrawn() ) { childTreeNode.setForeground( GUIResource.getInstance().getColorDarkGray() ); } } }
PluginInterface sp = registry.findPluginWithId( StepPluginType.class, stepMeta.getStepID() ); if ( sp == null ) { stepMeta.setStepMetaInterface( new MissingTrans( stepMeta.getName(), stepMeta.getStepID() ) );