(Client client, CommandLine commands,
LinkedList<String> arguments, PrintStream out)
| 621 | } |
| 622 | |
| 623 | public int doPush(Client client, CommandLine commands, |
| 624 | LinkedList<String> arguments, PrintStream out) { |
| 625 | |
| 626 | // if a second argument was specified |
| 627 | if (arguments.size() < 2) { |
| 628 | printPushUsage(); |
| 629 | return 127; // "command not found" |
| 630 | } |
| 631 | URL url; |
| 632 | String host = arguments.removeFirst().toString(); |
| 633 | Client destinationClient; |
| 634 | try { |
| 635 | url = new URL(host); |
| 636 | // this argument is a server url |
| 637 | destinationClient = new Client(url); |
| 638 | System.err.println("Using service: " + host); |
| 639 | } catch (MalformedURLException e) { |
| 640 | printPushUsage(); |
| 641 | return 127; // "command not found" |
| 642 | } |
| 643 | |
| 644 | for (String id : arguments) { |
| 645 | System.out.println(destinationClient.push(client.pull(id), url)); |
| 646 | // Feed feed = client.pull(id); |
| 647 | // if ( feed != null ) { |
| 648 | // feed = client.push(feed, url); |
| 649 | // if ( feed != null ) { |
| 650 | // out.println(feed); |
| 651 | // } else { |
| 652 | // System.err.println("Failed to push feed for id: " + id); |
| 653 | // } |
| 654 | // } else { |
| 655 | // System.err.println("Failed to pull feed for id: " + id); |
| 656 | // } |
| 657 | } |
| 658 | return 0; // "OK" |
| 659 | } |
| 660 | |
| 661 | public int doServe(CommandLine commands, LinkedList<String> arguments) { |
| 662 |
no test coverage detected