private void addToClassLoader( PluginInterface plugin, KettleURLClassLoader ucl ) throws MalformedURLException, UnsupportedEncodingException { String[] patterns = parentClassloaderPatternMap.get( plugin ); if ( ucl instanceof KettleSelectiveParentFirstClassLoader ) { ( (KettleSelectiveParentFirstClassLoader) ucl ).addPatterns( patterns ); } for ( String jarFile : plugin.getLibraries() ) { File jarfile = new File( jarFile ); ucl.addURL( new URL( URLDecoder.decode( jarfile.toURI().toURL().toString(), "UTF-8" ) ) ); } }
private KettleURLClassLoader createClassLoader( PluginInterface plugin ) throws MalformedURLException, UnsupportedEncodingException { List<String> jarFiles = plugin.getLibraries(); URL[] urls = new URL[jarFiles.size()]; for ( int i = 0; i < jarFiles.size(); i++ ) { File jarfile = new File( jarFiles.get( i ) ); urls[i] = new URL( URLDecoder.decode( jarfile.toURI().toURL().toString(), "UTF-8" ) ); } ClassLoader classLoader = getClass().getClassLoader(); String[] patterns = parentClassloaderPatternMap.get( plugin ); if ( patterns != null ) { return new KettleSelectiveParentFirstClassLoader( urls, classLoader, plugin.getDescription(), patterns ); } else { return new KettleURLClassLoader( urls, classLoader, plugin.getDescription() ); } }
/** * @param fragment A plugin interface to merge with */ default void merge( PluginInterface fragment ) { if ( fragment != null ) { Optional.ofNullable( fragment.getClassMap() ).ifPresent( this.getClassMap()::putAll ); Optional.ofNullable( fragment.getImageFile() ).ifPresent( this::setImageFile ); Optional.ofNullable( fragment.getLibraries() ).ifPresent( this.getLibraries()::addAll ); Optional.ofNullable( fragment.getErrorHelpFile() ).ifPresent( this::setErrorHelpFile ); Optional.ofNullable( fragment.getDocumentationUrl() ).ifPresent( this::setDocumentationUrl ); Optional.ofNullable( fragment.getCasesUrl() ).ifPresent( this::setCasesUrl ); Optional.ofNullable( fragment.getForumUrl() ).ifPresent( this::setForumUrl ); Optional.ofNullable( fragment.getClassLoaderGroup() ).ifPresent( this::setClassLoaderGroup ); } } }
ucl = classLoaders.get( plugin ); if ( ucl == null ) { if ( plugin.getLibraries().size() == 0 ) { if ( plugin instanceof ClassLoadingPluginInterface ) { return ( (ClassLoadingPluginInterface) plugin ).getClassLoader();
/** * @param pluginType the type of plugin to get information for * @return a row buffer containing plugin information for the given plugin type * @throws KettlePluginException */ public RowBuffer getPluginInformation( Class<? extends PluginTypeInterface> pluginType ) throws KettlePluginException { RowBuffer rowBuffer = new RowBuffer( getPluginInformationRowMeta() ); for ( PluginInterface plugin : getPlugins( pluginType ) ) { Object[] row = new Object[getPluginInformationRowMeta().size()]; int rowIndex = 0; row[rowIndex++] = getPluginType( plugin.getPluginType() ).getName(); row[rowIndex++] = plugin.getIds()[0]; row[rowIndex++] = plugin.getName(); row[rowIndex++] = Const.NVL( plugin.getDescription(), "" ); row[rowIndex++] = Utils.isEmpty( plugin.getLibraries() ) ? "" : plugin.getLibraries().toString(); row[rowIndex++] = Const.NVL( plugin.getImageFile(), "" ); row[rowIndex++] = plugin.getClassMap().values().toString(); row[rowIndex] = Const.NVL( plugin.getCategory(), "" ); rowBuffer.getBuffer().add( row ); } return rowBuffer; }