OmniSciDB  04ee39c94c
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 containsTrustStore ()
 

Package Attributes

EnumMap< Connection_enums, Param_pairconnection_map
 

Private Member Functions

void validate_params ()
 

Detailed Description

Definition at line 88 of file OmniSciConnection.java.

Constructor & Destructor Documentation

◆ Connection_properties()

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

Definition at line 106 of file OmniSciConnection.java.

References com.omnisci.jdbc.Param_pair.index, com.omnisci.jdbc.Param_pair.label, and Experimental.String.

106  {
107  super();
108  String[] url_values = connection_url.split(":");
109 
110  // Look for all possible properties values
111  for (Connection_enums enum_key : connection_map.keySet()) {
112  // Get each entry - a string to index the properties param (such as host_name
113  // and an int to index it into the URL, such as 5 for host_name.
114  // index will be greater than 99 if the value shouldn't be expected in the URL
115  Param_pair param_pair = connection_map.get(enum_key);
116  String value_from_prop = null;
117  String value_from_url = null;
118  // if the index is inside the range of the URL then grab the value
119  if (param_pair.index < url_values.length) {
120  value_from_url = url_values[param_pair.index];
121  }
122 
123  // Grab the possible value from the properties variable, using the already
124  // obtained value_from_url as the default if the entry isn't in properties
125  // (note value_from_url could still be null in which case value_from_prop will
126  // be null)
127  value_from_prop = properties.getProperty(param_pair.label, value_from_url);
128  if (value_from_url != null && value_from_prop != null) {
129  if (!value_from_prop.equals(value_from_url)) {
130  logger.warn("Connected property in url[" + value_from_url
131  + "] differs from Properties class [" + value_from_prop
132  + "]. Using url version");
133  value_from_prop = value_from_url;
134  parm_warning = true;
135  }
136  }
137  if (value_from_prop != null) this.put(enum_key, value_from_prop);
138  }
139  // Make sure we have all that is needed and in the correct format
140  validate_params();
141  }
EnumMap< Connection_enums, Param_pair > connection_map

Member Function Documentation

◆ containsTrustStore()

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

Definition at line 198 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.key_store.

198  {
199  return this.containsKey(Connection_enums.key_store);
200  }

◆ isBinary()

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

Definition at line 193 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

193  {
194  return (this.containsKey(Connection_enums.protocol)
195  && this.get(Connection_enums.protocol).equals("binary"));
196  }
+ Here is the caller graph for this function:

◆ isHttpProtocol()

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

Definition at line 178 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

178  {
179  return (this.containsKey(Connection_enums.protocol)
180  && this.get(Connection_enums.protocol).equals("http"));
181  }
+ Here is the caller graph for this function:

◆ isHttpsProtocol()

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

Definition at line 188 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

188  {
189  return (this.containsKey(Connection_enums.protocol)
190  && this.get(Connection_enums.protocol).equals("https"));
191  }
+ Here is the caller graph for this function:

◆ isHttpsProtocol_insecure()

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

Definition at line 183 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.protocol.

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

183  {
184  return (this.containsKey(Connection_enums.protocol)
185  && this.get(Connection_enums.protocol).equals("https_insecure"));
186  }
+ Here is the caller graph for this function:

◆ validate_params()

void com.omnisci.jdbc.OmniSciConnection.Connection_properties.validate_params ( )
inlineprivate

Definition at line 143 of file OmniSciConnection.java.

References com.omnisci.jdbc.Connection_enums.host_name, Integer, com.omnisci.jdbc.Connection_enums.key_store, com.omnisci.jdbc.Connection_enums.key_store_pwd, com.omnisci.jdbc.Connection_enums.port_num, com.omnisci.jdbc.Connection_enums.protocol, and Experimental.String.

143  {
144  // if present remove "//" from front of hostname
145  String hN = (String) this.get(Connection_enums.host_name);
146  if (hN.startsWith("//")) {
147  this.put(Connection_enums.host_name, hN.substring(2));
148  }
149  Integer port_num = Integer.parseInt((String) (this.get(Connection_enums.port_num)));
150  this.put(Connection_enums.port_num, port_num);
151  // Default to binary of no protocol specified
152  String protocol = "binary";
153  if (this.containsKey(Connection_enums.protocol)) {
154  protocol = (String) this.get(Connection_enums.protocol);
155  protocol.toLowerCase();
156  if (!protocol.equals("binary") && !protocol.equals("http")
157  && !protocol.equals("https") && !protocol.equals("https_insecure")) {
158  logger.warn("Incorrect protcol [" + protocol
159  + "] supplied. Possible values are [binary | http | https | https_insecure]. Using binary as default");
160  protocol = "binary";
161  parm_warning = true;
162  }
163  }
164  this.put(Connection_enums.protocol, protocol);
165  if (this.containsKey(Connection_enums.key_store)
166  && !this.containsKey(Connection_enums.key_store_pwd)) {
167  logger.warn("key store [" + (String) this.get(Connection_enums.key_store)
168  + " specfied without a password");
169  parm_warning = true;
170  }
171  if (this.containsKey(Connection_enums.key_store_pwd)
172  && !this.containsKey(Connection_enums.key_store)) {
173  logger.warn("key store password specified without a keystore file");
174  parm_warning = true;
175  }
176  }

Member Data Documentation

◆ connection_map

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.key_store, new Param_pair("key_store", 6));
put(Connection_enums.key_store_pwd, new Param_pair("key_store_pwd", 7));
put(Connection_enums.user, new Param_pair("user", 100));
put(Connection_enums.user_passwd, new Param_pair("password", 101));
}
}

Definition at line 90 of file OmniSciConnection.java.

◆ parm_warning

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

Definition at line 104 of file OmniSciConnection.java.


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