diff options
author | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-24 23:13:47 +0000 |
---|---|---|
committer | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-24 23:13:47 +0000 |
commit | 1ef0f788c963b96af22f7451cd22b19867180769 (patch) | |
tree | f1919b801e87b16dbdaba8a5699c1ce3add603b8 /java | |
parent | c5bd46491b94e57c8e845bc4d06c8acb03eb4147 (diff) | |
download | ATCD-1ef0f788c963b96af22f7451cd22b19867180769.tar.gz |
Updated source files for tests/ServiceConfigurator.
Diffstat (limited to 'java')
-rw-r--r-- | java/JACE/tests/ServiceConfigurator/Main.java | 113 | ||||
-rw-r--r-- | java/JACE/tests/ServiceConfigurator/svc.conf | 4 |
2 files changed, 117 insertions, 0 deletions
diff --git a/java/JACE/tests/ServiceConfigurator/Main.java b/java/JACE/tests/ServiceConfigurator/Main.java new file mode 100644 index 00000000000..2b57d5ad429 --- /dev/null +++ b/java/JACE/tests/ServiceConfigurator/Main.java @@ -0,0 +1,113 @@ +package JACE.tests.ServiceConfigurator; + +import java.io.*; +import java.util.*; +import JACE.OS.*; +import JACE.ServiceConfigurator.*; + +/** + * Runs the service configurator, allowing the user to interact with it. + */ +public class Main +{ + public static void main (String args[]) + throws FileNotFoundException, IOException, ClassNotFoundException, + IllegalAccessException, InstantiationException + { + ACE.enableDebugging (); + + if (ServiceConfig.open (args) < 0) { + System.err.println ("Error opening ServiceConfig"); + return; + } + + processCommands (args); + + // close everything down + ServiceConfig.close (); + } + + public static void report(String s) { + System.out.println(s); + } + + static InputStreamReader stdin = new InputStreamReader (System.in); + + public static void showMenu () + { + report ("\n[C]lose all"); + report ("[S]uspend all"); + report ("[R]esume all"); + report ("[Re[l]oad all"); + report ("List [n]ames"); + + report ("\n[Q]uit"); + System.out.print ("\nOption (CSRLNQ): "); + } + + public static void processCommands (String [] args) + throws FileNotFoundException, IOException, ClassNotFoundException, + IllegalAccessException, InstantiationException + { + int ch = 0; + Enumeration svcs; + + showMenu (); + + do { + + ch = stdin.read (); + + switch (ch) + { + case 'c': + case 'C': + ServiceConfig.close (); + break; + case 's': + case 'S': + svcs = ServiceConfig.serviceNames (); + while (svcs.hasMoreElements ()) + ServiceConfig.suspend ((String)svcs.nextElement ()); + break; + case 'r': + case 'R': + svcs = ServiceConfig.serviceNames (); + while (svcs.hasMoreElements ()) + ServiceConfig.resume ((String)svcs.nextElement ()); + break; + case 'l': + case 'L': + ServiceConfig.close (); + svcs = ServiceConfig.serviceNames (); + while (svcs.hasMoreElements ()) + ServiceConfig.remove ((String)svcs.nextElement ()); + ServiceConfig.open (args); + break; + case 'n': + case 'N': + report ("\nService names:\n"); + svcs = ServiceConfig.services (); + while (svcs.hasMoreElements ()) { + Service sv = (Service)svcs.nextElement (); + report (sv.name () + " : " + sv.info ()); + } + break; + case 'q': + case 'Q': + report ("\nExiting..."); + return; + case -1: + case 10: + case 13: + continue; + default: + break; + } + + showMenu (); + + } while (true); + } + +} diff --git a/java/JACE/tests/ServiceConfigurator/svc.conf b/java/JACE/tests/ServiceConfigurator/svc.conf new file mode 100644 index 00000000000..5c0c331ed94 --- /dev/null +++ b/java/JACE/tests/ServiceConfigurator/svc.conf @@ -0,0 +1,4 @@ +load TimeService JACE.netsvcs.Time.TSServerAcceptor ServiceObject "-d -p 30000" +load LogService JACE.netsvcs.Logger.ServerLoggingAcceptor ServiceObject "-d -p 30001" +load NameService JACE.netsvcs.Naming.NameAcceptor ServiceObject "-d -p 30002" +load TokenService JACE.netsvcs.Token.TokenAcceptor ServiceObject "-d -p 30003" |