OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
com.mapd.utility.SQLImporter_args Class Reference
+ Collaboration diagram for com.mapd.utility.SQLImporter_args:

Public Member Functions

CommandLine parse (String[] args) throws ParseException
 

Package Functions

void printVersion ()
 
void printHelpMessage ()
 
 SQLImporter_args ()
 

Private Member Functions

Option setOptionRequired (Option option)
 

Private Attributes

Options options = new Options()
 

Detailed Description

Definition at line 66 of file SQLImporter.java.

Constructor & Destructor Documentation

com.mapd.utility.SQLImporter_args.SQLImporter_args ( )
inlinepackage

Definition at line 99 of file SQLImporter.java.

99  {
100  options.addOption("r", true, "Row Load Limit");
101 
102  // OmniSci authentication options
103  options.addOption(Option.builder("h").desc("help message").longOpt("help").build());
104  options.addOption(
105  Option.builder("u").hasArg().desc("OmniSci User").longOpt("user").build());
106  options.addOption(Option.builder("p")
107  .hasArg()
108  .desc("OmniSci Password")
109  .longOpt("passwd")
110  .build());
111  // OmniSci transport options
112  OptionGroup transport_grp = new OptionGroup();
113  transport_grp.addOption(Option.builder()
114  .desc("use binary transport to connect to OmniSci ")
115  .longOpt("binary")
116  .build());
117  transport_grp.addOption(Option.builder()
118  .desc("use http transport to connect to OmniSci ")
119  .longOpt("http")
120  .build());
121  transport_grp.addOption(Option.builder()
122  .desc("use https transport to connect to OmniSci ")
123  .longOpt("https")
124  .build());
125  options.addOptionGroup(transport_grp);
126 
127  // OmniSci database server details
128  options.addOption(Option.builder("s")
129  .hasArg()
130  .desc("OmniSci Server")
131  .longOpt("server")
132  .build());
133  options.addOption(Option.builder("db")
134  .hasArg()
135  .desc("OmniSci Database")
136  .longOpt("database")
137  .build());
138  options.addOption(
139  Option.builder().hasArg().desc("OmniSci Port").longOpt("port").build());
140 
141  // OmniSci server authentication options
142  options.addOption(Option.builder()
143  .hasArg()
144  .desc("CA certificate trust store")
145  .longOpt("ca-trust-store")
146  .build());
147  options.addOption(Option.builder()
148  .hasArg()
149  .desc("CA certificate trust store password")
150  .longOpt("ca-trust-store-passwd")
151  .build());
152  options.addOption(
153  Option.builder()
154  .desc("Insecure TLS - do not validate server OmniSci server credentials")
155  .longOpt("insecure")
156  .build());
157 
158  // Other database connection details
159  options.addOption(Option.builder("d")
160  .hasArg()
161  .desc("JDBC driver class")
162  .longOpt("driver")
163  .build());
164  options.addOption(Option.builder("c")
165  .hasArg()
166  .desc("JDBC Connection string")
167  .longOpt("jdbcConnect")
168  .required()
169  .build());
170  options.addOption(Option.builder("su")
171  .hasArg()
172  .desc("Source User")
173  .longOpt("sourceUser")
174  .required()
175  .build());
176  options.addOption(Option.builder("sp")
177  .hasArg()
178  .desc("Source Password")
179  .longOpt("sourcePasswd")
180  .required()
181  .build());
182  options.addOption(Option.builder("ss")
183  .hasArg()
184  .desc("SQL Select statement")
185  .longOpt("sqlStmt")
186  .required()
187  .build());
188 
189  options.addOption(Option.builder("t")
190  .hasArg()
191  .desc("OmniSci Target Table")
192  .longOpt("targetTable")
193  .required()
194  .build());
195 
196  options.addOption(Option.builder("b")
197  .hasArg()
198  .desc("transfer buffer size")
199  .longOpt("bufferSize")
200  .build());
201  options.addOption(Option.builder("f")
202  .hasArg()
203  .desc("table fragment size")
204  .longOpt("fragmentSize")
205  .build());
206 
207  options.addOption(Option.builder("tr")
208  .desc("Truncate table if it exists")
209  .longOpt("truncate")
210  .build());
211 
212  options.addOption(Option.builder("i")
213  .hasArg()
214  .desc("File containing init command for DB")
215  .longOpt("initializeFile")
216  .build());
217 
218  options.addOption(
219  Option.builder("adtf")
220  .desc("Allow double to float conversion, note precision will be reduced")
221  .longOpt("AllowDoubleToFloat")
222  .build());
223 
224  options.addOption(
225  Option.builder("nprg")
226  .desc("Do not assign Render Groups to Polygons (faster import, but not renderable)")
227  .longOpt("noPolyRenderGroups")
228  .build());
229  }

Member Function Documentation

CommandLine com.mapd.utility.SQLImporter_args.parse ( String[]  args) throws ParseException
inline

Definition at line 236 of file SQLImporter.java.

References run_benchmark_import.args, com.mapd.utility.SQLImporter_args.options, com.mapd.utility.SQLImporter_args.printHelpMessage(), com.mapd.utility.SQLImporter_args.printVersion(), and com.mapd.utility.SQLImporter_args.setOptionRequired().

236  {
237  CommandLineParser clp = new DefaultParser() {
238  public CommandLine parse(Options options, String[] strings) throws ParseException {
239  Options helpOptions = new Options();
240  helpOptions.addOption(
241  Option.builder("h").desc("help message").longOpt("help").build());
242  try {
243  CommandLine cmd = super.parse(helpOptions, strings);
244  } catch (UnrecognizedOptionException uE) {
245  }
246  if (cmd.hasOption("help")) {
248  exit(0);
249  }
250  if (cmd.hasOption("version")) {
251  printVersion();
252  exit(0);
253  }
254  cmd = super.parse(options, strings);
255  if (!cmd.hasOption("user") && !cmd.hasOption("client-cert")) {
256  throw new MissingArgumentException(
257  "Must supply either an OmniSci db user or a user certificate");
258  }
259  // if user supplied must have password and visa versa
260  if (cmd.hasOption("user") || cmd.hasOption("passwd")) {
261  options.addOption(setOptionRequired(options.getOption("user")));
262  options.addOption(setOptionRequired(options.getOption("passwd")));
263  super.parse(options, strings);
264  }
265 
266  // FUTURE USE FOR USER Auth if user client-cert supplied must have client-key
267  // and
268  // visa versa
269  if (false) {
270  if (cmd.hasOption("client-cert") || cmd.hasOption("client-key")) {
271  options.addOption(setOptionRequired(options.getOption("ca-trust-store")));
272  options.addOption(
273  setOptionRequired(options.getOption("ca-trust-store-password")));
274  super.parse(options, strings);
275  }
276  if (options.getOption("user").isRequired()
277  && options.getOption("client-key").isRequired()) {
278  MutuallyExlusiveOptionsException meo =
279  MutuallyExlusiveOptionsException.create(
280  "user/password can not be use with client-cert/client-key",
281  strings);
282  throw meo;
283  }
284 
285  if (cmd.hasOption("http")
286  || cmd.hasOption("binary")
287  && (cmd.hasOption("client-cert")
288  || cmd.hasOption("client-key"))) {
289  MutuallyExlusiveOptionsException meo = MutuallyExlusiveOptionsException.create(
290  "http|binary can not be use with ca-cert|client-cert|client-key",
291  strings);
292  }
293  }
294 
295  if (cmd.hasOption("insecure") && !cmd.hasOption("https")) {
296  MutuallyExlusiveOptionsException meo = MutuallyExlusiveOptionsException.create(
297  "insecure can only be use with https", strings);
298  throw meo;
299  }
300 
301  return cmd;
302  }
303 
304  public CommandLine parse(Options options, String[] strings, boolean b)
305  throws ParseException {
306  return null;
307  }
308  };
309  return clp.parse(options, args);
310  }
Option setOptionRequired(Option option)
CommandLine parse(String[] args)

+ Here is the call graph for this function:

void com.mapd.utility.SQLImporter_args.printHelpMessage ( )
inlinepackage

Definition at line 73 of file SQLImporter.java.

References com.mapd.utility.SQLImporter_args.options.

Referenced by com.mapd.utility.SQLImporter_args.parse().

73  {
74  StringBuffer sb = new StringBuffer("\nSQLImporter ");
75  // Ready for PKI auth
76  // sb.append("(-u <userid> -p <password> | --client-cert <key store filename>
77  sb.append("-u <userid> -p <password> [(--binary|--http|--https [--insecure])]\n");
78  sb.append("-s <omnisci server host> -db <omnisci db> --port <omnisci server port>\n");
79  // sb.append("([--ca-trust-store <ca trust store file name>]
80  // --ca-trust-store-password
81  // <trust store password> | --insecure)\n");
82  sb.append(
83  "[-d <other database JDBC drive class>] -c <other database JDBC connection string>\n");
84  sb.append(
85  "-su <other database user> -sp <other database user password> -ss <other database sql statement>\n");
86  sb.append(
87  "-t <OmniSci target table> -b <transfer buffer size> -f <table fragment size>\n");
88  sb.append("[-tr] [-adtf] [-nprg] -i <init commands file>\n");
89  sb.append("\nSQLImporter -h | --help\n\n");
90 
91  HelpFormatter formatter = new HelpFormatter();
92  // Forces help to print out options in order they were added rather
93  // than in alphabetical order
94  formatter.setOptionComparator(null);
95  int help_width = 100;
96  formatter.printHelp(help_width, sb.toString(), "", options, "");
97  }

+ Here is the caller graph for this function:

void com.mapd.utility.SQLImporter_args.printVersion ( )
inlinepackage

Definition at line 69 of file SQLImporter.java.

Referenced by com.mapd.utility.SQLImporter_args.parse().

69  {
70  System.out.println("SQLImporter Version 4.6.0");
71  }

+ Here is the caller graph for this function:

Option com.mapd.utility.SQLImporter_args.setOptionRequired ( Option  option)
inlineprivate

Definition at line 231 of file SQLImporter.java.

Referenced by com.mapd.utility.SQLImporter_args.parse().

231  {
232  option.setRequired(true);
233  return option;
234  }

+ Here is the caller graph for this function:

Member Data Documentation

Options com.mapd.utility.SQLImporter_args.options = new Options()
private

The documentation for this class was generated from the following file: