This project has retired. For details please refer to its Attic page.
HBaseTarget (Apache Crunch 0.9.0 API)

org.apache.crunch.io.hbase
Class HBaseTarget

java.lang.Object
  extended by org.apache.crunch.io.hbase.HBaseTarget
All Implemented Interfaces:
MapReduceTarget, Target
Direct Known Subclasses:
HBaseSourceTarget

public class HBaseTarget
extends Object
implements MapReduceTarget


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.crunch.Target
Target.WriteMode
 
Field Summary
protected  String table
           
 
Constructor Summary
HBaseTarget(String table)
           
 
Method Summary
 boolean accept(OutputHandler handler, PType<?> ptype)
          Checks to see if this Target instance is compatible with the given PType.
<T> SourceTarget<T>
asSourceTarget(PType<T> ptype)
          Attempt to create the SourceTarget type that corresponds to this Target for the given PType, if possible.
 void configureForMapReduce(org.apache.hadoop.mapreduce.Job job, PType<?> ptype, org.apache.hadoop.fs.Path outputPath, String name)
           
 boolean equals(Object other)
           
 Converter<?,?,?,?> getConverter(PType<?> ptype)
          Returns the Converter to use for mapping from the output PCollection into the output values expected by this instance.
 boolean handleExisting(Target.WriteMode strategy, long lastModifiedAt, org.apache.hadoop.conf.Configuration conf)
          Apply the given WriteMode to this Target instance.
 int hashCode()
           
 Target outputConf(String key, String value)
          Adds the given key-value pair to the Configuration instance that is used to write this Target.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

table

protected String table
Constructor Detail

HBaseTarget

public HBaseTarget(String table)
Method Detail

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

accept

public boolean accept(OutputHandler handler,
                      PType<?> ptype)
Description copied from interface: Target
Checks to see if this Target instance is compatible with the given PType.

Specified by:
accept in interface Target
Parameters:
handler - The OutputHandler that is managing the output for the job
ptype - The PType to check
Returns:
True if this Target can write data in the form of the given PType, false otherwise

configureForMapReduce

public void configureForMapReduce(org.apache.hadoop.mapreduce.Job job,
                                  PType<?> ptype,
                                  org.apache.hadoop.fs.Path outputPath,
                                  String name)
Specified by:
configureForMapReduce in interface MapReduceTarget

asSourceTarget

public <T> SourceTarget<T> asSourceTarget(PType<T> ptype)
Description copied from interface: Target
Attempt to create the SourceTarget type that corresponds to this Target for the given PType, if possible. If it is not possible, return null.

Specified by:
asSourceTarget in interface Target
Parameters:
ptype - The PType to use in constructing the SourceTarget
Returns:
A new SourceTarget or null if such a SourceTarget does not exist

outputConf

public Target outputConf(String key,
                         String value)
Description copied from interface: Target
Adds the given key-value pair to the Configuration instance that is used to write this Target. Allows for multiple target outputs to re-use the same config keys with different values when necessary.

Specified by:
outputConf in interface Target

handleExisting

public boolean handleExisting(Target.WriteMode strategy,
                              long lastModifiedAt,
                              org.apache.hadoop.conf.Configuration conf)
Description copied from interface: Target
Apply the given WriteMode to this Target instance.

Specified by:
handleExisting in interface Target
Parameters:
strategy - The strategy for handling existing outputs
conf - The ever-useful Configuration instance
Returns:
true if the target did exist

getConverter

public Converter<?,?,?,?> getConverter(PType<?> ptype)
Description copied from interface: Target
Returns the Converter to use for mapping from the output PCollection into the output values expected by this instance.

Specified by:
getConverter in interface Target
Parameters:
ptype - The PType of the data that is being written to this instance
Returns:
A valid Converter for the output represented by this instance


Copyright © 2014 The Apache Software Foundation. All Rights Reserved.