public void file(String fileName, int length, InputStream data) throws IOException { out.write("C0644 ".getBytes()); out.write(Integer.toString(length).getBytes()); out.write(" ".getBytes()); out.write(fileName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); IO.copy(data, out); ack(); readAck(); } public void endDirectory(String directoryName) throws IOException {
public void endDirectory(String directoryName) throws IOException { out.write("E\n".getBytes()); out.flush(); readAck(); } };
@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); } } }
public void endDirectory(String directoryName) throws IOException { out.write("E\n".getBytes()); out.flush(); readAck(); } };
@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); } } }
public void file(String fileName, int length, InputStream data) throws IOException { out.write("C0644 ".getBytes()); out.write(Integer.toString(length).getBytes()); out.write(" ".getBytes()); out.write(fileName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); Utils.copy(data, out); ack(); readAck(); } public void endDirectory(String directoryName) throws IOException {
public void endDirectory(String directoryName) throws IOException { out.write("E\n".getBytes()); out.flush(); readAck(); } };
@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); } } }
public void file(String fileName, int length, InputStream data) throws IOException { out.write("C0644 ".getBytes()); out.write(Integer.toString(length).getBytes()); out.write(" ".getBytes()); out.write(fileName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); Utils.copy(data, out); ack(); readAck(); } public void endDirectory(String directoryName) throws IOException {
public void beginDirectory(String directoryName) throws IOException { out.write("D0755 0 ".getBytes()); out.write(directoryName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); } public void file(String fileName, int length, InputStream data) throws IOException {
public void beginDirectory(String directoryName) throws IOException { out.write("D0755 0 ".getBytes()); out.write(directoryName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); } public void file(String fileName, int length, InputStream data) throws IOException {
public void beginDirectory(String directoryName) throws IOException { out.write("D0755 0 ".getBytes()); out.write(directoryName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); } public void file(String fileName, int length, InputStream data) throws IOException {