@Override public Command createCommand(String command) { // if (command.startsWith("scp ")) { try { command = command.substring(4); SCPAction action = new SCPAction(); CommandDescriptorImpl<SCPAction> descriptor = CommandFactory.DEFAULT.create(SCPAction.class); InvocationMatcher<SCPAction> analyzer = descriptor.invoker("main"); InvocationMatch<SCPAction> match = analyzer.match(command); match.invoke(Resolver.EMPTY, action); if (Boolean.TRUE.equals(action.isSource())) { return new SourceCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else if (Boolean.TRUE.equals(action.isSink())) { return new SinkCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else { return new FailCommand("Cannot execute command " + command); } } catch (CLIException e) { return new FailCommand("Cannot execute command " + command, e); } } else { return new FailCommand("Cannot execute command " + command); } } }
@Override public Command createCommand(String command) { // if (command.startsWith("scp ")) { try { command = command.substring(4); SCPAction action = new SCPAction(); CommandDescriptor<Instance<SCPAction>> descriptor = CommandFactory.DEFAULT.create(SCPAction.class); InvocationMatcher<Instance<SCPAction>> analyzer = descriptor.matcher(); InvocationMatch<Instance<SCPAction>> match = analyzer.parse(command); match.invoke(Util.wrap(action)); if (Boolean.TRUE.equals(action.isSource())) { return new SourceCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else if (Boolean.TRUE.equals(action.isSink())) { return new SinkCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else { return new FailCommand("Cannot execute command " + command); } } catch (CLIException e) { return new FailCommand("Cannot execute command " + command, e); } } else { return new FailCommand("Cannot execute command " + command); } } }
@Override public Command createCommand(String command) { // if (command.startsWith("scp ")) { try { command = command.substring(4); SCPAction action = new SCPAction(); CommandDescriptor<Instance<SCPAction>> descriptor = CommandFactory.DEFAULT.create(SCPAction.class); InvocationMatcher<Instance<SCPAction>> analyzer = descriptor.matcher(); InvocationMatch<Instance<SCPAction>> match = analyzer.parse(command); match.invoke(Util.wrap(action)); if (Boolean.TRUE.equals(action.isSource())) { return new SourceCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else if (Boolean.TRUE.equals(action.isSink())) { return new SinkCommand(action.getTarget(), Boolean.TRUE.equals(action.isRecursive())); } else { return new FailCommand("Cannot execute command " + command); } } catch (CLIException e) { return new FailCommand("Cannot execute command " + command, e); } } else { return new FailCommand("Cannot execute command " + command); } } }