/** * Retrieve the current last-modified timestamp of the underlying resource. * @return the current timestamp, or 0 if not determinable */ protected long retrieveLastModifiedTime() { try { return getResource().lastModified(); } catch (IOException ex) { if (logger.isDebugEnabled()) { logger.debug(getResource() + " could not be resolved in the file system - " + "current timestamp not available for script modification check", ex); } return 0; } }
@Override @Nullable public String suggestedClassName() { String filename = getResource().getFilename(); return (filename != null ? StringUtils.stripFilenameExtension(filename) : null); }
@Override @Nullable public String suggestedClassName() { String filename = getResource().getFilename(); return (filename != null ? StringUtils.stripFilenameExtension(filename) : null); }
/** * Retrieve the current last-modified timestamp of the underlying resource. * @return the current timestamp, or 0 if not determinable */ protected long retrieveLastModifiedTime() { try { return getResource().lastModified(); } catch (IOException ex) { if (logger.isDebugEnabled()) { logger.debug(getResource() + " could not be resolved in the file system - " + "current timestamp not available for script modification check", ex); } return 0; } }
@Nullable protected ScriptEngine retrieveScriptEngine(ScriptSource scriptSource) { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(this.beanClassLoader); if (this.scriptEngineName != null) { return StandardScriptUtils.retrieveEngineByName(scriptEngineManager, this.scriptEngineName); } if (scriptSource instanceof ResourceScriptSource) { String filename = ((ResourceScriptSource) scriptSource).getResource().getFilename(); if (filename != null) { String extension = StringUtils.getFilenameExtension(filename); if (extension != null) { ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (engine != null) { return engine; } } } } return null; }
Resource resource = ((ResourceScriptSource) script).getResource(); String extension = StringUtils.getFilenameExtension(resource.getFilename()); if (extension == null) {
@Override @Nullable public Object evaluate(ScriptSource script, @Nullable Map<String, Object> arguments) { GroovyShell groovyShell = new GroovyShell( this.classLoader, new Binding(arguments), this.compilerConfiguration); try { String filename = (script instanceof ResourceScriptSource ? ((ResourceScriptSource) script).getResource().getFilename() : null); if (filename != null) { return groovyShell.evaluate(script.getScriptAsString(), filename); } else { return groovyShell.evaluate(script.getScriptAsString()); } } catch (IOException ex) { throw new ScriptCompilationException(script, "Cannot access Groovy script", ex); } catch (GroovyRuntimeException ex) { throw new ScriptCompilationException(script, ex); } }
@Nullable protected ScriptEngine retrieveScriptEngine(ScriptSource scriptSource) { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(this.beanClassLoader); if (this.scriptEngineName != null) { return StandardScriptUtils.retrieveEngineByName(scriptEngineManager, this.scriptEngineName); } if (scriptSource instanceof ResourceScriptSource) { String filename = ((ResourceScriptSource) scriptSource).getResource().getFilename(); if (filename != null) { String extension = StringUtils.getFilenameExtension(filename); if (extension != null) { ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (engine != null) { return engine; } } } } return null; }
Resource resource = ((ResourceScriptSource) script).getResource(); String extension = StringUtils.getFilenameExtension(resource.getFilename()); if (extension == null) {
@Override @Nullable public Object evaluate(ScriptSource script, @Nullable Map<String, Object> arguments) { GroovyShell groovyShell = new GroovyShell( this.classLoader, new Binding(arguments), this.compilerConfiguration); try { String filename = (script instanceof ResourceScriptSource ? ((ResourceScriptSource) script).getResource().getFilename() : null); if (filename != null) { return groovyShell.evaluate(script.getScriptAsString(), filename); } else { return groovyShell.evaluate(script.getScriptAsString()); } } catch (IOException ex) { throw new ScriptCompilationException(script, "Cannot access Groovy script", ex); } catch (GroovyRuntimeException ex) { throw new ScriptCompilationException(script, ex); } }
public String suggestedClassName() { return this.source.getResource().getFilename(); }
public String suggestedClassName() { return this.source.getResource().getFilename(); }
/** * Retrieve the current last-modified timestamp of the underlying resource. * @return the current timestamp, or 0 if not determinable */ protected long retrieveLastModifiedTime() { try { return getResource().lastModified(); } catch (IOException ex) { if (logger.isDebugEnabled()) { logger.debug(getResource() + " could not be resolved in the file system - " + "current timestamp not available for script modification check", ex); } return 0; } }
@Override @Nullable public String suggestedClassName() { String filename = getResource().getFilename(); return (filename != null ? StringUtils.stripFilenameExtension(filename) : null); }
Resource resource = ((ResourceScriptSource) script).getResource(); String extension = StringUtils.getFilenameExtension(resource.getFilename()); if (extension == null) {
@Nullable protected ScriptEngine retrieveScriptEngine(ScriptSource scriptSource) { ScriptEngineManager scriptEngineManager = new ScriptEngineManager(this.beanClassLoader); if (this.scriptEngineName != null) { return StandardScriptUtils.retrieveEngineByName(scriptEngineManager, this.scriptEngineName); } if (scriptSource instanceof ResourceScriptSource) { String filename = ((ResourceScriptSource) scriptSource).getResource().getFilename(); if (filename != null) { String extension = StringUtils.getFilenameExtension(filename); if (extension != null) { ScriptEngine engine = scriptEngineManager.getEngineByExtension(extension); if (engine != null) { return engine; } } } } return null; }
@Override @Nullable public Object evaluate(ScriptSource script, @Nullable Map<String, Object> arguments) { GroovyShell groovyShell = new GroovyShell( this.classLoader, new Binding(arguments), this.compilerConfiguration); try { String filename = (script instanceof ResourceScriptSource ? ((ResourceScriptSource) script).getResource().getFilename() : null); if (filename != null) { return groovyShell.evaluate(script.getScriptAsString(), filename); } else { return groovyShell.evaluate(script.getScriptAsString()); } } catch (IOException ex) { throw new ScriptCompilationException(script, "Cannot access Groovy script", ex); } catch (GroovyRuntimeException ex) { throw new ScriptCompilationException(script, ex); } }