public PipeLineFactory createFactory() throws CommandException { if (next != null) { PipeLineFactory nextFactory = next.createFactory(); if (nextFactory != null) { return new PipeLineFactory(value, nextFactory); } else { throw new CommandException(ErrorKind.SYNTAX, ""); } } else { return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null; } }
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 void testBlank() throws CommandException { assertNull(Token.parse("").createFactory()); assertNull(Token.parse(" ").createFactory()); }
private void assertSyntaxException(String s) { try { Token.parse(s).createFactory(); fail(); } catch (CommandException e) { assertEquals(ErrorKind.SYNTAX, e.getErrorKind()); } } }
public void testCommand() throws CommandException { PipeLineFactory e = Token.parse("a").createFactory(); assertEquals("a", e.getLine()); assertNull(e.getNext()); }
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 void testPipe() throws CommandException { PipeLineFactory e = Token.parse("a|b").createFactory(); assertEquals("a", e.getLine()); assertEquals("b", e.getNext().getLine()); assertNull(e.getNext().getNext()); }
public PipeLineFactory createFactory() throws CommandException { if (next != null) { PipeLineFactory nextFactory = next.createFactory(); if (nextFactory != null) { return new PipeLineFactory(value, nextFactory); } else { throw new CommandException(ErrorKind.SYNTAX, ""); } } else { return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null; } }
public PipeLineFactory createFactory() throws CommandException { if (next != null) { PipeLineFactory nextFactory = next.createFactory(); if (nextFactory != null) { return new PipeLineFactory(value, nextFactory); } else { throw new CommandException(ErrorKind.SYNTAX, ""); } } else { return Utils.notBlank(value) ? new PipeLineFactory(value, null) : null; } }
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<?, ?> 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()); } }