List of usage examples for org.apache.hadoop.conf Configuration get
public String get(String name)
name
property, null
if no such property exists. From source file:com.bah.culvert.hive.CulvertHiveUtils.java
License:Apache License
/** * Get the culvert table to use as input. * /*from ww w . j ava2 s .com*/ * @param conf The configuration to get the table name from. * @return The culvert table name. */ public static String getCulvertTable(Configuration conf) { return conf.get(CULVERT_HIVE_CTABLE_NAME_CONF_KEY); }
From source file:com.basho.riak.hadoop.config.RiakConfig.java
License:Apache License
/** * Add a riak location to the {@link Configuration} passed. * //from w w w . ja v a 2 s . c om * @param conf * the {@link Configuration} to add a location too * @param location * the {@link RiakLocation} to add * @return the {@link Configuration} with <code>location</code> added to the * location property */ public static Configuration addLocation(Configuration conf, RiakLocation location) { StringBuilder sb = new StringBuilder(); String currentLocations = conf.get(LOCATIONS_PROPERTY); if (currentLocations != null) { sb.append(currentLocations); } if (sb.length() > 0) { sb.append(COMMA); } sb.append(location.asString()); conf.set(LOCATIONS_PROPERTY, sb.toString()); return conf; }
From source file:com.basho.riak.hadoop.config.RiakConfig.java
License:Apache License
/** * @param conf/* w w w .j av a 2s .c o m*/ * the {@link Configuration} to query * @return the {@link KeyLister} the job was configured with * @throws RuntimeException * if a {@link IllegalAccessException} or * {@link InstantiationException} is thrown creating a * {@link KeyLister} */ public static KeyLister getKeyLister(Configuration conf) throws IOException { Class<? extends KeyLister> clazz = conf.getClass(KEY_LISTER_CLASS_PROPERTY, BucketKeyLister.class, KeyLister.class); try { KeyLister lister = clazz.newInstance(); lister.init(conf.get(KEY_LISTER_INIT_STRING_PROPERTY)); return lister; } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (InstantiationException e) { throw new RuntimeException(e); } }
From source file:com.basho.riak.hadoop.config.RiakConfig.java
License:Apache License
/** * Get the configured output bucket for the job's results * // w ww . jav a 2 s. com * @param conf * the {@link Configuration} to query * @return the bucket name */ public static String getOutputBucket(Configuration conf) { return conf.get(OUTPUT_BUCKET_PROPERTY); }
From source file:com.baynote.kafka.hadoop.KafkaInputFormat.java
License:Apache License
/** * Gets the Zookeeper connection string set by {@link #setZkConnect(Job, String)}. * //from w ww . j av a 2 s . c om * @param conf * the job conf. * @return the Zookeeper connection string. */ public static String getZkConnect(final Configuration conf) { return conf.get("kafka.zk.connect"); }
From source file:com.baynote.kafka.hadoop.KafkaInputFormat.java
License:Apache License
/** * Gets the input topic.//from w ww . jav a2 s. c om * * @param conf * the job conf. * @return the input topic. */ public static String getTopic(final Configuration conf) { return conf.get("kafka.topic"); }
From source file:com.baynote.kafka.hadoop.KafkaInputFormat.java
License:Apache License
/** * Gets the consumer group./*from w ww . j a v a 2 s . co m*/ * * @param conf * the job conf. * @return the consumer group. */ public static String getConsumerGroup(final Configuration conf) { return conf.get("kafka.groupid"); }
From source file:com.baynote.kafka.hadoop.MultipleKafkaInputFormat.java
License:Apache License
/** * Returns a {@link List} containing <em>all</em> of the topic-group-{@link Mapper} combinations added via * {@link #addTopic(Job, String, String, Class)}. * //from w ww. ja v a 2s.c o m * @param conf * the conf for this job. * @return all of the configured {@link TopicConf}s */ @SuppressWarnings("unchecked") public static List<TopicConf> getTopics(final Configuration conf) { final List<TopicConf> result = Lists.newArrayList(); for (final String topicConf : conf.get(TOPICS_CONF).split(";")) { final String[] topicConfTokens = topicConf.split(","); final String topic = topicConfTokens[0]; final String group = topicConfTokens[1]; final Class<? extends Mapper> mapper; try { mapper = (Class<? extends Mapper>) conf.getClassByName(topicConfTokens[2]); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } result.add(new TopicConf(topic, group, mapper)); } return result; }
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
/** * Returns the KerberosIdentity as specified in the configuration. Currently only supports the keytab implementation. * @param conf/*from ww w . j ava 2 s. co m*/ * @return the @see KerberosIdentity after initialisation. */ private KerberosIdentity initialiseKerberosIdentity(Configuration conf) throws IOException { String kerberosPrincipal = conf.get(FS_DL_IMPL_KERBEROS_PRINCIPAL_CONFIG_NAME); if (kerberosPrincipal == null) throw new IOException( "Datalake initialisation requires a kerberos principal to be configured using the fs.dl.impl.kerberosPrincipal configuration value"); String kerberosKeytab = conf.get(FS_DL_IMPL_KERBEROS_KEYTAB_CONFIG_NAME); if (kerberosKeytab == null) throw new IOException( "Datalake initialisation requires a kerberos keytab to be configured using the fs.dl.impl.kerberosKeytab configuration value"); String kerberosRealm = conf.get(FS_DL_IMPL_KERBEROS_REALM_CONFIG_NAME); if (kerberosRealm == null) throw new IOException( "Datalake initialisation requires a kerberos realm to be configured using the fs.dl.impl.kerberosRealm configuration value"); KerberosIdentity kerberosIdentity = new KerberosIdentity(); kerberosIdentity.login(kerberosPrincipal, kerberosKeytab, kerberosRealm); Principal princ = kerberosIdentity.getPrincipal(); LOG.debug("Logged in as " + princ); return kerberosIdentity; }
From source file:com.bigstep.datalake.DLFileSystem.java
License:Apache License
private void initialiseAesEncryption(Configuration conf) throws IOException { String aesKeyPath = conf.get(FS_DL_IMPL_ENCRYPTION_KEY_PATH_CONFIG_NAME); if (this.shouldUseEncryption && aesKeyPath == null) throw new IOException("Datalake encryption is set to true, but no AES key path is provided."); if (aesKeyPath != null) { try {/*from w ww . j a va 2 s .c o m*/ DLEncryptionUtils.getInstance().loadAesKeyFromStringPath(aesKeyPath); } catch (IOException e) { LOG.error(e); throw e; } } else { } }