@Override public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public Object invokeMethod(String name, Object args) { try { if (delegate instanceof GroovyObject) { return ((GroovyObject) delegate).invokeMethod(name, args); } return metaClass.invokeMethod(delegate, name, args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public Object invokeMethod(String name, Object args) { try { return GroovyRuntimeUtil.invokeMethod($delegate, name, GroovyRuntimeUtil.asArgumentArray(args)); } catch (MissingMethodException e) { return super.invokeMethod(name, args); } } }
@Override public final Object invokeMethod(String name, Object args) { // try { return super.invokeMethod(name, args); } catch (MissingMethodException missing) { return Helper.invokeMethod(context, name, args, missing); } }
@Override public Object invokeMethod(String name, Object args) { try { return delegateMetaClass.invokeMethod(delegate, name, args); } catch (MissingMethodException e) { return super.invokeMethod(name,args); } } }
@Override public Object invokeMethod(String methodName, Object args) { try { return super.invokeMethod(methodName, args); } catch (MissingMethodException mme) { try { return nodeMetaClass.invokeMethod(node, methodName, args); } catch (MissingMethodException e) { throw e; } } }
@Override public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public final Object invokeMethod(String name, Object args) { // try { return super.invokeMethod(name, args); } catch (MissingMethodException missing) { return Helper.invokeMethod(context, name, args, missing); } }
@Override public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public final Object invokeMethod(String name, Object args) { // try { return super.invokeMethod(name, args); } catch (MissingMethodException missing) { return Helper.invokeMethod(context, name, args, missing); } }
public Object invokeMethod(String name, Object args) { try { return delegate.invokeMethod(name,args); } catch (MissingMethodException mme) { return super.invokeMethod(name, args); } }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if(request instanceof HttpServletRequest){ HttpServletRequest hr = (HttpServletRequest) request; HttpSession session = hr.getSession(false); if(session!=null){ Object userId = session.getAttribute("userId"); if(userId != null){ Groovity groovity = (Groovity) servletContext.getAttribute(GroovityServlet.SERVLET_CONTEXT_GROOVITY_INSTANCE); Script factory; try { factory = groovity.load("/data/factory", new Binding()); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new ServletException(e); } Object user = factory.invokeMethod("call", new String[]{"person",userId.toString()}); if(user!=null && user instanceof Principal){ request = new AuthenticatedRequestWrapper(hr, (Principal)user); } } } } chain.doFilter(request, response); }
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if(request instanceof HttpServletRequest){ HttpServletRequest hr = (HttpServletRequest) request; HttpSession session = hr.getSession(false); if(session!=null){ Object userId = session.getAttribute("userId"); if(userId != null){ Groovity groovity = (Groovity) servletContext.getAttribute(GroovityServlet.SERVLET_CONTEXT_GROOVITY_INSTANCE); Script factory; try { factory = groovity.load("/data/factory", new Binding()); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { throw new ServletException(e); } Object user = factory.invokeMethod("call", new String[]{"person",userId.toString()}); if(user!=null && user instanceof Principal){ request = new AuthenticatedRequestWrapper(hr, (Principal)user); } } } } chain.doFilter(request, response); }
/** * executes the Groovy script */ @Override 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} ); } }
@Override protected void filteredObject(ModelWalker walker, boolean matched, Object value, ModelVisitor consumer) throws Exception { if(matched) { if(value instanceof Pointer) { Pointer pointer = (Pointer) value; boolean known = (boolean) factory.invokeMethod("isKnownType", pointer.getType()); if(!known) { Referent cur = walker.getContextObject(Referent.class); if(cur != null) { Pointer parent = cur.getPointer(); //check for lifecycle suffix String t = parent.getType(); int u = t.indexOf("_"); if(u>0) { String nt = pointer.getType().concat(t.substring(u)); known = (boolean) factory.invokeMethod("isKnownType", nt); if(known) { pointer = new Pointer(nt,pointer.getId()); } } } } if(known) { value = factory.invokeMethod("call", pointer); } } } consumer.visitObject(value); } };
@Override public void execute(String task) throws BlazeException { Method method = findTaskMethod(task); try { script.invokeMethod(task, new Object[]{}); } catch (Exception e) { logFirstScriptSource(e); if (e instanceof BlazeException) { throw (BlazeException)e; } else if (e instanceof RuntimeException) { throw (RuntimeException)e; } else { throw new BlazeException("Unable to execute task '" + task + "'", e); } } }
public static Object runScriptAtLocation(String location, String methodName, Map<String, Object> context) throws GeneralException { Script script = InvokerHelper.createScript(getScriptClassFromLocation(location), getBinding(context)); Object result = null; if (UtilValidate.isEmpty(methodName)) { result = script.run(); } else { result = script.invokeMethod(methodName, new Object[] { context }); } return result; }
@Override public final Object invokeMethod(String name, Object args) { // try { return super.invokeMethod(name, args); } catch (MissingMethodException e) { if (context instanceof InvocationContext) { InvocationContext ic = (InvocationContext)context; CRaSH crash = (CRaSH)context.getSession().get("crash"); if (crash != null) { ShellCommand cmd; try { cmd = crash.getCommand(name); } catch (NoSuchCommandException ce) { throw new InvokerInvocationException(ce); } if (cmd != null) { ClassDispatcher dispatcher = new ClassDispatcher(cmd, this); return dispatcher.dispatch("", CommandClosure.unwrapArgs(args)); } } } // throw e; } }
resultObj = script.run(); } else { resultObj = script.invokeMethod(modelService.invoke, EMPTY_ARGS);