当前位置: 首页>>代码示例>>Java>>正文


Java ArgumentMap.getValue方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:opencadc,项目名称:caom2,代码行数:43,代码来源:Main.java

示例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);
      }
  }
 
开发者ID:opencadc,项目名称:caom2,代码行数:39,代码来源:Util.java


注:本文中的ca.nrc.cadc.util.ArgumentMap.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。