本文整理汇总了Java中ca.nrc.cadc.util.ArgumentMap.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java ArgumentMap.getValue方法的具体用法?Java ArgumentMap.getValue怎么用?Java ArgumentMap.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.nrc.cadc.util.ArgumentMap
的用法示例。
在下文中一共展示了ArgumentMap.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import ca.nrc.cadc.util.ArgumentMap; //导入方法依赖的package包/类
public static void main(String[] args) {
String cur = null;
try {
ArgumentMap am = new ArgumentMap(args);
if (am.isSet("h") || am.isSet("help")) {
usage();
System.exit(0);
}
Level lvl = Level.WARN;
if (am.isSet("d") || am.isSet("debug")) {
lvl = Level.DEBUG;
} else if (am.isSet("v") || am.isSet("verbose")) {
lvl = Level.INFO;
}
Log4jInit.setLevel("ca.nrc.cadc.caom2.viz", lvl);
Log4jInit.setLevel("ca.nrc.cadc.caom2.types", lvl);
Log4jInit.setLevel("ca.nrc.cadc.caom2.wcs", lvl);
String fname = am.getValue("in");
String productID = am.getValue("productID");
boolean recomp = am.isSet("r");
boolean headless = am.isSet("headless");
if (fname == null) {
usage();
System.exit(1);
}
File f = new File(fname);
if (headless) {
ComputeFromXML cu = new ComputeFromXML(f, productID);
cu.doit();
} else {
VizUnion vu = new VizUnion(f, productID, recomp);
vu.doit();
}
} catch (Exception ex) {
log.error("failed to display: " + cur, ex);
}
}
示例2: initialize
import ca.nrc.cadc.util.ArgumentMap; //导入方法依赖的package包/类
/**
* Configures logging to either the console or a file, but not both.
*
* If the ArgumentMap contains a key name 'log', a file logger named with the
* value of 'log' is created. If the value of 'log' is null or an empty string,
* a file logger will not be created. If the ArgumentMap doesn't contain
* a 'log' key, a console logger is created.
*
* The log level is set using log level arguments in the ArgumentMap. If the
* ArgumentMap doesn't contain log level arguments, the default log level
* for the console logger is WARN, and the default log level for
* the file logger is INFO.
*
* @param loggerNames names of the loggers to apply the logging options of
* in the argsMap to.
* @param argMap command line argument options.
* @throws IOException problems with the log file
* @throws IllegalArgumentException if there is a disagreement with the way
* the file is handled.
*/
public static void initialize(String[] loggerNames, ArgumentMap argMap)
throws IOException, IllegalArgumentException
{
if (argMap.isSet(Argument.LOG))
{
String filename = argMap.getValue(Argument.LOG);
if (filename.isEmpty())
{
filename = "empty or zero-length string";
throw new IllegalArgumentException("Illegal log file name option: " + filename);
}
initFileLogging(loggerNames, argMap, filename);
}
else
{
initConsoleLogging(loggerNames, argMap);
}
}