Review Board 1.7.22


SQOOP-750 Sqoop2: Introduce show option client command

Review Request #8751 - Created Dec. 23, 2012 and submitted

Jarek Cecho
SQOOP-750
Reviewers
Sqoop
sqoop-sqoop2
I've provided "show option" command that allows user to show client options.
Tested on real cluster, no new unit tests provided.
client/src/main/java/org/apache/sqoop/client/shell/ShowCommand.java
Revision 359add94363a575036999c90fe5088b003064844 New Change
[20] 31 lines
[+20] [+] public class ShowCommand extends SqoopCommand
32
  private ShowVersionFunction versionFunction;
32
  private ShowVersionFunction versionFunction;
33
  private ShowConnectorFunction connectorFunction;
33
  private ShowConnectorFunction connectorFunction;
34
  private ShowJobFunction jobFunction;
34
  private ShowJobFunction jobFunction;
35
  private ShowFrameworkFunction frameworkFunction;
35
  private ShowFrameworkFunction frameworkFunction;
36
  private ShowConnectionFunction connectionFunction;
36
  private ShowConnectionFunction connectionFunction;

    
   
37
  private ShowOptionFunction optionFunction;
37

    
   
38

   
38

    
   
39

   
39
  protected ShowCommand(Shell shell) {
40
  protected ShowCommand(Shell shell) {
40
    super(shell, Constants.CMD_SHOW, Constants.CMD_SHOW_SC,
41
    super(shell, Constants.CMD_SHOW, Constants.CMD_SHOW_SC,
41
        new String[] {Constants.FN_SERVER, Constants.FN_VERSION,
42
        new String[] {Constants.FN_SERVER, Constants.FN_VERSION,
42
          Constants.FN_CONNECTOR, Constants.FN_FRAMEWORK,
43
          Constants.FN_CONNECTOR, Constants.FN_FRAMEWORK,
43
          Constants.FN_CONNECTION, Constants.FN_JOB },
44
          Constants.FN_CONNECTION, Constants.FN_JOB, Constants.FN_OPTION },
44
          Constants.PRE_SHOW, Constants.SUF_INFO);
45
          Constants.PRE_SHOW, Constants.SUF_INFO);
45
  }
46
  }
46

    
   
47

   
47
  @SuppressWarnings({ "rawtypes", "unchecked" })
48
  @SuppressWarnings({ "rawtypes", "unchecked" })
48
  @Override
49
  @Override
[+20] [20] 40 lines
[+20] [+] public Object execute(List args) {
89
    } else if (func.equals(Constants.FN_JOB)) {
90
    } else if (func.equals(Constants.FN_JOB)) {
90
      if (jobFunction == null) {
91
      if (jobFunction == null) {
91
        jobFunction = new ShowJobFunction(io);
92
        jobFunction = new ShowJobFunction(io);
92
      }
93
      }
93
      return jobFunction.execute(args);
94
      return jobFunction.execute(args);

    
   
95
    } else if (func.equals(Constants.FN_OPTION)) {

    
   
96
      if (optionFunction == null) {

    
   
97
        optionFunction = new ShowOptionFunction(io);

    
   
98
      }

    
   
99
      return optionFunction.execute(args);
94
    } else {
100
    } else {
95
      throw new SqoopException(ClientError.CLIENT_0002, usageMsg);
101
      throw new SqoopException(ClientError.CLIENT_0002, usageMsg);
96
    }
102
    }
97
  }
103
  }
98
}
104
}
client/src/main/java/org/apache/sqoop/client/shell/ShowOptionFunction.java
New File
 
  1. client/src/main/java/org/apache/sqoop/client/shell/ShowCommand.java: Loading...
  2. client/src/main/java/org/apache/sqoop/client/shell/ShowOptionFunction.java: Loading...