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

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

Introduction

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

Prototype

public <U> Class<? extends U> getClass(String name, Class<? extends U> defaultValue, Class<U> xface) 

Source Link

Document

Get the value of the name property as a Class implementing the interface specified by xface.

Usage

From source file:org.apache.tez.runtime.library.common.ConfigUtils.java

License:Apache License

public static <K> RawComparator<K> getIntermediateInputKeyComparator(Configuration conf) {
    Class<? extends RawComparator> theClass = conf
            .getClass(TezRuntimeConfiguration.TEZ_RUNTIME_KEY_COMPARATOR_CLASS, null, RawComparator.class);
    if (theClass != null)
        return ReflectionUtils.newInstance(theClass, conf);
    return WritableComparator.get(getIntermediateInputKeyClass(conf).asSubclass(WritableComparable.class));
}

From source file:org.apache.tez.runtime.library.common.ConfigUtils.java

License:Apache License

public static <V> RawComparator<V> getInputKeySecondaryGroupingComparator(Configuration conf) {
    Class<? extends RawComparator> theClass = conf.getClass(
            TezRuntimeConfiguration.TEZ_RUNTIME_KEY_SECONDARY_COMPARATOR_CLASS, null, RawComparator.class);
    if (theClass == null) {
        return getIntermediateInputKeyComparator(conf);
    }//from www  .jav  a2s .c o m

    return ReflectionUtils.newInstance(theClass, conf);
}

From source file:org.apache.tez.util.TestTezMxBeanResourceCalculator.java

License:Apache License

@Before
public void setup() throws Exception {
    Configuration conf = new TezConfiguration();
    conf.set(TezConfiguration.TEZ_TASK_RESOURCE_CALCULATOR_PROCESS_TREE_CLASS,
            TezMxBeanResourceCalculator.class.getName());

    Class<? extends ResourceCalculatorProcessTree> clazz = conf.getClass(
            TezConfiguration.TEZ_TASK_RESOURCE_CALCULATOR_PROCESS_TREE_CLASS, null,
            ResourceCalculatorProcessTree.class);
    resourceCalculator = ResourceCalculatorProcessTree.getResourceCalculatorProcessTree("", clazz, conf);
}

From source file:org.apache.tinkerpop.gremlin.giraph.process.computer.io.GiraphVertexInputFormat.java

License:Apache License

private final void constructor(final Configuration configuration) {
    if (null == this.hadoopGraphInputFormat) {
        this.hadoopGraphInputFormat = ReflectionUtils.newInstance(configuration
                .getClass(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, InputFormat.class, InputFormat.class),
                configuration);/*from  w  ww .j ava2 s  .  co m*/
    }
}

From source file:org.apache.tinkerpop.gremlin.giraph.process.computer.io.GiraphVertexOutputFormat.java

License:Apache License

private final void constructor(final Configuration configuration) {
    if (null == this.hadoopGraphOutputFormat) {
        this.hadoopGraphOutputFormat = ReflectionUtils.newInstance(configuration
                .getClass(Constants.GREMLIN_HADOOP_GRAPH_OUTPUT_FORMAT, OutputFormat.class, OutputFormat.class),
                configuration);//  w ww .  j ava2  s.  c  o  m
    }
}

From source file:org.apache.tinkerpop.gremlin.giraph.structure.io.GiraphVertexOutputFormat.java

License:Apache License

@Override
public void checkOutputSpecs(final JobContext context) throws IOException, InterruptedException {
    final Configuration configuration = context.getConfiguration();
    ReflectionUtils.newInstance(configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_WRITER,
            OutputFormat.class, OutputFormat.class), configuration).checkOutputSpecs(context);
}

From source file:org.apache.tinkerpop.gremlin.giraph.structure.io.GiraphVertexOutputFormat.java

License:Apache License

@Override
public OutputCommitter getOutputCommitter(final TaskAttemptContext context)
        throws IOException, InterruptedException {
    final Configuration configuration = context.getConfiguration();
    return ReflectionUtils.newInstance(configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_WRITER,
            OutputFormat.class, OutputFormat.class), configuration).getOutputCommitter(context);
}

From source file:org.apache.tinkerpop.gremlin.giraph.structure.io.GiraphVertexWriter.java

License:Apache License

@Override
public void initialize(final TaskAttemptContext context) throws IOException, InterruptedException {
    final Configuration configuration = context.getConfiguration();
    this.recordWriter = ReflectionUtils
            .newInstance(configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_WRITER, OutputFormat.class,
                    OutputFormat.class), configuration)
            .getRecordWriter(context);/*w  w w .j  a  v a2 s .  co  m*/
    this.transientComputeKeys = VertexProgramHelper.vertexComputeKeysAsArray(
            ((VertexProgram<?>) VertexProgram.createVertexProgram(EmptyGraph.instance(),
                    ConfUtil.makeApacheConfiguration(configuration))).getVertexComputeKeys().stream()
                            .filter(VertexComputeKey::isTransient).collect(Collectors.toSet()));
}

From source file:org.apache.tinkerpop.gremlin.hadoop.process.computer.GraphFilterInputFormat.java

License:Apache License

@Override
public List<InputSplit> getSplits(final JobContext jobContext) throws IOException, InterruptedException {
    final Configuration configuration = jobContext.getConfiguration();
    return ReflectionUtils.newInstance(
            configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_READER, InputFormat.class, InputFormat.class),
            configuration).getSplits(jobContext);
}

From source file:org.apache.tinkerpop.gremlin.hadoop.process.computer.GraphFilterRecordReader.java

License:Apache License

@Override
public void initialize(final InputSplit inputSplit, final TaskAttemptContext taskAttemptContext)
        throws IOException, InterruptedException {
    final Configuration configuration = taskAttemptContext.getConfiguration();
    final InputFormat<NullWritable, VertexWritable> inputFormat = ReflectionUtils.newInstance(
            configuration.getClass(Constants.GREMLIN_HADOOP_GRAPH_READER, InputFormat.class, InputFormat.class),
            configuration);//from  w ww  . j  a v a  2 s  .  c  o m
    if (!(inputFormat instanceof GraphFilterAware)
            && configuration.get(Constants.GREMLIN_HADOOP_GRAPH_FILTER, null) != null)
        this.graphFilter = VertexProgramHelper.deserialize(ConfUtil.makeApacheConfiguration(configuration),
                Constants.GREMLIN_HADOOP_GRAPH_FILTER);
    this.recordReader = inputFormat.createRecordReader(inputSplit, taskAttemptContext);
    this.recordReader.initialize(inputSplit, taskAttemptContext);
}