ConfigClients stopClient stubbed out.

This commit is contained in:
sponge
2011-06-01 03:59:12 +00:00
parent 3b80f53b8e
commit 18d3536ffe
3 changed files with 36 additions and 5 deletions

View File

@ -95,7 +95,15 @@ public class ConfigClientsHandler extends FormHandler {
// value
if (_action.startsWith("Stop ")) {
String app = _action.substring(5);
int appnum = -1;
try {
appnum = Integer.parseInt(app);
} catch (NumberFormatException nfe) {}
if (appnum >= 0) {
stopClient(appnum);
} else {
try {
PluginStarter.stopPlugin(_context, app);
addFormNotice(_("Stopped plugin {0}", app));
@ -103,6 +111,7 @@ public class ConfigClientsHandler extends FormHandler {
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
_log.error("Error stopping plugin " + app, e);
}
}
return;
}
@ -201,6 +210,20 @@ public class ConfigClientsHandler extends FormHandler {
return arr[0].trim();
}
// STUB for stopClient, not completed yet.
private void stopClient(int i) {
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
if (i >= clients.size()) {
addFormError(_("Bad client index."));
return;
}
ClientAppConfig ca = clients.get(i);
//
// What do we do here?
//
addFormNotice(_("Client") + ' ' + _(ca.clientName) + ' ' + _("stopped") + '.');
}
private void startClient(int i) {
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
if (i >= clients.size()) {

View File

@ -109,7 +109,12 @@ public class ConfigClientsHelper extends HelperBase {
//"webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName),
false,
ca.className + ((ca.args != null) ? " " + ca.args : ""), (""+cur).equals(_edit),
true, false, false, true, ca.disabled);
true, false,
// Enable this one and comment out the false below once the stub is filled in.
//!ca.disabled && !("webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName)),
false,
true, ca.disabled);
}
if ("new".equals(_edit))

View File

@ -1,3 +1,6 @@
2011-06-01 sponge
* ConfigClients stopClient stubbed out.
2011-06-01 sponge
* Re the below, using better way that kytv suggested.
There is more than one way to peel a pineapple...