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


Java Configuration.getRaw方法代码示例

本文整理汇总了Java中org.apache.hadoop.conf.Configuration.getRaw方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getRaw方法的具体用法?Java Configuration.getRaw怎么用?Java Configuration.getRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.conf.Configuration的用法示例。


在下文中一共展示了Configuration.getRaw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setConf

import org.apache.hadoop.conf.Configuration; //导入方法依赖的package包/类
@Override
public void setConf(Configuration conf) {
  super.setConf(conf);
  if (conf != null) {
    String val = conf.get(key);
    if (val == null || !val.equals(value))
      throw new IllegalArgumentException(
          "Configuration was not passed correctly");
    // and then check to make sure we got a fresh config by checking for a
    // hadoop-based config value, and if we don't find it, its fine
    if (conf.getRaw("fs.file.impl") != null)
      throw new IllegalArgumentException(
          "Configuration was created using 'new Configuration()', should be "
              + "done via 'new Configuration(false) to exclude defaut hadoop "
              + "configurations values.");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:CheckConfigurationConstraint.java

示例2: createInternal

import org.apache.hadoop.conf.Configuration; //导入方法依赖的package包/类
/**
 * Actually insert/update the resources for this job.
 */
private void createInternal(String jobName, JobData data)
    throws IOException {
  try {
    LOG.debug("Creating job: " + jobName);

    // Save the name of the Sqoop tool.
    setV0Property(jobName, PROPERTY_CLASS_SCHEMA, SQOOP_TOOL_KEY,
        data.getSqoopTool().getToolName());

    // Save the property set id.
    setV0Property(jobName, PROPERTY_CLASS_SCHEMA, PROPERTY_SET_KEY,
        CUR_PROPERTY_SET_ID);

    // Save all properties of the SqoopOptions.
    Properties props = data.getSqoopOptions().writeProperties();
    setV0Properties(jobName, PROPERTY_CLASS_SQOOP_OPTIONS, props);

    // And save all unique properties of the configuration.
    Configuration saveConf = data.getSqoopOptions().getConf();
    Configuration baseConf = new Configuration();

    for (Map.Entry<String, String> entry : saveConf) {
      String key = entry.getKey();
      String rawVal = saveConf.getRaw(key);
      String baseVal = baseConf.getRaw(key);
      if (baseVal != null && rawVal.equals(baseVal)) {
        continue; // Don't save this; it's set in the base configuration.
      }

      LOG.debug("Saving " + key + " => " + rawVal + " / " + baseVal);
      setV0Property(jobName, PROPERTY_CLASS_CONFIG, key, rawVal);
    }

    connection.commit();
  } catch (SQLException sqlE) {
    try {
      connection.rollback();
    } catch (SQLException sqlE2) {
      LOG.warn("Exception rolling back transaction during error handling: "
          + sqlE2);
    }
    throw new IOException("Error communicating with database", sqlE);
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:48,代码来源:HsqldbJobStorage.java


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