Changeset e2a39a3


Ignore:
Timestamp:
Mar 17, 2012 9:49:11 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
02bde80
Parents:
3a2fe5e
Message:
  • I2PTunnel: Make CLI-only methods private, and static where possible
File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java

    r3a2fe5e re2a39a3  
    303303     * @param l logger to receive events and output
    304304     */
    305     public void runHelp(Logging l) {
     305    private static void runHelp(Logging l) {
    306306        l.log("Command list:");
    307307        l.log("config <i2phost> <i2pport>");
     
    11081108    /**
    11091109     * Specify the i2cp host and port
     1110     * Deprecated - only used by CLI
    11101111     *
    11111112     * Sets the event "configResult" = "ok" or "error" after the configuration has been specified
     
    11141115     * @param l logger to receive events and output
    11151116     */
    1116     public void runConfig(String args[], Logging l) {
     1117    private void runConfig(String args[], Logging l) {
    11171118        if (args.length == 2) {
    11181119            host = args[0];
     
    11291130    /**
    11301131     * Specify whether to use its own destination for each outgoing tunnel
     1132     * Deprecated - only used by CLI
    11311133     *
    11321134     * Sets the event "owndestResult" = "ok" or "error" after the configuration has been specified
     
    11351137     * @param l logger to receive events and output
    11361138     */
    1137     public void runOwnDest(String args[], Logging l) {
     1139    private void runOwnDest(String args[], Logging l) {
    11381140        if (args.length == 1 && (args[0].equalsIgnoreCase("yes") || args[0].equalsIgnoreCase("no"))) {
    11391141            ownDest = args[0].equalsIgnoreCase("yes");
     
    11911193    /**
    11921194     * Generate a new keypair
     1195     * Deprecated - only used by CLI
    11931196     *
    11941197     * Sets the event "genkeysResult" = "ok" or "error" after the generation is complete
     
    11971200     * @param l logger to receive events and output
    11981201     */
    1199     public void runGenKeys(String args[], Logging l) {
     1202    private static void runGenKeys(String args[], Logging l) {
    12001203        OutputStream pubdest = null;
    12011204        if (args.length == 2) {
     
    12041207            } catch (IOException ioe) {
    12051208                l.log("Error opening output stream");
    1206                 _log.error(getPrefix() + "Error generating keys to out", ioe);
    1207                 notifyEvent("genkeysResult", "error");
     1209                //_log.error(getPrefix() + "Error generating keys to out", ioe);
     1210                //notifyEvent("genkeysResult", "error");
    12081211                return;
    12091212            }
     
    12131216                  + "   if pubkeyfile is given, saves the public key there." + "\n"
    12141217                  + "   if the privkeyfile already exists, just print/save" + "the pubkey.");
    1215             notifyEvent("genkeysResult", "error");
     1218            //notifyEvent("genkeysResult", "error");
    12161219        }
    12171220        try {
     
    12231226                makeKey(new FileOutputStream(privKeyFile), pubdest, l);
    12241227            }
    1225             notifyEvent("genkeysResult", "ok");
     1228            //notifyEvent("genkeysResult", "ok");
    12261229        } catch (IOException ioe) {
    12271230            l.log("Error generating keys - " + ioe.getMessage());
    1228             notifyEvent("genkeysResult", "error");
    1229             _log.error(getPrefix() + "Error generating keys", ioe);
     1231            //notifyEvent("genkeysResult", "error");
     1232            //_log.error(getPrefix() + "Error generating keys", ioe);
    12301233        }
    12311234    }
     
    12331236    /**
    12341237     * Generate a new keypair
     1238     * Deprecated - only used by CLI
    12351239     *
    12361240     * Sets the event "privateKey" = base64 of the privateKey stream and
     
    12391243     * @param l logger to receive events and output
    12401244     */
    1241     public void runGenTextKeys(Logging l) {
     1245    private static void runGenTextKeys(Logging l) {
    12421246        ByteArrayOutputStream privkey = new ByteArrayOutputStream(512);
    12431247        ByteArrayOutputStream pubkey = new ByteArrayOutputStream(512);
    12441248        makeKey(privkey, pubkey, l);
    12451249        l.log("Private key: " + Base64.encode(privkey.toByteArray()));
    1246         notifyEvent("privateKey", Base64.encode(privkey.toByteArray()));
    1247         notifyEvent("publicDestination", Base64.encode(pubkey.toByteArray()));
     1250        //notifyEvent("privateKey", Base64.encode(privkey.toByteArray()));
     1251        //notifyEvent("publicDestination", Base64.encode(pubkey.toByteArray()));
    12481252    }
    12491253
     
    12511255     * Exit the JVM if there are no more tasks left running.  If there are tunnels
    12521256     * running, it returns.
     1257     * Deprecated - only used by CLI
    12531258     *
    12541259     * Sets the event "quitResult" = "error" if there are tasks running (but if there
     
    12571262     * @param l logger to receive events and output
    12581263     */
    1259     public void runQuit(Logging l) {
     1264    private void runQuit(Logging l) {
    12601265        purgetasks(l);
    12611266        if (tasks.isEmpty()) {
     
    12631268        }
    12641269        l.log("There are running tasks. Try 'list'.");
    1265         notifyEvent("quitResult", "error");
     1270        //notifyEvent("quitResult", "error");
    12661271    }
    12671272
    12681273    /**
    12691274     * Retrieve a list of currently running tasks
     1275     * Deprecated - only used by CLI
    12701276     *
    12711277     * Sets the event "listDone" = "done" after dumping the tasks to
     
    12741280     * @param l logger to receive events and output
    12751281     */
    1276     public void runList(Logging l) {
     1282    private void runList(Logging l) {
    12771283        purgetasks(l);
    12781284        for (I2PTunnelTask t : tasks) {
     
    13321338    /**
    13331339     * Run all of the commands in the given file (one command per line)
     1340     * Deprecated - only used by CLI
    13341341     *
    13351342     * Sets the event "runResult" = "ok" or "error" after the closing is complete
     
    13381345     * @param l logger to receive events and output
    13391346     */
    1340     public void runRun(String args[], Logging l) {
     1347    private void runRun(String args[], Logging l) {
    13411348        if (args.length == 1) {
    13421349            try {
     
    13631370    /**
    13641371     * Perform a lookup of the name specified
     1372     * Deprecated - only used by CLI
    13651373     *
    13661374     * Sets the event "lookupResult" = base64 of the destination, or an error message
     
    13691377     * @param l logger to receive events and output
    13701378     */
    1371     public void runLookup(String args[], Logging l) {
     1379    private void runLookup(String args[], Logging l) {
    13721380        if (args.length != 1) {
    13731381            l.log("lookup <name>");
     
    13931401    /**
    13941402     * Start up a ping task with the specified args (currently supporting -ns, -h, -l)
     1403     * Deprecated - only used by CLI
    13951404     *
    13961405     * Sets the event "pingTaskId" = Integer of the taskId, or -1
     
    13991408     * @param l logger to receive events and output
    14001409     */
    1401     public void runPing(String allargs, Logging l) {
     1410    private void runPing(String allargs, Logging l) {
    14021411        if (allargs.length() != 0) {
    14031412            I2PTunnelTask task;
     
    14941503     * @param l logger to send messages to
    14951504     */
    1496     public static void makeKey(OutputStream writeTo, OutputStream pubDest, Logging l) {
     1505    private static void makeKey(OutputStream writeTo, OutputStream pubDest, Logging l) {
    14971506        try {
    14981507            l.log("Generating new keys...");
     
    15191528     * @param l logger to send messages to
    15201529     */
    1521     public static void showKey(InputStream readFrom, OutputStream pubDest, Logging l) {
     1530    private static void showKey(InputStream readFrom, OutputStream pubDest, Logging l) {
    15221531        try {
    15231532            Destination d = new Destination();
Note: See TracChangeset for help on using the changeset viewer.