OmniSciDB  06b3bd477c
 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 147 of file OmniSciConnection.java.

Constructor & Destructor Documentation

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

Definition at line 172 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().

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

References com.omnisci.jdbc.Connection_enums.protocol.

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

260  {
261  return (this.containsKey(Connection_enums.protocol)
262  && this.get(Connection_enums.protocol).equals("binary"));
263  }

+ Here is the caller graph for this function:

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

Definition at line 264 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

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

+ Here is the caller graph for this function:

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

Definition at line 245 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

245  {
246  return (this.containsKey(Connection_enums.protocol)
247  && this.get(Connection_enums.protocol).equals("http"));
248  }

+ Here is the caller graph for this function:

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

Definition at line 255 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

255  {
256  return (this.containsKey(Connection_enums.protocol)
257  && this.get(Connection_enums.protocol).equals("https"));
258  }

+ Here is the caller graph for this function:

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

Definition at line 250 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

250  {
251  return (this.containsKey(Connection_enums.protocol)
252  && this.get(Connection_enums.protocol).equals("https_insecure"));
253  }
void com.omnisci.jdbc.OmniSciConnection.Connection_properties.validate_params ( )
inlineprivate

Definition at line 209 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.host_name, 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().

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

+ 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));
}
}

Definition at line 149 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: