Review Board 1.7.22


SQOOP-726 Put debugging information into generated SqoopRecord class

Review Request #8234 - Created Nov. 27, 2012 and submitted

Jarek Cecho
SQOOP-726
Reviewers
Sqoop
sqoop-trunk
I've add proposed two fields as a comment entries into generated class.
Tests are passing and I've checked change on real life cluster.

Diff revision 1 (Latest)

  1. src/java/org/apache/sqoop/orm/ClassWriter.java: Loading...
src/java/org/apache/sqoop/orm/ClassWriter.java
Revision f456e9922b46cf45cfa66e8bb1049114c06de55e New Change
[20] 21 lines
[+20]
22
import java.io.FileOutputStream;
22
import java.io.FileOutputStream;
23
import java.io.IOException;
23
import java.io.IOException;
24
import java.io.OutputStream;
24
import java.io.OutputStream;
25
import java.io.OutputStreamWriter;
25
import java.io.OutputStreamWriter;
26
import java.io.Writer;
26
import java.io.Writer;

    
   
27
import java.util.Date;
27
import java.util.HashSet;
28
import java.util.HashSet;
28
import java.util.Map;
29
import java.util.Map;
29
import java.util.Properties;
30
import java.util.Properties;
30
import java.util.Set;
31
import java.util.Set;
31

    
   
32

   
[+20] [20] 367 lines
[+20] [+] private String rpcGetterForMaybeNull(String javaType, String inputObj,
399
        + "    }\n";
400
        + "    }\n";
400
  }
401
  }
401

    
   
402

   
402
  /**
403
  /**
403
   * @param javaType the type to write
404
   * @param javaType the type to write
404
   * @param inputObj the name of the DataOutput to write to
405
   * @param outputObj the name of the DataOutput to write to
405
   * @param colName the column name to write
406
   * @param colName the column name to write
406
   * @return the line of code involving a DataOutput object to write an entry
407
   * @return the line of code involving a DataOutput object to write an entry
407
   * with a given java type.
408
   * with a given java type.
408
   */
409
   */
409
  private String rpcSetterForType(String javaType, String outputObj,
410
  private String rpcSetterForType(String javaType, String outputObj,
[+20] [20] 39 lines
[+20] private String rpcGetterForMaybeNull(String javaType, String inputObj,
449

    
   
450

   
450
  /**
451
  /**
451
   * Serialize a possibly-null value to the DataOutput stream. First a boolean
452
   * Serialize a possibly-null value to the DataOutput stream. First a boolean
452
   * isNull is written, followed by the contents itself (if not null).
453
   * isNull is written, followed by the contents itself (if not null).
453
   * @param javaType name of the type to deserialize if it's not null.
454
   * @param javaType name of the type to deserialize if it's not null.
454
   * @param inputObj name of the DataInput to read from
455
   * @param outputObj name of the DataInput to read from
455
   * @param colName the column name to read.
456
   * @param colName the column name to read.
456
   * @return
457
   * @return
457
   */
458
   */
458
  private String rpcSetterForMaybeNull(String javaType, String outputObj,
459
  private String rpcSetterForMaybeNull(String javaType, String outputObj,
459
      String colName) {
460
      String colName) {
[+20] [20] 789 lines
[+20] [+] private StringBuilder generateClassForColumns(
1249
    if (colNames.length ==0) {
1250
    if (colNames.length ==0) {
1250
      throw new IllegalArgumentException("Attempted to generate class with "
1251
      throw new IllegalArgumentException("Attempted to generate class with "
1251
          + "no columns!");
1252
          + "no columns!");
1252
    }
1253
    }
1253
    StringBuilder sb = new StringBuilder();
1254
    StringBuilder sb = new StringBuilder();
1254
    sb.append("// ORM class for " + tableName + "\n");
1255
    sb.append("// ORM class for table '" + tableName + "'\n");
1255
    sb.append("// WARNING: This class is AUTO-GENERATED. "
1256
    sb.append("// WARNING: This class is AUTO-GENERATED. "
1256
        + "Modify at your own risk.\n");
1257
        + "Modify at your own risk.\n");

    
   
1258
    sb.append("//\n");

    
   
1259
    sb.append("// Debug information:\n");

    
   
1260
    sb.append("// Generated date: " + (new Date()) + "\n");

    
   
1261
    sb.append("// For connector: " + connManager.getClass().getCanonicalName()

    
   
1262
      + "\n");
1257

    
   
1263

   
1258
    TableClassName tableNameInfo = new TableClassName(options);
1264
    TableClassName tableNameInfo = new TableClassName(options);
1259

    
   
1265

   
1260
    String packageName = tableNameInfo.getPackageForTable();
1266
    String packageName = tableNameInfo.getPackageForTable();
1261
    if (null != packageName) {
1267
    if (null != packageName) {
[+20] [20] 65 lines
  1. src/java/org/apache/sqoop/orm/ClassWriter.java: Loading...