public class ClientAppConfig extends Object
clients.config format:
Lines are of the form clientApp.x.prop=val, where x is the app number.
App numbers MUST start with 0 and be consecutive.
Properties are as follows:
main: Full class name. Required. The main() method in this
class will be run.
name: Name to be displayed on console.
args: Arguments to the main class, separated by spaces or tabs.
Arguments containing spaces or tabs may be quoted with ' or "
delay: Seconds before starting, default 120
onBoot: {true|false}, default false, forces a delay of 0,
overrides delay setting
startOnLoad: {true|false} Is the client to be run at all?
Default true
The following additional properties are used only by plugins:
stopargs: Arguments to stop the client.
uninstallargs: Arguments to stop the client.
classpath: Additional classpath elements for the client,
separated by commas.
The following substitutions are made in the args, stopargs,
uninstallargs, and classpath lines, for plugins only:
$I2P: The base I2P install directory
$CONFIG: The user's configuration directory (e.g. ~/.i2p)
$PLUGIN: This plugin's directory (e.g. ~/.i2p/plugins/foo)
All properties except "main" are optional.
Lines starting with "#" are comments.
If the delay is less than zero, the client is run immediately,
in the same thread, so that exceptions may be propagated to the console.
In this case, the client should either throw an exception, return quickly,
or spawn its own thread.
If the delay is greater than or equal to zero, it will be run
in a new thread, and exceptions will be logged but not propagated
to the console.
| Modifier and Type | Field and Description |
|---|---|
String | argsThe arguments. |
String | classNameThe main class name. |
String | classpathThe classpath. |
String | clientNameThe display name. |
(package private) File | configFileThe config file. |
long | delayThe startup delay. |
boolean | disabledWhether disabled. |
String | stopargsThe stop arguments. |
String | uninstallargsThe uninstall arguments. |
| Constructor and Description |
|---|
ClientAppConfig(String cl,
String client,
String a,
long d,
boolean dis)Create a new ClientAppConfig. |
ClientAppConfig(String cl,
String client,
String a,
long d,
boolean dis,
String cp,
String sa,
String ua)Create a new ClientAppConfig with all fields. |
| Modifier and Type | Method and Description |
|---|---|
static File | configDir(I2PAppContext ctx)This is the config dir. |
static File | configFile(I2PAppContext ctx)This is the old config file. |
static boolean | deleteClientAppConfig(ClientAppConfig cac)This works for both split and non-split config. |
boolean | equals(Object o)Matches on class, args, and name only |
static List<ClientAppConfig> | getClientApps(File cfgFile)Go through the file, and return a List of ClientAppConfig structures |
static List<ClientAppConfig> | getClientApps(RouterContext ctx)Go through the files, and return a List of ClientAppConfig structures
This is for the router. |
int | hashCode()Hash code based on class name. |
static boolean | isSplitConfig(I2PAppContext ctx)Only valid for the router's clients (not plugins). |
static void | writeClientAppConfig(I2PAppContext ctx,
ClientAppConfig app)Classpath and stopargs not supported. |
static void | writeClientAppConfig(I2PAppContext ctx,
List<ClientAppConfig> apps)Classpath and stopargs not supported. |
public String args
public String className
public final String classpath
public String clientName
File configFile
public final long delay
public boolean disabled
public final String stopargs
public final String uninstallargs
public ClientAppConfig(String cl, String client, String a, long d, boolean dis)
cl - the class nameclient - the display namea - the argumentsd - the startup delay in msdis - whether disabledpublic ClientAppConfig(String cl, String client, String a, long d, boolean dis, String cp, String sa, String ua)
cl - the class nameclient - the display namea - the argumentsd - the startup delay in msdis - whether disabledcp - the classpathsa - the stop argumentsua - the uninstall argumentspublic static File configDir(I2PAppContext ctx)
ctx - the I2P app contextpublic static File configFile(I2PAppContext ctx)
ctx - the I2P app contextpublic static boolean deleteClientAppConfig(ClientAppConfig cac) throws IOException
cac - the client app config to deleteIllegalArgumentException - if cac has a null configfileIOException - if the file cannot be read or writtenpublic boolean equals(Object o)
public static List<ClientAppConfig> getClientApps(File cfgFile) throws IOException
cfgFile - the config file to readIOException - if the file cannot be readpublic static List<ClientAppConfig> getClientApps(RouterContext ctx)
ctx - the router contextpublic int hashCode()
public static boolean isSplitConfig(I2PAppContext ctx)
ctx - the I2P app contextpublic static void writeClientAppConfig(I2PAppContext ctx, ClientAppConfig app) throws IOException
ctx - the I2P app contextapp - the client app config to writeIOException - if the file cannot be writtenpublic static void writeClientAppConfig(I2PAppContext ctx, List<ClientAppConfig> apps) throws IOException
ctx - the I2P app contextapps - the list of client app configs to writeIOException - if the file cannot be written