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

org.apache.sqoop.lib
Class SqoopRecord

java.lang.Object
  extended by org.apache.sqoop.lib.SqoopRecord
All Implemented Interfaces:
java.lang.Cloneable, org.apache.hadoop.io.Writable, org.apache.hadoop.mapreduce.lib.db.DBWritable, FieldMappable
Direct Known Subclasses:
SqoopRecord

public abstract class SqoopRecord
extends java.lang.Object
implements java.lang.Cloneable, org.apache.hadoop.mapreduce.lib.db.DBWritable, FieldMappable, org.apache.hadoop.io.Writable

Interface implemented by the classes generated by sqoop's orm.ClassWriter.


Constructor Summary
SqoopRecord()
           
 
Method Summary
 java.lang.Object clone()
           
 void delegate(FieldMapProcessor processor)
          Use the delegate pattern to allow arbitrary processing of the fields of this record.
abstract  int getClassFormatVersion()
          Returns an integer specifying which API format version the generated class conforms to.
 java.util.Map<java.lang.String,java.lang.Object> getFieldMap()
          Returns a map containing all fields of this record.
abstract  void loadLargeObjects(LargeObjectLoader objLoader)
           
abstract  void parse(byte[] s)
           
abstract  void parse(java.nio.ByteBuffer s)
           
abstract  void parse(char[] s)
           
abstract  void parse(java.nio.CharBuffer s)
           
abstract  void parse(java.lang.CharSequence s)
           
abstract  void parse(org.apache.hadoop.io.Text s)
           
 void setField(java.lang.String fieldName, java.lang.Object fieldVal)
          Allows an arbitrary field to be set programmatically to the specified value object.
 java.lang.String toString(boolean useRecordDelim)
          Use the default delimiters, but only append an end-of-record delimiter if useRecordDelim is true.
abstract  java.lang.String toString(DelimiterSet delimiters)
          Format output data according to the specified delimiters.
 java.lang.String toString(DelimiterSet delimiters, boolean useRecordDelim)
          Format the record according to the specified delimiters.
abstract  int write(java.sql.PreparedStatement stmt, int offset)
          Inserts the data in this object into the PreparedStatement, starting at parameter 'offset'.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.mapreduce.lib.db.DBWritable
readFields, write
 
Methods inherited from interface org.apache.hadoop.io.Writable
readFields, write
 

Constructor Detail

SqoopRecord

public SqoopRecord()
Method Detail

parse

public abstract void parse(java.lang.CharSequence s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

parse

public abstract void parse(org.apache.hadoop.io.Text s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

parse

public abstract void parse(byte[] s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

parse

public abstract void parse(char[] s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

parse

public abstract void parse(java.nio.ByteBuffer s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

parse

public abstract void parse(java.nio.CharBuffer s)
                    throws RecordParser.ParseError
Throws:
RecordParser.ParseError

loadLargeObjects

public abstract void loadLargeObjects(LargeObjectLoader objLoader)
                               throws java.sql.SQLException,
                                      java.io.IOException,
                                      java.lang.InterruptedException
Throws:
java.sql.SQLException
java.io.IOException
java.lang.InterruptedException

write

public abstract int write(java.sql.PreparedStatement stmt,
                          int offset)
                   throws java.sql.SQLException
Inserts the data in this object into the PreparedStatement, starting at parameter 'offset'.

Returns:
the number of fields written to the statement.
Throws:
java.sql.SQLException

toString

public abstract java.lang.String toString(DelimiterSet delimiters)
Format output data according to the specified delimiters.


toString

public java.lang.String toString(boolean useRecordDelim)
Use the default delimiters, but only append an end-of-record delimiter if useRecordDelim is true.


toString

public java.lang.String toString(DelimiterSet delimiters,
                                 boolean useRecordDelim)
Format the record according to the specified delimiters. An end-of-record delimiter is optional, and only used if useRecordDelim is true. For use with TextOutputFormat, calling this with useRecordDelim=false may make more sense.


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

getClassFormatVersion

public abstract int getClassFormatVersion()
Returns an integer specifying which API format version the generated class conforms to. Used by internal APIs for backwards compatibility.

Returns:
the API version this class was generated against.

delegate

public void delegate(FieldMapProcessor processor)
              throws java.io.IOException,
                     ProcessingException
Use the delegate pattern to allow arbitrary processing of the fields of this record.

Parameters:
processor - A delegate that operates on this object.
Throws:
java.io.IOException - if the processor encounters an IO error when operating on this object.
ProcessingException - if the FieldMapProcessor encounters a general processing error when operating on this object.

getFieldMap

public java.util.Map<java.lang.String,java.lang.Object> getFieldMap()
Description copied from interface: FieldMappable
Returns a map containing all fields of this record.

Specified by:
getFieldMap in interface FieldMappable
Returns:
a map from column names to the object-based values for this record. The map may not be null, though it may be empty.

setField

public void setField(java.lang.String fieldName,
                     java.lang.Object fieldVal)
Allows an arbitrary field to be set programmatically to the specified value object. The value object must match the type expected for the particular field or a RuntimeException will result.

Throws:
java.lang.RuntimeException - if the specified field name does not exist.


Copyright © 2011 The Apache Software Foundation