perfsonar-dev - perfsonar: r2482 - branches/perfsonarui/src/org/perfsonar/perfsonarui/ui
Subject: perfsonar development work
List archive
- From:
- To:
- Subject: perfsonar: r2482 - branches/perfsonarui/src/org/perfsonar/perfsonarui/ui
- Date: Sun, 1 Jul 2007 08:53:09 -0400
Author: nina
Date: 2007-07-01 08:53:08 -0400 (Sun, 01 Jul 2007)
New Revision: 2482
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
Log:
Command line options handling
Modified:
branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
===================================================================
--- branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2007-07-01 12:51:00 UTC (rev 2481)
+++ branches/perfsonarui/src/org/perfsonar/perfsonarui/ui/PerfsonarModel.java
2007-07-01 12:53:08 UTC (rev 2482)
@@ -374,23 +374,43 @@
}
protected Options createOptions() {
Options options = new Options();
- Option endpoints = OptionBuilder
+ Option endpoints = OptionBuilder.withLongOpt("endpoints")
+ .hasArg()
+ .withArgName("URL")
+ .withDescription("URL for MA.conf, default
http://http://perfsonar.acad.bg/MA.conf")
.create( "e" );
-
-
- Option aggregate = OptionBuilder
+
+ Option aggregate = OptionBuilder.withLongOpt("aggregate")
+ .hasArg()
+ .withArgName("number_of_requests")
+ .withDescription("max requests in an aggregated request, default 32")
.create( "a" );
Option parallel = OptionBuilder
+ .hasArg()
+ .withLongOpt("parallel")
+ .withValueSeparator(' ')
+ .withArgName("number")
+ .withDescription("sends requests in parallel if arg > 0, default 1")
.create( "p" );
Option timeout = OptionBuilder
+ .hasArg()
+ .withLongOpt("timeout")
+ .withArgName("milliseconds")
+ .withDescription("timeout for axis conection,ms (default 300000ms =
5min)")
.create( "t" );
Option visualperfsonar = OptionBuilder
+ .hasArg()
+ .withLongOpt("visual")
+ .withArgName("URL")
+ .withDescription("URL for Visual Perfsonar")
.create( "r" );
Option help = OptionBuilder
+ .withLongOpt("help")
+ .withDescription("This screen")
.create( "h" );
options.addOption(endpoints);
@@ -412,7 +432,8 @@
Options options = createOptions();
CommandLineParser parser = new PosixParser();
CommandLine line = parser.parse( options, args,false );
- logger.info(args);
+ for (int i=0; i < args.length; i++)
+ logger.info(args[i]);
if (line.hasOption("h")) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp( "PerfsonarUI", options );
@@ -429,8 +450,8 @@
protected void setOptions(CommandLine line) {
String url = "http://perfsonar.acad.bg/MA.conf";
- if( line.hasOption( "e" ) ) {
- url = line.getOptionValue( "e" );
+ if( line.hasOption( 'e' ) ) {
+ url = line.getOptionValue( 'e' );
try {
endpointList.readEndpoints(new URL(url));
} catch (Exception x) {
@@ -446,9 +467,9 @@
int maxRequests = 32;
if( line.hasOption( "a" ) ) {
try {
- maxRequests = Integer.parseInt(line.getOptionValue(
"a" ));
+ maxRequests = Integer.parseInt(line.getOptionValue(
'a' ));
} catch (Exception x) {
- maxRequests = 16;
+ maxRequests = 32;
}
}
request.setMaxRequests(maxRequests);
@@ -456,7 +477,7 @@
int timeout = 300000;
if( line.hasOption( "t" ) )
try {
- timeout = Integer.parseInt(line.getOptionValue( "t"
));
+ timeout = Integer.parseInt(line.getOptionValue( 't'
));
} catch (Exception x) {
timeout = 300000;
}
@@ -465,9 +486,11 @@
int parallel = 1;
if( line.hasOption( "p" ) )
try {
- parallel = Integer.parseInt(line.getOptionValue( "p"
));
+ parallel = Integer.parseInt(line.getOptionValue('p'
));
+
} catch (Exception x) {
- timeout = 300000;
+ x.printStackTrace();
+ parallel = 1;
}
request.setParallel(parallel>0);
- perfsonar: r2482 - branches/perfsonarui/src/org/perfsonar/perfsonarui/ui, svnlog, 07/01/2007
Archive powered by MHonArc 2.6.16.