當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getStringCollection方法代碼示例

本文整理匯總了Java中org.apache.hadoop.conf.Configuration.getStringCollection方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getStringCollection方法的具體用法?Java Configuration.getStringCollection怎麽用?Java Configuration.getStringCollection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.conf.Configuration的用法示例。


在下文中一共展示了Configuration.getStringCollection方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProviders

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
public static List<CredentialProvider> getProviders(Configuration conf
                                             ) throws IOException {
  List<CredentialProvider> result = new ArrayList<CredentialProvider>();
  for(String path: conf.getStringCollection(CREDENTIAL_PROVIDER_PATH)) {
    try {
      URI uri = new URI(path);
      boolean found = false;
      for(CredentialProviderFactory factory: serviceLoader) {
        CredentialProvider kp = factory.createProvider(uri, conf);
        if (kp != null) {
          result.add(kp);
          found = true;
          break;
        }
      }
      if (!found) {
        throw new IOException("No CredentialProviderFactory for " + uri + " in " +
            CREDENTIAL_PROVIDER_PATH);
      }
    } catch (URISyntaxException error) {
      throw new IOException("Bad configuration of " + CREDENTIAL_PROVIDER_PATH +
          " at " + path, error);
    }
  }
  return result;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:27,代碼來源:CredentialProviderFactory.java

示例2: getProviders

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
public static List<KeyPairProvider> getProviders(Configuration conf
                                             ) throws IOException {
  List<KeyPairProvider> result = new ArrayList<>();
  for(String path: conf.getStringCollection(KEY_PROVIDER_PATH)) {
    try {
      URI uri = new URI(path);
      KeyPairProvider kp = get(uri, conf);
      if (kp != null) {
        result.add(kp);
      } else {
        throw new IOException("No KeyPairProviderFactory for " + uri + " in " +
            KEY_PROVIDER_PATH);
      }
    } catch (URISyntaxException error) {
      throw new IOException("Bad configuration of " + KEY_PROVIDER_PATH +
          " at " + path, error);
    }
  }
  return result;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:21,代碼來源:KeyPairProviderFactory.java

示例3: getProviders

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
public static List<KeyProvider> getProviders(Configuration conf
                                             ) throws IOException {
  List<KeyProvider> result = new ArrayList<KeyProvider>();
  for(String path: conf.getStringCollection(KEY_PROVIDER_PATH)) {
    try {
      URI uri = new URI(path);
      KeyProvider kp = get(uri, conf);
      if (kp != null) {
        result.add(kp);
      } else {
        throw new IOException("No KeyProviderFactory for " + uri + " in " +
            KEY_PROVIDER_PATH);
      }
    } catch (URISyntaxException error) {
      throw new IOException("Bad configuration of " + KEY_PROVIDER_PATH +
          " at " + path, error);
    }
  }
  return result;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:21,代碼來源:KeyProviderFactory.java

示例4: getProviders

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
public static List<ReEncryptionKeyProviderInterface> getProviders(Configuration conf
                                             ) throws IOException {
  List<ReEncryptionKeyProviderInterface> result = new ArrayList<>();
  for(String path: conf.getStringCollection(KEY_PROVIDER_PATH)) {
    try {
      URI uri = new URI(path);
      ReEncryptionKeyProviderInterface kp = get(uri, conf);
      if (kp != null) {
        result.add(kp);
      } else {
        throw new IOException("No ReEncryptionKeyProviderFactory for " + uri + " in " +
            KEY_PROVIDER_PATH);
      }
    } catch (URISyntaxException error) {
      throw new IOException("Bad configuration of " + KEY_PROVIDER_PATH +
          " at " + path, error);
    }
  }
  return result;
}
 
開發者ID:nucypher,項目名稱:hadoop-oss,代碼行數:21,代碼來源:ReEncryptionKeyProviderFactory.java

示例5: buildDependencyClasspath

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/**
 * Returns a classpath string built from the content of the "tmpjars" value in {@code conf}.
 * Also exposed to shell scripts via `bin/hbase mapredcp`.
 */
public static String buildDependencyClasspath(Configuration conf) {
  if (conf == null) {
    throw new IllegalArgumentException("Must provide a configuration object.");
  }
  Set<String> paths = new HashSet<String>(conf.getStringCollection("tmpjars"));
  if (paths.size() == 0) {
    throw new IllegalArgumentException("Configuration contains no tmpjars.");
  }
  StringBuilder sb = new StringBuilder();
  for (String s : paths) {
    // entries can take the form 'file:/path/to/file.jar'.
    int idx = s.indexOf(":");
    if (idx != -1) s = s.substring(idx + 1);
    if (sb.length() > 0) sb.append(File.pathSeparator);
    sb.append(s);
  }
  return sb.toString();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:TableMapReduceUtil.java

示例6: initAuditLoggers

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
private List<AuditLogger> initAuditLoggers(Configuration conf) {
  // Initialize the custom access loggers if configured.
  Collection<String> alClasses = conf.getStringCollection(DFS_NAMENODE_AUDIT_LOGGERS_KEY);
  List<AuditLogger> auditLoggers = Lists.newArrayList();
  if (alClasses != null && !alClasses.isEmpty()) {
    for (String className : alClasses) {
      try {
        AuditLogger logger;
        if (DFS_NAMENODE_DEFAULT_AUDIT_LOGGER_NAME.equals(className)) {
          logger = new DefaultAuditLogger();
        } else {
          logger = (AuditLogger) Class.forName(className).newInstance();
        }
        logger.initialize(conf);
        auditLoggers.add(logger);
      } catch (RuntimeException re) {
        throw re;
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
  }

  // Make sure there is at least one logger installed.
  if (auditLoggers.isEmpty()) {
    auditLoggers.add(new DefaultAuditLogger());
  }

  // Add audit logger to calculate top users
  if (topConf.isEnabled) {
    topMetrics = new TopMetrics(conf, topConf.nntopReportingPeriodsMs);
    auditLoggers.add(new TopAuditLogger(topMetrics));
  }

  return Collections.unmodifiableList(auditLoggers);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:37,代碼來源:FSNamesystem.java

示例7: init

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
@Override
public void init(FileSystem fs, Path path, Configuration conf, boolean overwritable) throws IOException {
  Collection<String> operations = conf.getStringCollection(ALLOWED_OPERATIONS);
  if (operations.isEmpty() || operations.contains(AllowedOperations.all.name())) {
    doAppends = doSyncs = true;
  } else if (operations.contains(AllowedOperations.none.name())) {
    doAppends = doSyncs = false;
  } else {
    doAppends = operations.contains(AllowedOperations.append.name());
    doSyncs = operations.contains(AllowedOperations.sync.name());
  }
  LOG.info("IOTestWriter initialized with appends " + (doAppends ? "enabled" : "disabled") +
      " and syncs " + (doSyncs ? "enabled" : "disabled"));
  super.init(fs, path, conf, overwritable);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:IOTestProvider.java

示例8: IOTestWAL

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/**
 * Create an edit log at the given <code>dir</code> location.
 *
 * You should never have to load an existing log. If there is a log at
 * startup, it should have already been processed and deleted by the time the
 * WAL object is started up.
 *
 * @param fs filesystem handle
 * @param rootDir path to where logs and oldlogs
 * @param logDir dir where wals are stored
 * @param archiveDir dir where wals are archived
 * @param conf configuration to use
 * @param listeners Listeners on WAL events. Listeners passed here will
 * be registered before we do anything else; e.g. the
 * Constructor {@link #rollWriter()}.
 * @param failIfWALExists If true IOException will be thrown if files related to this wal
 *        already exist.
 * @param prefix should always be hostname and port in distributed env and
 *        it will be URL encoded before being used.
 *        If prefix is null, "wal" will be used
 * @param suffix will be url encoded. null is treated as empty. non-empty must start with
 *        {@link DefaultWALProvider#WAL_FILE_NAME_DELIMITER}
 * @throws IOException
 */
public IOTestWAL(final FileSystem fs, final Path rootDir, final String logDir,
    final String archiveDir, final Configuration conf,
    final List<WALActionsListener> listeners,
    final boolean failIfWALExists, final String prefix, final String suffix)
    throws IOException {
  super(fs, rootDir, logDir, archiveDir, conf, listeners, failIfWALExists, prefix, suffix);
  Collection<String> operations = conf.getStringCollection(ALLOWED_OPERATIONS);
  doFileRolls = operations.isEmpty() || operations.contains(AllowedOperations.all.name()) ||
      operations.contains(AllowedOperations.fileroll.name());
  initialized = true;
  LOG.info("Initialized with file rolling " + (doFileRolls ? "enabled" : "disabled"));
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:37,代碼來源:IOTestProvider.java

示例9: getRMHAIds

import org.apache.hadoop.conf.Configuration; //導入方法依賴的package包/類
/**
 * @param conf Configuration. Please use getRMHAIds to check.
 * @return RM Ids on success
 */
public static Collection<String> getRMHAIds(Configuration conf) {
  return  conf.getStringCollection(YarnConfiguration.RM_HA_IDS);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:8,代碼來源:HAUtil.java


注:本文中的org.apache.hadoop.conf.Configuration.getStringCollection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。