List of usage examples for org.apache.hadoop.conf Configuration getClass
public <U> Class<? extends U> getClass(String name, Class<? extends U> defaultValue, Class<U> xface)
name
property as a Class
implementing the interface specified by xface
. From source file:com.marklogic.mapreduce.utilities.InternalUtilities.java
License:Apache License
/** * Get input content source.//from w w w . j a v a2 s .c om * * @param conf job configuration * @param host host to connect to * @return content source * @throws IOException * @throws XccConfigException */ public static ContentSource getInputContentSource(Configuration conf, String host) throws XccConfigException, IOException { String user = conf.get(INPUT_USERNAME, ""); String password = conf.get(INPUT_PASSWORD, ""); String port = conf.get(INPUT_PORT, "8000"); String db = conf.get(INPUT_DATABASE_NAME); int portInt = Integer.parseInt(port); boolean useSsl = conf.getBoolean(INPUT_USE_SSL, false); if (useSsl) { Class<? extends SslConfigOptions> sslOptionClass = conf.getClass(INPUT_SSL_OPTIONS_CLASS, null, SslConfigOptions.class); if (sslOptionClass != null) { SslConfigOptions sslOptions = (SslConfigOptions) ReflectionUtils.newInstance(sslOptionClass, conf); // construct content source return getSecureContentSource(host, portInt, user, password, db, sslOptions); } } return ContentSourceFactory.newContentSource(host, portInt, user, password, db); }
From source file:com.marklogic.mapreduce.utilities.InternalUtilities.java
License:Apache License
/** * Get output content source./* w w w .j av a2s.c om*/ * * @param conf job configuration * @param hostName host name * @return content source * @throws IOException * @throws XccConfigException * @throws IOException */ public static ContentSource getOutputContentSource(Configuration conf, String hostName) throws XccConfigException, IOException { String user = conf.get(OUTPUT_USERNAME, ""); String password = conf.get(OUTPUT_PASSWORD, ""); String port = conf.get(OUTPUT_PORT, "8000"); String db = conf.get(OUTPUT_DATABASE_NAME); int portInt = Integer.parseInt(port); boolean useSsl = conf.getBoolean(OUTPUT_USE_SSL, false); if (useSsl) { Class<? extends SslConfigOptions> sslOptionClass = conf.getClass(OUTPUT_SSL_OPTIONS_CLASS, null, SslConfigOptions.class); if (sslOptionClass != null) { SslConfigOptions sslOptions = (SslConfigOptions) ReflectionUtils.newInstance(sslOptionClass, conf); // construct content source return getSecureContentSource(hostName, portInt, user, password, db, sslOptions); } } return ContentSourceFactory.newContentSource(hostName, portInt, user, password, db); }
From source file:com.marklogic.mapreduce.ValueReader.java
License:Apache License
public ValueReader(Configuration conf) { super(conf);/* w w w.j a v a 2 s . c om*/ valueClass = conf.getClass(INPUT_VALUE_CLASS, Text.class, Writable.class); }
From source file:com.mongodb.hadoop.BSONFileInputFormat.java
License:Apache License
public static PathFilter getInputPathFilter(final JobContext context) { Configuration conf = context.getConfiguration(); Class<?> filterClass = conf.getClass("bson.pathfilter.class", null, PathFilter.class); return filterClass != null ? (PathFilter) ReflectionUtils.newInstance(filterClass, conf) : null; }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends Mapper> getMapper(final Configuration conf) { /** TODO - Support multiple inputs via getClasses ? **/ return conf.getClass(JOB_MAPPER, null, Mapper.class); }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends Reducer> getCombiner(final Configuration conf) { return conf.getClass(JOB_COMBINER, null, Reducer.class); }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends Reducer> getReducer(final Configuration conf) { /** TODO - Support multiple outputs via getClasses ? **/ return conf.getClass(JOB_REDUCER, null, Reducer.class); }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends Partitioner> getPartitioner(final Configuration conf) { return conf.getClass(JOB_PARTITIONER, null, Partitioner.class); }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends RawComparator> getSortComparator(final Configuration conf) { return conf.getClass(JOB_SORT_COMPARATOR, null, RawComparator.class); }
From source file:com.mongodb.hadoop.util.MapredMongoConfigUtil.java
License:Apache License
public static Class<? extends OutputFormat> getOutputFormat(final Configuration conf) { return conf.getClass(JOB_OUTPUT_FORMAT, null, OutputFormat.class); }