OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.mapd.parser.server.CalciteServerCaller Class Reference
+ Collaboration diagram for com.mapd.parser.server.CalciteServerCaller:

Static Public Member Functions

static void main (String[] args)
 

Private Member Functions

void doWork (String[] args)
 
void help (Options options)
 

Private Attributes

SockTransportProperties client_skT = null
 
SockTransportProperties server_skT = null
 
CommandLine cmd = null
 

Static Private Attributes

static final Logger MAPDLOGGER
 

Detailed Description

Definition at line 39 of file CalciteServerCaller.java.

Member Function Documentation

void com.mapd.parser.server.CalciteServerCaller.doWork ( String[]  args)
inlineprivate

Definition at line 51 of file CalciteServerCaller.java.

References run_benchmark_import.args, com.mapd.parser.server.CalciteServerCaller.client_skT, com.mapd.parser.server.CalciteServerCaller.cmd, com.mapd.parser.server.CalciteServerCaller.help(), run_benchmark_import.parser, run_benchmark_import.required, com.mapd.parser.server.CalciteServerCaller.server_skT, com.mapd.parser.server.CalciteServerWrapper.shutdown, and Experimental.String.

51  {
52  CalciteServerWrapper calciteServerWrapper = null;
53 
54  // create Options object
55  Options options = new Options();
56 
57  Option port =
58  Option.builder("p").hasArg().desc("port number").longOpt("port").build();
59 
60  Option ssl_trust_store = Option.builder("T")
61  .hasArg()
62  .desc("SSL_trust_store")
63  .longOpt("trust_store")
64  .build();
65 
66  Option ssl_trust_passwd = Option.builder("P")
67  .hasArg()
68  .desc("SSL_trust_password")
69  .longOpt("trust_store_pw")
70  .build();
71 
72  Option ssl_keystore =
73  Option.builder("Y").hasArg().desc("SSL keystore").longOpt("keystore").build();
74 
75  Option ssl_keystore_password = Option.builder("Z")
76  .hasArg()
77  .desc("SSL keystore password")
78  .longOpt("keystore_password")
79  .build();
80 
81  Option mapdPort = Option.builder("m")
82  .hasArg()
83  .desc("mapd port number")
84  .longOpt("mapd_port")
85  .build();
86 
87  Option data = Option.builder("d")
88  .hasArg()
89  .desc("data directory")
90  .required()
91  .longOpt("data")
92  .build();
93 
94  Option extensions = Option.builder("e")
95  .hasArg()
96  .desc("extension signatures directory")
97  .longOpt("extensions")
98  .build();
99 
100  Option udf_file = Option.builder("u")
101  .hasArg()
102  .desc("User Defined Functions file path")
103  .longOpt("udf")
104  .build();
105 
106  options.addOption(port);
107  options.addOption(data);
108  options.addOption(extensions);
109  options.addOption(mapdPort);
110  options.addOption(ssl_trust_store);
111  options.addOption(ssl_trust_passwd);
112  options.addOption(ssl_keystore);
113  options.addOption(ssl_keystore_password);
114  options.addOption(udf_file);
115 
116  CommandLineParser parser = new DefaultParser();
117 
118  try {
119  cmd = parser.parse(options, args);
120  } catch (ParseException ex) {
121  MAPDLOGGER.error(ex.getLocalizedMessage());
122  help(options);
123  exit(0);
124  }
125 
126  int portNum = Integer.valueOf(cmd.getOptionValue("port", "6279"));
127  int mapdPortNum = Integer.valueOf(cmd.getOptionValue("mapd_port", "6274"));
128  String dataDir = cmd.getOptionValue("data", "data");
129  String extensionsDir = cmd.getOptionValue("extensions", "build/QueryEngine");
130  String trust_store = cmd.getOptionValue("trust_store", "");
131  String trust_store_pw = cmd.getOptionValue("trust_store_pw", "");
132  String key_store = cmd.getOptionValue("keystore", "");
133  String key_store_pw = cmd.getOptionValue("keystore_password", "");
134  String udfName = cmd.getOptionValue("udf", "");
135 
136  final Path extensionFunctionsAstFile =
137  Paths.get(extensionsDir, "ExtensionFunctions.ast");
138 
139  // Add logging to our log files directories
140  Properties p = new Properties();
141  try {
142  p.load(getClass().getResourceAsStream("/log4j.properties"));
143  } catch (IOException ex) {
144  MAPDLOGGER.error(
145  "Could not load log4j property file from resources " + ex.getMessage());
146  }
147  p.put("log.dir", dataDir); // overwrite "log.dir"
148  PropertyConfigurator.configure(p);
149 
150  try {
151  if (trust_store == null || trust_store.isEmpty()) {
152  client_skT = SockTransportProperties.getUnencryptedClient();
153  // client_skT = new SockTransportProperties(load_trust_store);
154  } else {
155  client_skT = SockTransportProperties.getEncryptedClientSpecifiedTrustStore(
156  trust_store, trust_store_pw);
157  }
158 
159  if (key_store != null && !key_store.isEmpty()) {
160  // If suppled a key store load a server transport, otherwise server_skT can stay
161  // as null
162  server_skT = SockTransportProperties.getEncryptedServer(key_store, key_store_pw);
163  } else {
164  server_skT = SockTransportProperties.getUnecryptedServer();
165  }
166  } catch (Exception ex) {
167  MAPDLOGGER.error(
168  "Supplied java trust stored could not be opened " + ex.getMessage());
169  exit(0);
170  }
171 
172  Path udfPath;
173 
174  try {
175  if (!udfName.isEmpty()) {
176  udfPath = Paths.get(udfName);
177  }
178  } catch (FileSystemNotFoundException ex1) {
179  MAPDLOGGER.error("Could not load udf file " + ex1.getMessage());
180  }
181 
182  calciteServerWrapper = new CalciteServerWrapper(portNum,
183  mapdPortNum,
184  dataDir,
185  extensionFunctionsAstFile.toString(),
186  client_skT,
187  server_skT,
188  udfName);
189 
190  while (true) {
191  try {
192  calciteServerWrapper.run();
193  if (calciteServerWrapper.shutdown()) {
194  break;
195  }
196  try {
197  // wait for 4 secs before retry
198  Thread.sleep(4000);
199  } catch (InterruptedException ex) {
200  // noop
201  }
202  } catch (Exception x) {
203  x.printStackTrace();
204  }
205  }
206  }

+ Here is the call graph for this function:

void com.mapd.parser.server.CalciteServerCaller.help ( Options  options)
inlineprivate

Definition at line 208 of file CalciteServerCaller.java.

Referenced by com.mapd.parser.server.CalciteServerCaller.doWork().

208  {
209  // automatically generate the help statement
210  HelpFormatter formatter = new HelpFormatter();
211  formatter.printHelp("CalciteServerCaller", options);
212  }

+ Here is the caller graph for this function:

static void com.mapd.parser.server.CalciteServerCaller.main ( String[]  args)
inlinestatic

Definition at line 46 of file CalciteServerCaller.java.

References run_benchmark_import.args.

46  {
47  CalciteServerCaller csc = new CalciteServerCaller();
48  csc.doWork(args);
49  }

Member Data Documentation

SockTransportProperties com.mapd.parser.server.CalciteServerCaller.client_skT = null
private
CommandLine com.mapd.parser.server.CalciteServerCaller.cmd = null
private
final Logger com.mapd.parser.server.CalciteServerCaller.MAPDLOGGER
staticprivate
Initial value:
=
LoggerFactory.getLogger(CalciteServerCaller.class)

Definition at line 42 of file CalciteServerCaller.java.

SockTransportProperties com.mapd.parser.server.CalciteServerCaller.server_skT = null
private

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