Coverage Report - org.apache.giraph.io.internal.WrappedEdgeInputFormat
 
Classes in this File Line Coverage Branch Coverage Complexity
WrappedEdgeInputFormat
0%
0/14
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 package org.apache.giraph.io.internal;
 20  
 
 21  
 import org.apache.giraph.io.EdgeInputFormat;
 22  
 import org.apache.giraph.io.EdgeReader;
 23  
 import org.apache.giraph.job.HadoopUtils;
 24  
 import org.apache.hadoop.conf.Configuration;
 25  
 import org.apache.hadoop.io.Writable;
 26  
 import org.apache.hadoop.io.WritableComparable;
 27  
 import org.apache.hadoop.mapreduce.InputSplit;
 28  
 import org.apache.hadoop.mapreduce.JobContext;
 29  
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 30  
 
 31  
 import java.io.DataInput;
 32  
 import java.io.DataOutput;
 33  
 import java.io.IOException;
 34  
 import java.util.List;
 35  
 
 36  
 /**
 37  
  * For internal use only.
 38  
  *
 39  
  * Wraps user set {@link EdgeInputFormat} to make sure proper configuration
 40  
  * parameters are passed around, that user can set parameters in
 41  
  * configuration and they will be available in other methods related to this
 42  
  * format.
 43  
  *
 44  
  * @param <I> Vertex id
 45  
  * @param <E> Edge data
 46  
  */
 47  
 public class WrappedEdgeInputFormat<I extends WritableComparable,
 48  
     E extends Writable> extends EdgeInputFormat<I, E> {
 49  
   /** {@link EdgeInputFormat} which is wrapped */
 50  
   private EdgeInputFormat<I, E> originalInputFormat;
 51  
 
 52  
   /**
 53  
    * Constructor
 54  
    *
 55  
    * @param edgeInputFormat Edge input format to wrap
 56  
    */
 57  
   public WrappedEdgeInputFormat(
 58  0
       EdgeInputFormat<I, E> edgeInputFormat) {
 59  0
     originalInputFormat = edgeInputFormat;
 60  0
   }
 61  
 
 62  
   @Override
 63  
   public void checkInputSpecs(Configuration conf) {
 64  0
     originalInputFormat.checkInputSpecs(getConf());
 65  0
   }
 66  
 
 67  
   @Override
 68  
   public List<InputSplit> getSplits(JobContext context,
 69  
       int minSplitCountHint) throws IOException, InterruptedException {
 70  0
     return originalInputFormat.getSplits(
 71  0
         HadoopUtils.makeJobContext(getConf(), context),
 72  
         minSplitCountHint);
 73  
   }
 74  
 
 75  
   @Override
 76  
   public EdgeReader<I, E> createEdgeReader(InputSplit split,
 77  
       TaskAttemptContext context) throws IOException {
 78  0
     EdgeReader<I, E> edgeReader =
 79  0
         originalInputFormat.createEdgeReader(split,
 80  0
             HadoopUtils.makeTaskAttemptContext(getConf(), context));
 81  0
     return new WrappedEdgeReader<I, E>(edgeReader, getConf());
 82  
   }
 83  
 
 84  
   @Override
 85  
   public void writeInputSplit(InputSplit inputSplit,
 86  
       DataOutput dataOutput) throws IOException {
 87  0
     originalInputFormat.writeInputSplit(inputSplit, dataOutput);
 88  0
   }
 89  
 
 90  
   @Override
 91  
   public InputSplit readInputSplit(
 92  
       DataInput dataInput) throws IOException, ClassNotFoundException {
 93  0
     return originalInputFormat.readInputSplit(dataInput);
 94  
   }
 95  
 }