@Override protected synchronized Class<?> loadClass( String arg0, boolean arg1 ) throws ClassNotFoundException { for ( Pattern pattern : patterns ) { if ( pattern.matcher( arg0 ).matches() ) { return loadClassParentFirst( arg0, arg1 ); } } return super.loadClass( arg0, arg1 ); } }
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException { try { Thread t = Thread.currentThread(); ClassLoader cl = t.getContextClassLoader(); URL u = new URL( "jar:file:" + strJar + "!/" ); // We never know what else the script wants to load with the class loader, so lets not close it just like that. @SuppressWarnings( "resource" ) KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl ); Class<?> toRun = kl.loadClass( strClassName ); return toRun; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ScriptMeta.Exception.UnableToLoadAdditionalClass" ), e ); } }
private static Class<?> LoadAdditionalClass( String strJar, String strClassName ) throws KettleException { try { Thread t = Thread.currentThread(); ClassLoader cl = t.getContextClassLoader(); URL u = new URL( "jar:file:" + strJar + "!/" ); // We never know what else the script wants to load with the class loader, so lets not close it just like that. @SuppressWarnings( "resource" ) KettleURLClassLoader kl = new KettleURLClassLoader( new URL[] { u }, cl ); Class<?> toRun = kl.loadClass( strClassName ); return toRun; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ScriptValuesMetaMod.Exception.UnableToLoadAdditionalClass" ), e ); } }