@Override public Object getProperty(String property) { if ("context".equals(property)) { return context; } else { Object value = Helper.resolveProperty(new InvocationContextImpl(context), property); if (value != null) { return value; } else { value = InvokerHelper.getProperty(owner, property); } return value; } }
@Override public Object getVariable(String name) { if (name.equals("context")) { return proxy; } else { if (session != null) { try { Command<?> cmd = session.getCommand(name); if (cmd != null) { return new PipeLineClosure(new InvocationContextImpl<Object>(proxy), name, cmd); } } catch (CommandException ignore) { // Really ? } return super.getVariable(name); } else { return super.getVariable(name); } } } }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
@Override public Object invokeMethod(String name, Object args) { SafeCallable runnable = Helper.resolveMethodInvocation(new InvocationContextImpl(context), name, args); if (runnable != null) { return runnable.call(); } else { return InvokerHelper.invokeMethod(owner, name, args); } } }
public void open(CommandContext<? super Object> consumer) throws IOException, CommandException { context = new InvocationContextImpl<Object>((CommandContext<Object>)consumer);
public void open(CommandContext<? super Object> consumer) throws IOException, CommandException { this.consumer = (CommandContext<Object>)consumer; GroovyShell shell = GroovyCompiler.getGroovyShell(session); ShellBinding binding = (ShellBinding)shell.getContext(); binding.setCurrent(new InvocationContextImpl<Object>(this.consumer)); Object o; try { o = shell.evaluate(request); } finally { binding.setCurrent(null); } if (o != null) { try { consumer.provide(o); } catch (IOException e) { throw e; } catch (CommandException e) { throw e; } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "An error occured during the evalution of '" + request + "'", e); } } } public void close() throws IOException, CommandException {
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
@Override public Object getProperty(String property) { if ("context".equals(property)) { return context; } else { Object value = Helper.resolveProperty(new InvocationContextImpl(context), property); if (value != null) { return value; } else { value = InvokerHelper.getProperty(owner, property); } return value; } }
@Override public Object getProperty(String property) { if ("context".equals(property)) { return context; } else { Object value = Helper.resolveProperty(new InvocationContextImpl(context), property); if (value != null) { return value; } else { value = InvokerHelper.getProperty(owner, property); } return value; } }
@Override public Object getVariable(String name) { if (name.equals("context")) { return proxy; } else { if (session != null) { try { Command<?> cmd = session.getCommand(name); if (cmd != null) { return new PipeLineClosure(new InvocationContextImpl<Object>(proxy), name, cmd); } } catch (CommandException ignore) { // Really ? } return super.getVariable(name); } else { return super.getVariable(name); } } } }
@Override public Object getVariable(String name) { if (name.equals("context")) { return proxy; } else { if (session != null) { try { Command<?> cmd = session.getCommand(name); if (cmd != null) { return new PipeLineClosure(new InvocationContextImpl<Object>(proxy), name, cmd); } } catch (CommandException ignore) { // Really ? } return super.getVariable(name); } else { return super.getVariable(name); } } } }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
@Override public Object invokeMethod(String name, Object args) { SafeCallable runnable = Helper.resolveMethodInvocation(new InvocationContextImpl(context), name, args); if (runnable != null) { return runnable.call(); } else { return InvokerHelper.invokeMethod(owner, name, args); } } }
public void open2(final CommandContext<P> consumer) { invocationContext = new InvocationContextImpl<P>(consumer); command.pushContext(invocationContext); command.unmatched = invoker.getMatch().getRest(); }
@Override public Object invokeMethod(String name, Object args) { SafeCallable runnable = Helper.resolveMethodInvocation(new InvocationContextImpl(context), name, args); if (runnable != null) { return runnable.call(); } else { return InvokerHelper.invokeMethod(owner, name, args); } } }
public void open(CommandContext<? super Object> consumer) throws IOException, CommandException { context = new InvocationContextImpl<Object>((CommandContext<Object>)consumer);
public void open(CommandContext<? super Object> consumer) throws IOException, CommandException { this.consumer = (CommandContext<Object>)consumer; GroovyShell shell = GroovyCompiler.getGroovyShell(session); ShellBinding binding = (ShellBinding)shell.getContext(); binding.setCurrent(new InvocationContextImpl<Object>(this.consumer)); Object o; try { o = shell.evaluate(request); } finally { binding.setCurrent(null); } if (o != null) { try { consumer.provide(o); } catch (IOException e) { throw e; } catch (CommandException e) { throw e; } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "An error occured during the evalution of '" + request + "'", e); } } } public void close() throws IOException, CommandException {
public void open(CommandContext<? super Object> consumer) throws IOException, CommandException { this.consumer = (CommandContext<Object>)consumer; GroovyShell shell = GroovyCompiler.getGroovyShell(session); ShellBinding binding = (ShellBinding)shell.getContext(); binding.setCurrent(new InvocationContextImpl<Object>(this.consumer)); Object o; try { o = shell.evaluate(request); } finally { binding.setCurrent(null); } if (o != null) { try { consumer.provide(o); } catch (IOException e) { throw e; } catch (CommandException e) { throw e; } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "An error occured during the evalution of '" + request + "'", e); } } } public void close() throws IOException, CommandException {
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }
public void open2(final CommandContext<P> consumer) throws CommandException { // invocationContext = new InvocationContextImpl<P>(consumer); // Push context command.pushContext(invocationContext); // Set the unmatched part command.unmatched = invoker.getMatch().getRest(); // PC ret; try { ret = invoker.invoke(this); } catch (org.crsh.cli.impl.SyntaxException e) { throw new CommandException(ErrorKind.SYNTAX, "Syntax exception when executing command " + name, e); } catch (InvocationException e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e.getCause()); } // It's a pipe command if (ret != null) { real = ret; try { real.open(invocationContext); } catch (Exception e) { throw new CommandException(ErrorKind.EVALUATION, "Command " + name + " failed", e); } } }