Package groovy.lang

Examples of groovy.lang.Script.invokeMethod()


            Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(gContext));
            Object resultObj = null;
            if (UtilValidate.isEmpty(modelService.invoke)) {
                resultObj = script.run();
            } else {
                resultObj = script.invokeMethod(modelService.invoke, EMPTY_ARGS);
            }
            if (resultObj != null && resultObj instanceof Map<?, ?>) {
                return cast(resultObj);
            } else if (gContext.get("result") != null && gContext.get("result") instanceof Map<?, ?>) {
                return cast(gContext.get("result"));
View Full Code Here


        Script script = InvokerHelper.createScript(getScriptClassFromLocation(location, groovyClassLoader), getBinding(context));
        Object result = null;
        if (UtilValidate.isEmpty(methodName)) {
            result = script.run();
        } else {
            result = script.invokeMethod(methodName, new Object[] { context });
        }
        return result;
    }

    public static Object runScriptFromClasspath(String script, Map<String,Object> context) throws GeneralException {
View Full Code Here

            Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context));
            Object resultObj = null;
            if (UtilValidate.isEmpty(modelService.invoke)) {
                resultObj = script.run();
            } else {
                resultObj = script.invokeMethod(modelService.invoke, EMPTY_ARGS);
            }
            if (resultObj != null && resultObj instanceof Map<?, ?>) {
                return cast(resultObj);
            } else if (context.get("result") != null && context.get("result") instanceof Map<?, ?>) {
                return cast(context.get("result"));
View Full Code Here

            Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)), GroovyUtil.getBinding(context));
            Object resultObj = null;
            if (UtilValidate.isEmpty(modelService.invoke)) {
                resultObj = script.run();
            } else {
                resultObj = script.invokeMethod(modelService.invoke, EMPTY_ARGS);
            }
            if (resultObj != null && resultObj instanceof Map<?, ?>) {
                return cast(resultObj);
            } else if (context.get("result") != null && context.get("result") instanceof Map<?, ?>) {
                return cast(context.get("result"));
View Full Code Here

    public void execute(DbStep step)
    {
        LOG.info("[GROOVY STEP]:" + step.getName() + " (" + step.getVersion() + ")");
        Reader scriptReader = step.getStepReader();
        Script s = shell.parse(scriptReader);
        s.invokeMethod(GROOVY_DBMAIN, new Object[] {dbConnection, variables} );
    }
}
View Full Code Here

    public void execute(DbStep step)
    {
        LOG.info("[GROOVY STEP]:" + step.getName() + " (" + step.getVersion() + ")");
        Reader scriptReader = step.getStepReader();
        Script s = shell.parse(scriptReader);
        s.invokeMethod(GROOVY_DBMAIN, new Object[] {dataSource, variables} );
    }
}
View Full Code Here

    private void executeGroovyScript(DbScript groovyScript)
    {
        LOG.info("[GROOVY SCRIPT]:" + groovyScript.getName() + " (" + groovyScript.getVersion() + ")");
        Reader scriptReader = groovyScript.getScriptReader();
        Script s = shell.parse(scriptReader);
        s.invokeMethod(GROOVY_DBMAIN, new Object[] {dbConnection, variables} );
    }


    /**
     * if versionUpdateSql is defined, it's executed after each script
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.