public BasePluginType( Class<? extends java.lang.annotation.Annotation> pluginType ) { this.pluginFolders = new ArrayList<>(); this.log = new LogChannel( "Plugin type" ); registry = PluginRegistry.getInstance(); this.pluginType = pluginType; }
private Object loadPlugin( PluginInterface plugin ) { try { return PluginRegistry.getInstance().loadClass( plugin ); } catch ( KettlePluginException e ) { throw new RuntimeException( e ); } } }
protected RepositoryDialogInterface getRepositoryDialog( PluginInterface plugin, RepositoryMeta repositoryMeta, RepositoriesMeta input2, Shell shell ) throws Exception { String className = repositoryMeta.getDialogClassName(); Class<? extends RepositoryDialogInterface> dialogClass = PluginRegistry.getInstance().getClass( plugin, className ); Constructor<?> constructor = dialogClass.getConstructor( Shell.class, Integer.TYPE, RepositoryMeta.class, RepositoriesMeta.class ); return (RepositoryDialogInterface) constructor.newInstance( new Object[] { shell, Integer.valueOf( SWT.NONE ), repositoryMeta, input, } ); }
@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 registerPlugin( URLClassLoader classLoader, Class<? extends AuthenticationConsumerType> clazz ) throws KettlePluginException { AuthenticationConsumerPlugin pluginAnnotation = clazz.getAnnotation( AuthenticationConsumerPlugin.class ); AuthenticationConsumerPluginType.getInstance().handlePluginAnnotation( clazz, pluginAnnotation, new ArrayList<String>(), false, null ); PluginRegistry.getInstance().addClassLoader( classLoader, PluginRegistry.getInstance().getPlugin( AuthenticationConsumerPluginType.class, pluginAnnotation.id() ) ); }
/** * 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(); }
protected PluginInterface getPlugin() { if ( plugin == null ) { plugin = PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() ); } return plugin; }
public void helpJobEntry() { final JobEntryCopy jobEntry = (JobEntryCopy) selectionObject; String jobName = jobEntry.getName(); PluginInterface jobEntryPlugin = PluginRegistry.getInstance().findPluginWithName( JobEntryPluginType.class, jobName ); HelpUtils.openHelpDialog( shell, jobEntryPlugin ); }
public void helpStep() { final StepMeta stepMeta = (StepMeta) selectionObject; PluginInterface stepPlugin = PluginRegistry.getInstance().findPluginWithId( StepPluginType.class, stepMeta.getStepID() ); HelpUtils.openHelpDialog( shell, stepPlugin ); }
private StepMetaInterface getNewMeta() throws KettleException { PluginRegistry pluginRegistry = PluginRegistry.getInstance(); String id = pluginRegistry.getPluginId( StepPluginType.class, this ); PluginInterface plugin = pluginRegistry.getPlugin( StepPluginType.class, id ); return (StepMetaInterface) pluginRegistry.loadClass( plugin ); } }
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; }
public DatabaseFactoryInterface getDatabaseFactory() throws Exception { PluginRegistry registry = PluginRegistry.getInstance(); PluginInterface plugin = registry.getPlugin( DatabasePluginType.class, databaseInterface.getPluginId() ); if ( plugin == null ) { throw new KettleDatabaseException( "database type with plugin id [" + databaseInterface.getPluginId() + "] couldn't be found!" ); } ClassLoader loader = registry.getClassLoader( plugin ); Class<?> clazz = Class.forName( databaseInterface.getDatabaseFactoryName(), true, loader ); return (DatabaseFactoryInterface) clazz.newInstance(); }
@After public void tearDown() { PluginRegistry registry = PluginRegistry.getInstance(); for ( Map.Entry<Class<? extends PluginTypeInterface>, List<PluginInterface>> entry : plugins.entrySet() ) { Class<? extends PluginTypeInterface> type = entry.getKey(); for ( PluginInterface plugin : entry.getValue() ) { registry.removePlugin( type, plugin ); } } }
public static void reset() { if ( KettleLogStore.isInitialized() ) { KettleLogStore.getInstance().reset(); } PluginRegistry.getInstance().reset(); initialized = null; } }
@AfterClass public static void tearDownAfterClass() throws Exception { if ( p1 != null ) { PluginRegistry.getInstance().removePlugin( ValueMetaPluginType.class, p1 ); } if ( p2 != null ) { PluginRegistry.getInstance().removePlugin( ValueMetaPluginType.class, p2 ); } }
public void setEntry( JobEntryInterface je ) { entry = je; if ( entry != null ) { if ( entry.getPluginId() == null ) { entry.setPluginId( PluginRegistry.getInstance().getPluginId( JobEntryPluginType.class, entry ) ); } setDeprecationAndSuggestedJobEntry(); } }
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 ) ); } } }
private void setShellImage( Shell shell ) { PluginInterface plugin = PluginRegistry.getInstance().getPlugin( PartitionerPluginType.class, partitioner.getId() ); if ( !Utils.isEmpty( plugin.getDocumentationUrl() ) ) { createHelpButton( shell, stepMeta, plugin ); } shell.setImage( GUIResource.getInstance().getImageSpoon() ); } }
public Repository establishRepositoryConnection( RepositoryMeta repositoryMeta, final String username, final String password, final RepositoryOperation... operations ) throws KettleException, KettleSecurityException { Repository rep = PluginRegistry.getInstance().loadClass( RepositoryPluginType.class, repositoryMeta, Repository.class ); rep.init( repositoryMeta ); rep.getLog().setLogLevel( getLog().getLogLevel() ); rep.connect( username != null ? username : null, password != null ? password : null ); if ( operations != null ) { // throws KettleSecurityException if username does does have permission for given operations rep.getSecurityProvider().validateAction( operations ); } return rep; }