Skip to Content.
Sympa Menu

perfsonar-dev - r2037 - branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters

Subject: perfsonar development work

List archive

r2037 - branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters


Chronological Thread 
  • From:
  • To:
  • Subject: r2037 - branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters
  • Date: Thu, 8 Feb 2007 05:52:18 -0500

Author: melis
Date: 2007-02-08 05:52:17 -0500 (Thu, 08 Feb 2007)
New Revision: 2037

Modified:

branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
Log:
Fix for Bug 131

Modified:
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
===================================================================
---
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
2007-02-07 15:18:35 UTC (rev 2036)
+++
branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters/ServicePropertiesConfigurator.java
2007-02-08 10:52:17 UTC (rev 2037)
@@ -67,6 +67,9 @@

} else {

+ System.out.println("First the names of the
devices that have to be supported will " +
+ "be asked.\nHere you can
specify anything you like, but mostly this is the " +
+ "URL or\nthe hostname of the
machine.");
System.out
.println("Enter the name of
the devices one by one, end the list with \"STOP\"!");
String input = "";
@@ -82,473 +85,479 @@
devicesString += it.next();
while (it.hasNext())
devicesString += "," +
it.next();
- }
- out.write("service.mp.devices=" +
devicesString + "\n");
-
- System.out.println("");
- System.out
- .println("Choose one of the
following types of equipment for every ");
- System.out.println("device specified
previously ...");
- System.out.println("1) Quagga - Password
Login (Telnet)");
- System.out.println("2) Cisco - Password Login
(Telnet)");
- System.out.println("3) Cisco - Password Login
(SSH)");
- System.out.println("4) Cisco - Key-based
Login (SSH)");
- System.out.println("5) Juniper - Password
Login (Telnet)");
- System.out.println("6) Juniper - Password
Login (SSH)");
- System.out.println("7) Juniper - Key-based
Login (SSH)");
- System.out.println();
- Iterator it = devices.iterator();
-
- String device = null;
- while (it.hasNext()) {
- device = (String) it.next();
- System.out.println(device + ": ");
- input = br.readLine();
- types.add(input);
-
- if (input.equalsIgnoreCase("1"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter\n");
- else if (input.equalsIgnoreCase("2"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter\n");
- else if (input.equalsIgnoreCase("3"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter\n");
-
- else if (input.equalsIgnoreCase("4"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter\n");
-
- else if (input.equalsIgnoreCase("5"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter\n");
-
- else if (input.equalsIgnoreCase("6"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter\n");
-
- else if (input.equalsIgnoreCase("7"))
- out
-
.write("service.mp."
-
+ device
-
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter\n");
- }
- System.out.println();
-
- System.out
- .println("Now, some access
parameters will be asked ...");
- System.out.println();
-
- it = devices.iterator();
- int index = -1;
- String type = "";
- while (it.hasNext()) {
- device = (String) it.next();
- index = devices.indexOf(device);
- type = (String) types.get(index);
-
- System.out.println(device);
- System.out.println("======");
+
+ out.write("service.mp.devices=" +
devicesString + "\n");
+
+ System.out.println("");
+ System.out
+ .println("Choose one
of the following types of equipment for every ");
+ System.out.println("device specified
previously ...");
+ System.out.println("1) Quagga -
Password Login (Telnet)");
+ System.out.println("2) Cisco -
Password Login (Telnet)");
+ System.out.println("3) Cisco -
Password Login (SSH)");
+ System.out.println("4) Cisco -
Key-based Login (SSH)");
+ System.out.println("5) Juniper -
Password Login (Telnet)");
+ System.out.println("6) Juniper -
Password Login (SSH)");
+ System.out.println("7) Juniper -
Key-based Login (SSH)");
System.out.println();
-
- if (type.equalsIgnoreCase("1")) {
- System.out.println("Please
give the url for device: "
- + device + ":
");
+ Iterator it2 = devices.iterator();
+
+ String device = null;
+ while (it2.hasNext()) {
+ device = (String) it2.next();
+ System.out.println(device +
": ");
input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
- System.out.println("Please
give the port for device: "
- + device + ":
");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
- System.out
-
.println("Please give the prompt for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
- System.out
-
.println("Please give the access rate for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
- System.out
-
.println("Please give the password for device: "
-
+ device + ": ");
- input = br.readLine();
- while (input == null ||
input.equals("")){
- System.out.
- println("You
have to provide a password. Please give" +
- " the
password for device: "
+ types.add(input);
+
+ if
(input.equalsIgnoreCase("1"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.QuaggaAdapter\n");
+ else if
(input.equalsIgnoreCase("2"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoAdapter\n");
+ else if
(input.equalsIgnoreCase("3"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoSshAdapter\n");
+
+ else if
(input.equalsIgnoreCase("4"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.CiscoKeyAdapter\n");
+
+ else if
(input.equalsIgnoreCase("5"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperAdapter\n");
+
+ else if
(input.equalsIgnoreCase("6"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperSshAdapter\n");
+
+ else if
(input.equalsIgnoreCase("7"))
+ out
+
.write("service.mp."
+
+ device
+
+
".class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.JuniperKeyAdapter\n");
+ }
+ System.out.println();
+
+ System.out.println("According to the
chosen type of device and access method, " +
+ "some\nmore questions
will be asked to configure the URL, port, username,\n" +
+ "password or key,
prompt and access-rate (Here you can specify what\n" +
+ "the minimum interval
has to be between requests (in ms)).");
+ //System.out
+ // .println("Now, some
access parameters will be asked ...");
+ System.out.println();
+
+ it = devices.iterator();
+ int index = -1;
+ String type = "";
+ while (it.hasNext()) {
+ device = (String) it.next();
+ index =
devices.indexOf(device);
+ type = (String)
types.get(index);
+
+ System.out.println(device);
+ System.out.println("======");
+ System.out.println();
+
+ if
(type.equalsIgnoreCase("1")) {
+
System.out.println("Please give the url for device: "
+
device + ": ");
input = br.readLine();
- }

- out.write("service.r.mp." +
device + ".password="
- + input +
"\n");
- System.out
-
.println("Please give the bgp-daemon port for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.port="
- + input +
"\n");
- System.out
-
.println("Please give the bgp-daemon prompt for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.prompt="
- + input +
"\n");
- System.out
-
.println("Please give the bgp-daemon password for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + "bgp.password="
- + input +
"\n");
- } else if (type.equalsIgnoreCase("2")
- ||
type.equalsIgnoreCase("3")
- ||
type.equalsIgnoreCase("5")
- ||
type.equalsIgnoreCase("6")) {
- System.out.println("Please
give the url for device: "
- + device + ":
");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
- System.out.println("Please
give the port for device: "
- + device + ":
");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
- System.out
-
.println("Please give the prompt for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
- System.out
-
.println("Please give the access rate for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
- System.out
-
.println("Please give the username for device: "
-
+ device + ": ");
- input = br.readLine();
- while (input == null ||
input.equals("")){
- System.out
- .println("You
have to provide a username. " +
-
"Please give the username for device: "
+
out.write("service.r.mp." + device + ".url=" + input
+ +
"\n");
+
System.out.println("Please give the port for device: "
+
device + ": ");
input = br.readLine();
- }
- out.write("service.r.mp." +
device + ".username="
- + input +
"\n");
- System.out
-
.println("Please give the password for device: "
-
+ device + ": ");
- input = br.readLine();
- while (input == null ||
input.equals("")){
+
out.write("service.r.mp." + device + ".port=" + input
+ +
"\n");
System.out
- .println("You
have to provide a password. " +
-
"Please give the password for device: "
- +
device + ": ");
+
.println("Please give the prompt for device: "
+
+ device + ": ");
input = br.readLine();
- }
- out.write("service.r.mp." +
device + ".password="
- + input +
"\n");
- } else if (type.equalsIgnoreCase("4")
- ||
type.equalsIgnoreCase("7")) {
- System.out.println("Please
give the url for device: "
- + device + ":
");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".url=" + input
- + "\n");
- System.out.println("Please
give the port for device: "
- + device + ":
");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".port=" + input
- + "\n");
- System.out
-
.println("Please give the prompt for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".prompt=" + input
- + "\n");
- System.out
-
.println("Please give the access rate for device: "
-
+ device + ": ");
- input = br.readLine();
- out.write("service.r.mp." +
device + ".rate=" + input
- + "\n");
- System.out
-
.println("Please give the username for device: "
-
+ device + ": ");
- input = br.readLine();
- while (input == null ||
input.equals("")){
+
out.write("service.r.mp." + device + ".prompt=" + input
+ +
"\n");
System.out
- .println("You
have to provide a username. " +
-
"Please give the username for device: "
- +
device + ": ");
+
.println("Please give the access rate for device: "
+
+ device + ": ");
input = br.readLine();
- }
- out.write("service.r.mp." +
device + ".username="
- + input +
"\n");
- System.out
-
.println("Please give the path to the public ssh key for device: "
+
out.write("service.r.mp." + device + ".rate=" + input
+ +
"\n");
+ System.out
+
.println("Please give the password for device: "
+
+ device + ": ");
+ input = br.readLine();
+ while (input == null
|| input.equals("")){
+ System.out.
+
println("You have to provide a password. Please give" +
+
" the password for device: "

+ device + ": ");
- input = br.readLine();
- while (input == null ||
input.equals("")){
+ input =
br.readLine();
+ }

+
out.write("service.r.mp." + device + ".password="
+ +
input + "\n");
System.out
- .println("You
have to provide a path to the public ssh key. " +
-
"Please give the the path to the public ssh key for device: "
+
.println("Please give the bgp-daemon port for device: "
+
+ device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + "bgp.port="
+ +
input + "\n");
+ System.out
+
.println("Please give the bgp-daemon prompt for device: "
+
+ device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + "bgp.prompt="
+ +
input + "\n");
+ System.out
+
.println("Please give the bgp-daemon password for device: "
+
+ device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + "bgp.password="
+ +
input + "\n");
+ } else if
(type.equalsIgnoreCase("2")
+ ||
type.equalsIgnoreCase("3")
+ ||
type.equalsIgnoreCase("5")
+ ||
type.equalsIgnoreCase("6")) {
+
System.out.println("Please give the url for device: "
+
device + ": ");
input = br.readLine();
- }
- out.write("service.r.mp." +
device + ".keyUrl=" + input
- + "\n");
-
- }
-
- out.write("service.r.mp." + device +
".cache=0\n");
- System.out.println();
- }
- System.out
- .println("Enter the name of
the commands one by one for every device, to end the list, enter \"STOP\"!");
- System.out.println("You can choose these
names yourself");
- System.out
- .println("Start the command
with \"BGP_\" for BGP-commands");
- System.out
- .println("Start the command
with \"IP_\" for IP-commands");
- System.out
- .println("Start the command
with \"IPv6_\" for IPv6-commands");
- System.out
- .println("Start the command
with \"STATUS_\" for STATUS-commands");
-
- String lastCommands = "";
- String lastDevice = "";
- List lastCommandsList = new ArrayList();
-
- input = "";
- boolean first = true;
- it = devices.iterator();
- while (it.hasNext()) {
- input = "";
- commands = new ArrayList();
- System.out.println();
- device = (String) it.next();
- System.out.println(device);
- System.out.println("======");
- if (!first) {
- System.out
- .println("Do
you want the use the same commands as configured for the previous device?
(yes/[no])");
- input = br.readLine();
- }
- System.out.println();
- first = false;
-
- if (!input.equalsIgnoreCase("yes")) {
- System.out.println("Enter the
commands!");
- while
(!input.equalsIgnoreCase("STOP")) {
+
out.write("service.r.mp." + device + ".url=" + input
+ +
"\n");
+
System.out.println("Please give the port for device: "
+ +
device + ": ");
input = br.readLine();
- if (input != null &&
!input.equals("") && !input.equalsIgnoreCase("STOP"))
-
commands.add(input);
- }
-
- String commandString = "";
- if (commands.size() > 0) {
- Iterator it2 =
commands.iterator();
- commandString +=
it2.next();
- while (it2.hasNext())
- commandString
+= "," + it2.next();
- }
-
- lastCommands = "service.mp."
+ device + ".commands="
- +
commandString + "\n";
- lastDevice = device;
- out.write("service.mp." +
device + ".commands="
- +
commandString + "\n");
-
- } else {
-
-
commands.addAll(lastCommandsList);
-
out.write(lastCommands.replaceAll(lastDevice, device));
- lastCommands =
lastCommands.replaceAll(lastDevice,
- device);
- lastDevice = device;
-
- }
-
- lastCommandsList.clear();
- lastCommandsList.addAll(commands);
- allCommands.add(commands);
-
- }
-
- System.out.println();
-
- System.out
- .println("Now, the device
specific commands will be asked ");
- System.out
- .println("according to the
commands configured previously");
- System.out
- .println("Also, limitations
on the number of parameters that ");
- System.out.println("can be supplied are asked
here ...");
- System.out
- .println("The last
information to be supplied is the syntax ");
- System.out
- .println("of the commands,
their textual description and the ");
- System.out
- .println("the possibilty to
specify a regular expression for ");
- System.out
- .println("the parameters
corresponding to that command. ");
- System.out.println();
-
- it = devices.iterator();
- Iterator it2 = null;
- List deviceCommands = null;
- first = true;
- input = "";
- String propertiesString = "";
- while (it.hasNext()) {
- System.out.println();
- device = (String) it.next();
-
- System.out.println(device);
- System.out.println("======");
- if (!first) {
- System.out
- .println("Do
you want the use the same properties as configured for the previous device?
(yes/[no])");
- input = br.readLine();
- }
- System.out.println();
- first = false;
-
- if (!input.equalsIgnoreCase("yes")) {
- propertiesString = "";
- index =
devices.indexOf(device);
- deviceCommands = (ArrayList)
allCommands.get(index);
- it2 =
deviceCommands.iterator();
- String command;
- while (it2.hasNext()) {
- command = (String)
it2.next();
+
out.write("service.r.mp." + device + ".port=" + input
+ +
"\n");
System.out
-
.println("Device specific command to be executed for command "
-
+ command + ": ");
+
.println("Please give the prompt for device: "
+
+ device + ": ");
input = br.readLine();
-
out.write("service.mp." + device + ".commands."
- +
command + "=" + input + "\n");
- propertiesString +=
"service.mp." + device
- +
".commands." + command + "=" + input
- +
"\n";
+
out.write("service.r.mp." + device + ".prompt=" + input
+ +
"\n");
System.out
-
.println("Minimum number of parameters for command "
-
+ command + " [0]: ");
+
.println("Please give the access rate for device: "
+
+ device + ": ");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".minParamCount=" + input
-
+ "\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command
-
+ ".minParamCount=" + input + "\n";
+
out.write("service.r.mp." + device + ".rate=" + input
+ +
"\n");
+ System.out
+
.println("Please give the username for device: "
+
+ device + ": ");
+ input = br.readLine();
+ while (input == null
|| input.equals("")){
+ System.out
+
.println("You have to provide a username. " +
+
"Please give the username for device: "
+
+ device + ": ");
+ input =
br.readLine();
}
-
+
out.write("service.r.mp." + device + ".username="
+ +
input + "\n");
System.out
-
.println("Maximum number of parameters for command "
-
+ command + " [0]: ");
+
.println("Please give the password for device: "
+
+ device + ": ");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".maxParamCount=" + input
-
+ "\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command
-
+ ".maxParamCount=" + input + "\n";
+ while (input == null
|| input.equals("")){
+ System.out
+
.println("You have to provide a password. " +
+
"Please give the password for device: "
+
+ device + ": ");
+ input =
br.readLine();
}
-
-
System.out.println("Caching time (ms) " + command
- + "
[0]: ");
+
out.write("service.r.mp." + device + ".password="
+ +
input + "\n");
+ } else if
(type.equalsIgnoreCase("4")
+ ||
type.equalsIgnoreCase("7")) {
+
System.out.println("Please give the url for device: "
+ +
device + ": ");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".caching=" + input + "\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command + ".caching="
-
+ input + "\n";
- } else {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".caching=0\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command
-
+ ".caching=0\n";
+
out.write("service.r.mp." + device + ".url=" + input
+ +
"\n");
+
System.out.println("Please give the port for device: "
+ +
device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + ".port=" + input
+ +
"\n");
+ System.out
+
.println("Please give the prompt for device: "
+
+ device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + ".prompt=" + input
+ +
"\n");
+ System.out
+
.println("Please give the access rate for device: "
+
+ device + ": ");
+ input = br.readLine();
+
out.write("service.r.mp." + device + ".rate=" + input
+ +
"\n");
+ System.out
+
.println("Please give the username for device: "
+
+ device + ": ");
+ input = br.readLine();
+ while (input == null
|| input.equals("")){
+ System.out
+
.println("You have to provide a username. " +
+
"Please give the username for device: "
+
+ device + ": ");
+ input =
br.readLine();
}
-
+
out.write("service.r.mp." + device + ".username="
+ +
input + "\n");
System.out
-
.println("Textual description of the command "
-
+ command + " [none]: ");
+
.println("Please give the path to the public ssh key for device: "
+
+ device + ": ");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".description=" + input
-
+ "\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command
-
+ ".description=" + input + "\n";
+ while (input == null
|| input.equals("")){
+ System.out
+
.println("You have to provide a path to the public ssh key. " +
+
"Please give the the path to the public ssh key for device: "
+
+ device + ": ");
+ input =
br.readLine();
}
-
-
System.out.println("Syntax rules for the command "
- +
command + " [none]: ");
+
out.write("service.r.mp." + device + ".keyUrl=" + input
+ +
"\n");
+
+ }
+
+ out.write("service.r.mp." +
device + ".cache=0\n");
+ System.out.println();
+ }
+ System.out
+ .println("Enter the
name of the commands you want the users to be able to\n" +
+
"execute on the device one by one for every device, to end the list, enter
\"STOP\"!");
+ System.out.println("You can choose
these names yourself");
+ System.out
+ .println("Start the
command with \"BGP_\" for BGP-commands");
+ System.out
+ .println("Start the
command with \"IP_\" for IP-commands");
+ System.out
+ .println("Start the
command with \"IPv6_\" for IPv6-commands");
+ System.out
+ .println("Start the
command with \"STATUS_\" for STATUS-commands");
+
+ String lastCommands = "";
+ String lastDevice = "";
+ List lastCommandsList = new
ArrayList();
+
+ input = "";
+ boolean first = true;
+ it = devices.iterator();
+ while (it.hasNext()) {
+ input = "";
+ commands = new ArrayList();
+ System.out.println();
+ device = (String) it.next();
+ System.out.println(device);
+ System.out.println("======");
+ if (!first) {
+ System.out
+
.println("Do you want the use the same commands as configured for the
previous device? (yes/[no])");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
-
out.write("service.mp." + device + ".commands."
-
+ command + ".syntax=" + input + "\n");
-
propertiesString += "service.mp." + device
-
+ ".commands." + command + ".syntax="
-
+ input + "\n";
+ }
+ System.out.println();
+ first = false;
+
+ if
(!input.equalsIgnoreCase("yes")) {
+
System.out.println("Enter the commands!");
+ while
(!input.equalsIgnoreCase("STOP")) {
+ input =
br.readLine();
+ if (input !=
null && !input.equals("") && !input.equalsIgnoreCase("STOP"))
+
commands.add(input);
}
-
+
+ String commandString
= "";
+ if (commands.size() >
0) {
+ Iterator it3
= commands.iterator();
+ commandString
+= it3.next();
+ while
(it3.hasNext())
+
commandString += "," + it3.next();
+ }
+
+ lastCommands =
"service.mp." + device + ".commands="
+ +
commandString + "\n";
+ lastDevice = device;
+
out.write("service.mp." + device + ".commands="
+ +
commandString + "\n");
+
+ } else {
+
+
commands.addAll(lastCommandsList);
+
out.write(lastCommands.replaceAll(lastDevice, device));
+ lastCommands =
lastCommands.replaceAll(lastDevice,
+
device);
+ lastDevice = device;
+
+ }
+
+ lastCommandsList.clear();
+
lastCommandsList.addAll(commands);
+ allCommands.add(commands);
+
+ }
+
+ System.out.println();
+
+ System.out
+ .println("Now, the
device specific commands will be asked ");
+ System.out
+ .println("according
to the commands configured previously");
+ System.out
+ .println("Also,
limitations on the number of parameters that ");
+ System.out.println("can be supplied
are asked here ...");
+ System.out
+ .println("The last
information to be supplied is the syntax ");
+ System.out
+ .println("of the
commands, their textual description and the ");
+ System.out
+ .println("the
possibilty to specify a regular expression for ");
+ System.out
+ .println("the
parameters corresponding to that command. ");
+ System.out.println();
+
+ it = devices.iterator();
+ Iterator it4 = null;
+ List deviceCommands = null;
+ first = true;
+ input = "";
+ String propertiesString = "";
+ while (it.hasNext()) {
+ System.out.println();
+ device = (String) it.next();
+
+ System.out.println(device);
+ System.out.println("======");
+ if (!first) {
System.out
-
.println("Comma seperated string of regexes for "
-
+ command + " [none]: ");
+
.println("Do you want the use the same properties as configured for the
previous device? (yes/[no])");
input = br.readLine();
- if
(!input.equalsIgnoreCase("")) {
+ }
+ System.out.println();
+ first = false;
+
+ if
(!input.equalsIgnoreCase("yes")) {
+ propertiesString = "";
+ index =
devices.indexOf(device);
+ deviceCommands =
(ArrayList) allCommands.get(index);
+ it4 =
deviceCommands.iterator();
+ String command;
+ while (it4.hasNext())
{
+ command =
(String) it4.next();
+ System.out
+
.println("Device specific command to be executed for command "
+
+ command + ": ");
+ input =
br.readLine();

out.write("service.mp." + device + ".commands."
-
+ command + ".regex=" + input + "\n");
+
+ command + "=" + input + "\n");

propertiesString += "service.mp." + device
-
+ ".commands." + command + ".regex="
-
+ input + "\n";
+
+ ".commands." + command + "=" + input
+
+ "\n";
+ System.out
+
.println("Minimum number of parameters for command "
+
+ command + " [0]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".minParamCount=" + input
+
+ "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command
+
+ ".minParamCount=" + input + "\n";
+ }
+
+ System.out
+
.println("Maximum number of parameters for command "
+
+ command + " [0]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".maxParamCount=" + input
+
+ "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command
+
+ ".maxParamCount=" + input + "\n";
+ }
+
+
System.out.println("Caching time (ms) " + command
+
+ " [0]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".caching=" + input + "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command + ".caching="
+
+ input + "\n";
+ } else {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".caching=0\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command
+
+ ".caching=0\n";
+ }
+
+ System.out
+
.println("Textual description of the command "
+
+ command + " [none]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".description=" + input
+
+ "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command
+
+ ".description=" + input + "\n";
+ }
+
+
System.out.println("Syntax rules for the command "
+
+ command + " [none]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".syntax=" + input + "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command + ".syntax="
+
+ input + "\n";
+ }
+
+ System.out
+
.println("Comma seperated string of regexes for "
+
+ command + " [none]: ");
+ input =
br.readLine();
+ if
(!input.equalsIgnoreCase("")) {
+
out.write("service.mp." + device + ".commands."
+
+ command + ".regex=" + input + "\n");
+
propertiesString += "service.mp." + device
+
+ ".commands." + command + ".regex="
+
+ input + "\n";
+ }
+
}
-
+
+ lastDevice = device;
}
-
- lastDevice = device;
+
+ else {
+
+
out.write(propertiesString.replaceAll(lastDevice,
+
device));
+ propertiesString =
propertiesString.replaceAll(
+
lastDevice, device);
+ lastDevice = device;
+
+ }
+
+ System.out.println();
}
-
- else {
-
-
out.write(propertiesString.replaceAll(lastDevice,
- device));
- propertiesString =
propertiesString.replaceAll(
- lastDevice,
device);
- lastDevice = device;
-
- }
-
- System.out.println();
}
System.out.println();
System.out.println("That's all folks!");



  • r2037 - branches/SSHTelnet-MP-STABLE/src/org/perfsonar/service/measurementPoint/lookingGlassType/engine/adapters, svnlog, 02/08/2007

Archive powered by MHonArc 2.6.16.

Top of Page