public URL loadGroovySource(final String name) throws MalformedURLException { return loader.loadResource(name); } }
public Object call(final Object[] args) { try { return target.call(args); } catch (Exception e) { return throwRuntimeException(e); } } };
public Class create(final String className, final ClassLoader classLoader, ResourceLoader resourceLoader) throws Exception { assert className != null; assert classLoader != null; // resourceLoader can be null if (resourceLoader == null) { resourceLoader = new ResourceLoaderImpl(classLoader); } URL source = resourceLoader.loadResource(className); if (source == null) { throw new ComponentException("Missing source for: " + className); } return create(new ClassSource(source), classLoader, resourceLoader); }
protected void process(final Component component) throws Exception { assert component != null; ScriptExecutor executor = (ScriptExecutor)component; if (source.configuration.getChildCount() != 0) { throw new MojoExecutionException("Invalid value for 'source' parameter; contains nested elements"); } ClassSource classSource = ClassSource.forValue(escapeAsNeeded(source.configuration.getValue())); log.debug("Class source: {}", classSource); ClassRealm realm = realmManager.createComponentRealm(provider(), createClassPath()); ResourceLoader resourceLoader = new MojoResourceLoader(realm, classSource); Configuration context = createContext(); log.debug("Executing '''{}''' w/context: {}", source, context); Object result = executor.execute(classSource, realm, resourceLoader, context); log.debug("Result: {}", result); realmManager.releaseComponentRealm(realm); }
public Class create(final String className, final ClassLoader classLoader, ResourceLoader resourceLoader) throws Exception { assert className != null; assert classLoader != null; // resourceLoader can be null if (resourceLoader == null) { resourceLoader = new ResourceLoaderImpl(classLoader); } URL source = resourceLoader.loadResource(className); if (source == null) { throw new ComponentException("Missing source for: " + className); } return create(new ClassSource(source), classLoader, resourceLoader); }
public URL loadGroovySource(final String name) throws MalformedURLException { return loader.loadResource(name); } }
public Object call(final Object[] args) { try { return target.call(args); } catch (Exception e) { return throwRuntimeException(e); } } };
public Class create(final String className, final ClassLoader classLoader, ResourceLoader resourceLoader) throws Exception { assert className != null; assert classLoader != null; // resourceLoader can be null if (resourceLoader == null) { resourceLoader = new ResourceLoaderImpl(classLoader); } URL source = resourceLoader.loadResource(className); if (source == null) { throw new ComponentException("Missing source for: " + className); } return create(new ClassSource(source), classLoader, resourceLoader); }
public URL loadGroovySource(final String name) throws MalformedURLException { return loader.loadResource(name); } }
public Object call(final Object[] args) { try { return target.call(args); } catch (Exception e) { return throwRuntimeException(e); } } };
public Class create(final String className, final ClassLoader classLoader, ResourceLoader resourceLoader) throws Exception { assert className != null; assert classLoader != null; // resourceLoader can be null if (resourceLoader == null) { resourceLoader = new ResourceLoaderImpl(classLoader); } URL source = resourceLoader.loadResource(className); if (source == null) { throw new ComponentException("Missing source for: " + className); } return create(new ClassSource(source), classLoader, resourceLoader); }
public URL loadGroovySource(final String name) throws MalformedURLException { return loader.loadResource(name); } }
public Object call(final Object[] args) { try { return target.call(args); } catch (Exception e) { return throwRuntimeException(e); } } };