public CommandInvoker<Void, Object> create(ShellSession session) throws CommandNotFoundException, CommandException { LinkedList<CommandInvoker> pipes = new LinkedList<CommandInvoker>(); for (PipeLineFactory current = this;current != null;current = current.next) { Command<?> command = session.getCommand(current.name); if (command == null) { throw new CommandNotFoundException(current.name); } CommandInvoker commandInvoker = command.resolveInvoker(current.rest); if (commandInvoker == null) { throw new CommandNotFoundException(current.name); } pipes.add(commandInvoker); } return new PipeLine(pipes.toArray(new CommandInvoker[pipes.size()])); }
public CommandInvoker<?, ?> resolve(String s) throws CommandException { CRaSHSession session = (CRaSHSession)getSession(); Token token2 = Token.parse(s); try { PipeLineFactory factory = token2.createFactory(); return factory.create(session); } catch (CommandNotFoundException e) { throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e); } }
public ReplResponse eval(ShellSession session, String request) { PipeLineFactory factory; try { factory = Token.parse(request).createFactory(); } catch (CommandException e) { return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause())); } if (factory != null) { try { CommandInvoker<Void, Object> invoker = factory.create(session); return new ReplResponse.Invoke(invoker); } catch (CommandNotFoundException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName())); } catch (CommandException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e)); } } else { return new ReplResponse.Response(ShellResponse.noCommand()); } }
public ReplResponse eval(ShellSession session, String request) { PipeLineFactory factory; try { factory = Token.parse(request).createFactory(); } catch (CommandException e) { return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause())); } if (factory != null) { try { CommandInvoker<Void, Object> invoker = factory.create(session); return new ReplResponse.Invoke(invoker); } catch (CommandNotFoundException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName())); } catch (CommandException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e)); } } else { return new ReplResponse.Response(ShellResponse.noCommand()); } }
public CommandInvoker<?, ?> resolve(String s) throws CommandException { CRaSHSession session = (CRaSHSession)getSession(); Token token2 = Token.parse(s); try { PipeLineFactory factory = token2.createFactory(); return factory.create(session); } catch (CommandNotFoundException e) { throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e); } }
public CommandInvoker<Void, Object> create(ShellSession session) throws CommandNotFoundException, CommandException { LinkedList<CommandInvoker> pipes = new LinkedList<CommandInvoker>(); for (PipeLineFactory current = this;current != null;current = current.next) { Command<?> command = session.getCommand(current.name); if (command == null) { throw new CommandNotFoundException(current.name); } CommandInvoker commandInvoker = command.resolveInvoker(current.rest); if (commandInvoker == null) { throw new CommandNotFoundException(current.name); } pipes.add(commandInvoker); } return new PipeLine(pipes.toArray(new CommandInvoker[pipes.size()])); }
public ReplResponse eval(ShellSession session, String request) { PipeLineFactory factory; try { factory = Token.parse(request).createFactory(); } catch (CommandException e) { return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e.getCause())); } if (factory != null) { try { CommandInvoker<Void, Object> invoker = factory.create(session); return new ReplResponse.Invoke(invoker); } catch (CommandNotFoundException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.unknownCommand(e.getName())); } catch (CommandException e) { log.log(Level.FINER, "Could not create command", e); return new ReplResponse.Response(ShellResponse.error(e.getErrorKind(), e.getMessage(), e)); } } else { return new ReplResponse.Response(ShellResponse.noCommand()); } }
public CommandInvoker<?, ?> resolve(String s) throws CommandException { CRaSHSession session = (CRaSHSession)getSession(); Token token2 = Token.parse(s); try { PipeLineFactory factory = token2.createFactory(); return factory.create(session); } catch (CommandNotFoundException e) { throw new CommandException(ErrorKind.SYNTAX, e.getMessage(), e); } }
public CommandInvoker<Void, Object> create(ShellSession session) throws CommandNotFoundException, CommandException { LinkedList<CommandInvoker> pipes = new LinkedList<CommandInvoker>(); for (PipeLineFactory current = this;current != null;current = current.next) { Command<?> command = session.getCommand(current.name); if (command == null) { throw new CommandNotFoundException(current.name); } CommandInvoker commandInvoker = command.resolveInvoker(current.rest); if (commandInvoker == null) { throw new CommandNotFoundException(current.name); } pipes.add(commandInvoker); } return new PipeLine(pipes.toArray(new CommandInvoker[pipes.size()])); }