Java Code Examples for org.apache.hadoop.conf.Configuration.getRaw()

The following are Jave code examples for showing how to use getRaw() of the org.apache.hadoop.conf.Configuration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File:   Source Code and License Vote up 6 votes
public void setConf(Configuration 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.");
Example 2
Project: aliyun-maxcompute-data-collectors   File:   Source Code and License Vote up 4 votes
 * 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.

    // Save the 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);

  } catch (SQLException sqlE) {
    try {
    } catch (SQLException sqlE2) {
      LOG.warn("Exception rolling back transaction during error handling: "
          + sqlE2);
    throw new IOException("Error communicating with database", sqlE);