OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
com.omnisci.jdbc.OmniSciConnection.Connection_properties Class Reference
+ Inheritance diagram for com.omnisci.jdbc.OmniSciConnection.Connection_properties:
+ Collaboration diagram for com.omnisci.jdbc.OmniSciConnection.Connection_properties:

Public Member Functions

 Connection_properties (Properties properties, String connection_url)
 

Protected Attributes

boolean parm_warning = false
 

Package Functions

boolean isHttpProtocol ()
 
boolean isHttpsProtocol_insecure ()
 
boolean isHttpsProtocol ()
 
boolean isBinary ()
 
boolean isBinary_tls ()
 
boolean containsTrustStore ()
 

Package Attributes

EnumMap< Connection_enums,
Param_pair
connection_map
 

Private Member Functions

void validate_params ()
 

Detailed Description

Definition at line 148 of file OmniSciConnection.java.

Constructor & Destructor Documentation

com.omnisci.jdbc.OmniSciConnection.Connection_properties.Connection_properties ( Properties  properties,
String  connection_url 
)
inline

Definition at line 175 of file OmniSciConnection.java.

References com.omnisci.jdbc.OmniSciConnection.Connection_properties.connection_map, com.omnisci.jdbc.Param_pair.index, run_benchmark_import.label, com.omnisci.jdbc.OmniSciConnection.Connection_properties.parm_warning, and com.omnisci.jdbc.OmniSciConnection.Connection_properties.validate_params().

175  {
176  super();
177  String[] url_values = connection_url.split(":");
178 
179  // Look for all possible properties values
180  for (Connection_enums enum_key : connection_map.keySet()) {
181  // Get each entry - a string to index the properties param (such as host_name
182  // and an int to index it into the URL, such as 5 for host_name.
183  // index will be greater than 99 if the value shouldn't be expected in the URL
184  Param_pair param_pair = connection_map.get(enum_key);
185  String value_from_prop = null;
186  String value_from_url = null;
187  // if the index is inside the range of the URL then grab the value
188  if (param_pair.index < url_values.length) {
189  value_from_url = url_values[param_pair.index];
190  }
191 
192  // Grab the possible value from the properties variable, using the already
193  // obtained value_from_url as the default if the entry isn't in properties
194  // (note value_from_url could still be null in which case value_from_prop will
195  // be null)
196  value_from_prop = properties.getProperty(param_pair.label, value_from_url);
197  if (value_from_url != null && value_from_prop != null) {
198  if (!value_from_prop.equals(value_from_url)) {
199  logger.warn("Connected property in url[" + value_from_url
200  + "] differs from Properties class [" + value_from_prop
201  + "]. Using url version");
202  value_from_prop = value_from_url;
203  parm_warning = true;
204  }
205  }
206  if (value_from_prop != null) this.put(enum_key, value_from_prop);
207  }
208  // Make sure we have all that is needed and in the correct format
209  validate_params();
210  }
EnumMap< Connection_enums, Param_pair > connection_map

+ Here is the call graph for this function:

Member Function Documentation

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.containsTrustStore ( )
inlinepackage
boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.isBinary ( )
inlinepackage

Definition at line 268 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

Referenced by com.omnisci.jdbc.OmniSciConnection.manageConnection().

268  {
269  return (this.containsKey(Connection_enums.protocol)
270  && this.get(Connection_enums.protocol).equals("binary"));
271  }

+ Here is the caller graph for this function:

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.isBinary_tls ( )
inlinepackage

Definition at line 272 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

Referenced by com.omnisci.jdbc.OmniSciConnection.manageConnection().

272  {
273  return (this.containsKey(Connection_enums.protocol)
274  && this.get(Connection_enums.protocol).equals("binary_tls"));
275  }

+ Here is the caller graph for this function:

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.isHttpProtocol ( )
inlinepackage

Definition at line 253 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

Referenced by com.omnisci.jdbc.OmniSciConnection.manageConnection().

253  {
254  return (this.containsKey(Connection_enums.protocol)
255  && this.get(Connection_enums.protocol).equals("http"));
256  }

+ Here is the caller graph for this function:

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.isHttpsProtocol ( )
inlinepackage

Definition at line 263 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

Referenced by com.omnisci.jdbc.OmniSciConnection.manageConnection().

263  {
264  return (this.containsKey(Connection_enums.protocol)
265  && this.get(Connection_enums.protocol).equals("https"));
266  }

+ Here is the caller graph for this function:

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.isHttpsProtocol_insecure ( )
inlinepackage

Definition at line 258 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

258  {
259  return (this.containsKey(Connection_enums.protocol)
260  && this.get(Connection_enums.protocol).equals("https_insecure"));
261  }
void com.omnisci.jdbc.OmniSciConnection.Connection_properties.validate_params ( )
inlineprivate

Definition at line 212 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.host_name, com.omnisci.jdbc.Connection_enums.max_rows, com.omnisci.jdbc.OmniSciConnection.Connection_properties.parm_warning, com.omnisci.jdbc.Connection_enums.port_num, com.omnisci.jdbc.Connection_enums.protocol, com.omnisci.jdbc.OmniSciConnection.protocol_set, com.omnisci.jdbc.Connection_enums.server_trust_store, and com.omnisci.jdbc.Connection_enums.server_trust_store_pwd.

Referenced by com.omnisci.jdbc.OmniSciConnection.Connection_properties.Connection_properties().

212  {
213  // if present remove "//" from front of hostname
214  String hN = (String) this.get(Connection_enums.host_name);
215  if (hN.startsWith("//")) {
216  this.put(Connection_enums.host_name, hN.substring(2));
217  }
218  Integer port_num = Integer.parseInt((String) (this.get(Connection_enums.port_num)));
219  this.put(Connection_enums.port_num, port_num);
220  // Default to binary of no protocol specified
221  String protocol = "binary";
222  if (this.containsKey(Connection_enums.protocol)) {
223  protocol = (String) this.get(Connection_enums.protocol);
224  protocol.toLowerCase();
225  if (!protocol_set.contains(protocol)) {
226  logger.warn("Incorrect protcol [" + protocol
227  + "] supplied. Possible values are [" + protocol_set.toString()
228  + "]. Using binary as default");
229  protocol = "binary";
230  parm_warning = true;
231  }
232  }
233  this.put(Connection_enums.protocol, protocol);
234  if (this.containsKey(Connection_enums.server_trust_store)
235  && !this.containsKey(Connection_enums.server_trust_store_pwd)) {
236  logger.warn("server trust store ["
237  + (String) this.get(Connection_enums.server_trust_store)
238  + " specfied without a password");
239  parm_warning = true;
240  }
241  if (this.containsKey(Connection_enums.server_trust_store_pwd)
242  && !this.containsKey(Connection_enums.server_trust_store)) {
243  logger.warn("server trust store password specified without a keystore file");
244  parm_warning = true;
245  }
246  Integer max_rows = 100000;
247  if (this.containsKey(Connection_enums.max_rows)) {
248  max_rows = Integer.parseInt((String) (this.get(Connection_enums.max_rows)));
249  }
250  this.put(Connection_enums.max_rows, max_rows);
251  }

+ Here is the caller graph for this function:

Member Data Documentation

EnumMap<Connection_enums, Param_pair> com.omnisci.jdbc.OmniSciConnection.Connection_properties.connection_map
package
Initial value:
=
new EnumMap<Connection_enums, Param_pair>(Connection_enums.class) {
{
put(Connection_enums.host_name, new Param_pair("host_name", 2));
put(Connection_enums.port_num, new Param_pair("port_num", 3));
put(Connection_enums.db_name, new Param_pair("db_name", 4));
put(Connection_enums.protocol, new Param_pair("protocol", 5));
put(Connection_enums.server_trust_store,
new Param_pair("server_trust_store", 6));
put(Connection_enums.server_trust_store_pwd,
new Param_pair("server_trust_store_pwd", 7));
put(Connection_enums.pkiauth, new Param_pair("pkiauth", 7));
put(Connection_enums.sslcert, new Param_pair("sslcert", 8));
put(Connection_enums.sslkey, new Param_pair("sslkey", 9));
put(Connection_enums.sslkey_password,
new Param_pair("sslkey_password", 10));
put(Connection_enums.user, new Param_pair("user", 100));
put(Connection_enums.user_passwd, new Param_pair("password", 101));
put(Connection_enums.max_rows, new Param_pair("max_rows", 102));
}
}

Definition at line 150 of file OmniSciConnection.java.

Referenced by com.omnisci.jdbc.OmniSciConnection.Connection_properties.Connection_properties().

boolean com.omnisci.jdbc.OmniSciConnection.Connection_properties.parm_warning = false
protected

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