This project has retired. For details please refer to its Attic page.
LargeObjectLoader (Sqoop 1.4.0-incubating API)

org.apache.sqoop.lib
Class LargeObjectLoader

java.lang.Object
  extended by org.apache.sqoop.lib.LargeObjectLoader
All Implemented Interfaces:
java.io.Closeable
Direct Known Subclasses:
LargeObjectLoader

public class LargeObjectLoader
extends java.lang.Object
implements java.io.Closeable

Contains a set of methods which can read db columns from a ResultSet into Java types, and do serialization of these types to/from DataInput/DataOutput for use with Hadoop's Writable implementation. This supports null values for all types. This is a singleton instance class; only one may exist at a time. However, its lifetime is limited to the current TaskInputOutputContext's life.


Field Summary
static long DEFAULT_MAX_LOB_LENGTH
           
static java.lang.String MAX_INLINE_LOB_LEN_KEY
           
 
Constructor Summary
LargeObjectLoader(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path workPath)
          Create a new LargeObjectLoader.
 
Method Summary
 void close()
           
protected  void finalize()
           
 BlobRef readBlobRef(int colNum, java.sql.ResultSet r)
          Actually read a BlobRef instance from the ResultSet and materialize the data either inline or to a file.
 ClobRef readClobRef(int colNum, java.sql.ResultSet r)
          Actually read a ClobRef instance from the ResultSet and materialize the data either inline or to a file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_LOB_LENGTH

public static final long DEFAULT_MAX_LOB_LENGTH
See Also:
Constant Field Values

MAX_INLINE_LOB_LEN_KEY

public static final java.lang.String MAX_INLINE_LOB_LEN_KEY
See Also:
Constant Field Values
Constructor Detail

LargeObjectLoader

public LargeObjectLoader(org.apache.hadoop.conf.Configuration conf,
                         org.apache.hadoop.fs.Path workPath)
                  throws java.io.IOException
Create a new LargeObjectLoader.

Parameters:
conf - the Configuration to use
workPath - the HDFS working directory for this task.
Throws:
java.io.IOException
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

readBlobRef

public BlobRef readBlobRef(int colNum,
                           java.sql.ResultSet r)
                    throws java.io.IOException,
                           java.lang.InterruptedException,
                           java.sql.SQLException
Actually read a BlobRef instance from the ResultSet and materialize the data either inline or to a file.

Parameters:
colNum - the column of the ResultSet's current row to read.
r - the ResultSet to read from.
Returns:
a BlobRef encapsulating the data in this field.
Throws:
java.io.IOException - if an error occurs writing to the FileSystem.
java.sql.SQLException - if an error occurs reading from the database.
java.lang.InterruptedException

readClobRef

public ClobRef readClobRef(int colNum,
                           java.sql.ResultSet r)
                    throws java.io.IOException,
                           java.lang.InterruptedException,
                           java.sql.SQLException
Actually read a ClobRef instance from the ResultSet and materialize the data either inline or to a file.

Parameters:
colNum - the column of the ResultSet's current row to read.
r - the ResultSet to read from.
Returns:
a ClobRef encapsulating the data in this field.
Throws:
java.io.IOException - if an error occurs writing to the FileSystem.
java.sql.SQLException - if an error occurs reading from the database.
java.lang.InterruptedException


Copyright © 2011 The Apache Software Foundation