當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。