Example usage for org.apache.hadoop.conf Configuration getStrings

List of usage examples for org.apache.hadoop.conf Configuration getStrings

Introduction

In this page you can find the example usage for org.apache.hadoop.conf Configuration getStrings.

Prototype

public String[] getStrings(String name, String... defaultValue) 

Source Link

Document

Get the comma delimited values of the name property as an array of Strings.

Usage

From source file:org.apache.oozie.dependency.HCatURIHandler.java

License:Apache License

@Override
public void init(Configuration conf) {
    dependencyTypes = new HashMap<String, DependencyType>();
    supportedSchemes = new HashSet<String>();
    String[] schemes = conf.getStrings(URIHandlerService.URI_HANDLER_SUPPORTED_SCHEMES_PREFIX
            + this.getClass().getSimpleName() + URIHandlerService.URI_HANDLER_SUPPORTED_SCHEMES_SUFFIX, "hcat");
    supportedSchemes.addAll(Arrays.asList(schemes));
    classesToShip = new HCatLauncherURIHandler().getClassesForLauncher();
}

From source file:org.apache.oozie.service.ConfigurationService.java

License:Apache License

public static String[] getStrings(Configuration conf, String name) {
    return conf.getStrings(name, new String[0]);
}

From source file:org.apache.oozie.util.ClasspathUtils.java

License:Apache License

public static void setupClasspath(Map<String, String> env, Configuration conf) throws IOException {
    // Propagate the system classpath when using the mini cluster
    if (usingMiniYarnCluster) {
        MRApps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(),
                System.getProperty("java.class.path"), conf);
    }/*  ww  w. j a  v  a 2  s.  co  m*/

    for (String entry : CLASSPATH_ENTRIES) {
        MRApps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(), entry, conf);
    }

    // a * in the classpath will only find a .jar, so we need to filter out
    // all .jars and add everything else
    addToClasspathIfNotJar(org.apache.hadoop.mapreduce.filecache.DistributedCache.getFileClassPaths(conf),
            org.apache.hadoop.mapreduce.filecache.DistributedCache.getCacheFiles(conf), conf, env,
            ApplicationConstants.Environment.PWD.$());
    addToClasspathIfNotJar(org.apache.hadoop.mapreduce.filecache.DistributedCache.getArchiveClassPaths(conf),
            org.apache.hadoop.mapreduce.filecache.DistributedCache.getCacheArchives(conf), conf, env,
            ApplicationConstants.Environment.PWD.$());

    boolean crossPlatform = conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
            MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM);

    for (String c : conf.getStrings(YarnConfiguration.YARN_APPLICATION_CLASSPATH,
            crossPlatform ? YarnConfiguration.DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH
                    : YarnConfiguration.DEFAULT_YARN_APPLICATION_CLASSPATH)) {
        MRApps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(), c.trim(), conf);
    }
}

From source file:org.apache.oozie.util.ClasspathUtils.java

License:Apache License

public static void addMapReduceToClasspath(Map<String, String> env, Configuration conf) {
    boolean crossPlatform = conf.getBoolean(MRConfig.MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM,
            MRConfig.DEFAULT_MAPREDUCE_APP_SUBMISSION_CROSS_PLATFORM);

    for (String c : conf.getStrings(MRJobConfig.MAPREDUCE_APPLICATION_CLASSPATH,
            crossPlatform//from  ww  w .  java2s  .  c o m
                    ? StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_CROSS_PLATFORM_APPLICATION_CLASSPATH)
                    : StringUtils.getStrings(MRJobConfig.DEFAULT_MAPREDUCE_APPLICATION_CLASSPATH))) {
        MRApps.addToEnvironment(env, ApplicationConstants.Environment.CLASSPATH.name(), c.trim(), conf);
    }
}

From source file:org.apache.rya.indexing.accumulo.ConfigUtils.java

License:Apache License

protected static Set<URI> getPredicates(final Configuration conf, final String confName) {
    final String[] validPredicateStrings = conf.getStrings(confName, new String[] {});
    final Set<URI> predicates = new HashSet<>();
    for (final String prediateString : validPredicateStrings) {
        predicates.add(new URIImpl(prediateString));
    }//from w  w w. j  a v a2 s .  com
    return predicates;
}

From source file:org.apache.rya.indexing.accumulo.geo.OptionalConfigUtils.java

License:Apache License

/**
 * Retrieves the value for the geo indexer type from the config.
 * @param conf the {@link Configuration}.
 * @return the {@link GeoIndexerType} found in the config or
 * {@code UNSPECIFIED} if it doesn't exist.
 *//* ww  w.ja  v a  2 s. co m*/
public static GeoIndexerType getGeoIndexerType(final Configuration conf) {
    String confType[] = conf.getStrings(GEO_INDEXER_TYPE, GeoIndexerType.UNSPECIFIED.name());
    try {
        return GeoIndexerType.valueOf(GeoIndexerType.class, confType[0]);
    } catch (IllegalArgumentException e) {
        // if none matched, invalid configuration, fail fast.
        // this is where you can allow putting any classname in the configuration.
        throw new Error("Configuration contains an unknown GeoIndexerType, found: \"" + GEO_INDEXER_TYPE + "\"="
                + confType[0]);
    }
}

From source file:org.apache.sentry.api.generic.thrift.SentryGenericPolicyProcessor.java

License:Apache License

SentryGenericPolicyProcessor(Configuration conf) throws Exception {
    this.store = new DelegateSentryStore(conf);
    this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
    this.conf = conf;
    adminGroups = ImmutableSet/*from   ww w  . ja va  2 s.c o  m*/
            .copyOf((Sets.newHashSet(conf.getStrings(ServerConfig.ADMIN_GROUPS, new String[] {}))));
}

From source file:org.apache.sentry.api.generic.thrift.SentryGenericPolicyProcessor.java

License:Apache License

@VisibleForTesting
SentryGenericPolicyProcessor(Configuration conf, SentryStoreLayer store) throws Exception {
    this.store = store;
    this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf));
    this.conf = conf;
    adminGroups = ImmutableSet//  ww  w. j  av a  2  s .  c  o  m
            .copyOf(toTrimmed(Sets.newHashSet(conf.getStrings(ServerConfig.ADMIN_GROUPS, new String[] {}))));
}

From source file:org.apache.sentry.api.service.thrift.SentryPolicyStoreProcessor.java

License:Apache License

SentryPolicyStoreProcessor(String name, Configuration conf, SentryStoreInterface store) throws Exception {
    super();//  w  w  w. j a va  2 s  .  com
    this.name = name;
    this.conf = conf;
    this.sentryStore = store;
    this.notificationHandlerInvoker = new NotificationHandlerInvoker(conf, createHandlers(conf));
    this.audit = new SentryAuditLogger(conf);
    adminGroups = ImmutableSet.copyOf(
            toTrimedLower(Sets.newHashSet(conf.getStrings(ServerConfig.ADMIN_GROUPS, new String[] {}))));
    Iterable<String> pluginClasses = ConfUtilties.CLASS_SPLITTER.split(
            conf.get(ServerConfig.SENTRY_POLICY_STORE_PLUGINS, ServerConfig.SENTRY_POLICY_STORE_PLUGINS_DEFAULT)
                    .trim());
    for (String pluginClassStr : pluginClasses) {
        Class<?> clazz = conf.getClassByName(pluginClassStr);
        if (!SentryPolicyStorePlugin.class.isAssignableFrom(clazz)) {
            throw new IllegalArgumentException("Sentry Plugin [" + pluginClassStr + "] is not a "
                    + SentryPolicyStorePlugin.class.getName());
        }
        SentryPolicyStorePlugin plugin = (SentryPolicyStorePlugin) clazz.newInstance();
        plugin.initialize(conf, sentryStore);
        sentryPlugins.add(plugin);
    }
    initMetrics();
}

From source file:org.apache.sentry.hdfs.SentryPlugin.java

License:Apache License

@Override
public void initialize(Configuration conf, SentryStoreInterface sentryStore) throws SentryPluginException {
    // List of paths managed by Sentry
    String[] prefixes = conf.getStrings(SENTRY_HDFS_INTEGRATION_PATH_PREFIXES,
            SENTRY_HDFS_INTEGRATION_PATH_PREFIXES_DEFAULT);
    PermImageRetriever permImageRetriever = new PermImageRetriever(sentryStore);
    PathImageRetriever pathImageRetriever = new PathImageRetriever(sentryStore, prefixes);
    PermDeltaRetriever permDeltaRetriever = new PermDeltaRetriever(sentryStore);
    PathDeltaRetriever pathDeltaRetriever = new PathDeltaRetriever(sentryStore);
    pathsUpdater = new DBUpdateForwarder<>(pathImageRetriever, pathDeltaRetriever);
    permsUpdater = new DBUpdateForwarder<>(permImageRetriever, permDeltaRetriever);

    LOGGER.info("Sentry HDFS plugin initialized !!");
    instance = this;

    // register signal handler(s) if any signal(s) are configured
    String[] sigs = conf.getStrings(ServerConfig.SENTRY_SERVICE_FULL_UPDATE_SIGNAL, null);
    if (sigs != null && sigs.length != 0) {
        for (String sig : sigs) {
            try {
                LOGGER.info("SIGNAL HANDLING: Registering Signal Handler For " + sig);
                SigUtils.registerSigListener(sig, this);
            } catch (Exception e) {
                LOGGER.error("SIGNAL HANDLING: Signal Handle Registration Failure", e);
            }//from   w  w  w.  jav a 2 s.c o  m
        }
    }

    // subscribe to full update notification
    if (conf.getBoolean(ServerConfig.SENTRY_SERVICE_FULL_UPDATE_PUBSUB, false)) {
        LOGGER.info(FULL_UPDATE_TRIGGER + "subscribing to topic " + PubSub.Topic.HDFS_SYNC_NN.getName());
        PubSub.getInstance().subscribe(PubSub.Topic.HDFS_SYNC_NN, this);
    }
}