Added desktopgui documentation.
This commit is contained in:
@ -26,7 +26,6 @@ import net.i2p.router.Router;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the tray icon life.
|
* Manages the tray icon life.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class TrayManager {
|
public class TrayManager {
|
||||||
|
|
||||||
@ -115,6 +114,9 @@ public class TrayManager {
|
|||||||
@Override
|
@Override
|
||||||
protected void done() {
|
protected void done() {
|
||||||
trayIcon.displayMessage("Starting", "I2P is starting!", TrayIcon.MessageType.INFO);
|
trayIcon.displayMessage("Starting", "I2P is starting!", TrayIcon.MessageType.INFO);
|
||||||
|
//Hide the tray icon.
|
||||||
|
//We cannot stop the desktopgui program entirely,
|
||||||
|
//since that risks killing the I2P process as well.
|
||||||
tray.remove(trayIcon);
|
tray.remove(trayIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,14 @@ public class RouterManager {
|
|||||||
return RouterContext.listContexts().get(0).router();
|
return RouterContext.listContexts().get(0).router();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start an I2P router instance.
|
||||||
|
* This method has limited knowledge
|
||||||
|
* (there is no I2P instance running to collect information from).
|
||||||
|
*
|
||||||
|
* It needs to determine itself where the I2P instance is located,
|
||||||
|
* except if the location has been given through command-line arguments.
|
||||||
|
*/
|
||||||
public static void start() {
|
public static void start() {
|
||||||
try {
|
try {
|
||||||
String location = ConfigurationManager.getInstance().getStringConfiguration("I2PLocation", "/home/i2p");
|
String location = ConfigurationManager.getInstance().getStringConfiguration("I2PLocation", "/home/i2p");
|
||||||
@ -24,10 +32,16 @@ public class RouterManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restart the running I2P instance.
|
||||||
|
*/
|
||||||
public static void restart() {
|
public static void restart() {
|
||||||
getRouter().restart();
|
getRouter().restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop the running I2P instance.
|
||||||
|
*/
|
||||||
public static void shutDown() {
|
public static void shutDown() {
|
||||||
getRouter().shutdownGracefully();
|
getRouter().shutdownGracefully();
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@ import java.util.regex.Pattern;
|
|||||||
public class ConfigurationManager {
|
public class ConfigurationManager {
|
||||||
|
|
||||||
private static ConfigurationManager instance;
|
private static ConfigurationManager instance;
|
||||||
|
///Configurations with a String as value
|
||||||
private Map<String, String> stringConfigurations = new HashMap<String, String>();
|
private Map<String, String> stringConfigurations = new HashMap<String, String>();
|
||||||
|
///Configurations with a Boolean as value
|
||||||
private Map<String, Boolean> booleanConfigurations = new HashMap<String, Boolean>();
|
private Map<String, Boolean> booleanConfigurations = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
private ConfigurationManager() {}
|
private ConfigurationManager() {}
|
||||||
@ -24,13 +26,12 @@ public class ConfigurationManager {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collects arguments of the form --word, --word=otherword and -blah
|
||||||
|
* to determine user parameters.
|
||||||
|
* @param args Command line arguments to the application
|
||||||
|
*/
|
||||||
public void loadArguments(String[] args) {
|
public void loadArguments(String[] args) {
|
||||||
//Match pattern of the form --word=true or --word=false
|
|
||||||
Pattern booleanConfiguration = Pattern.compile("--(\\w)");
|
|
||||||
//Match pattern of the form --word=word
|
|
||||||
Pattern stringConfiguration = Pattern.compile("--(\\w)=(\\w)");
|
|
||||||
//Match pattern of the form --word
|
|
||||||
Pattern existsConfiguration = Pattern.compile("--(\\w)");
|
|
||||||
for(int i=0; i<args.length; i++) {
|
for(int i=0; i<args.length; i++) {
|
||||||
String arg = args[i];
|
String arg = args[i];
|
||||||
if(arg.startsWith("--")) {
|
if(arg.startsWith("--")) {
|
||||||
|
Reference in New Issue
Block a user