public class ConnectionParameters extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
ConnectionParameters()
For testing purposes.
|
|
ConnectionParameters(ConnectionEl conf,
DriverContext context)
Creates connection parameters based on <connection> element..
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBooleanProperty(String name)
Parses property value as boolean flag.
|
boolean |
getBooleanProperty(String name,
boolean defaultValue)
Parses property value as a boolean flag.
|
String |
getCatalog() |
String |
getCharsetProperty(String name)
Parses property value as a charset encoding name.
|
DriverContext |
getContext()
Get a drivers context.
|
Integer |
getIntegerProperty(String name) |
Integer |
getIntegerProperty(String name,
int defaultValue)
Returns the value of integer property.
|
Number |
getNumberProperty(String name,
Number defaultValue)
Returns numeric value of the property.
|
String |
getPassword()
Optional user password for connection.
|
Map<String,?> |
getProperties()
This method returns properties for connection specified inside <connection> element
|
Object |
getProperty(String name)
Convenience method which returns property by name.
|
URL |
getResolvedUrl()
Returns the url property resolved relative to a script location.
|
String |
getSchema() |
String |
getStringProperty(String name)
Returns string value of the property.
|
String |
getUrl()
Returns connection URL.
|
URL |
getUrlProperty(String name)
Parses property value as URL parameter.
|
Map<String,String> |
getUrlQueryMap()
Convenience method which parses URL string, extracts a query string and returns a map of URL query parameters.
|
String |
getUser()
Optional user name for connection.
|
String |
toString() |
protected ConnectionParameters()
public ConnectionParameters(ConnectionEl conf, DriverContext context)
conf - connection declaration element.context - driver context.public Map<String,?> getProperties()
public Object getProperty(String name)
name - property namegetProperties()public String getStringProperty(String name)
name - property name.public Integer getIntegerProperty(String name, int defaultValue) throws ConfigurationException
name - name of the property.defaultValue - default value if property is absent.ConfigurationException - if parsing failed.getNumberProperty(String,Number)public Integer getIntegerProperty(String name) throws ConfigurationException
ConfigurationExceptionpublic Number getNumberProperty(String name, Number defaultValue) throws ConfigurationException
Accepts decimal, hexadecimal, and octal numbers if property is String.
name - property name.defaultValue - default value to use when property omitted.ConfigurationException - if parsing failed.Long.decode(String)public boolean getBooleanProperty(String name) throws ConfigurationException
false.name - property name.ConfigurationException - if property has unrecognized value.getBooleanProperty(String,boolean)public boolean getBooleanProperty(String name, boolean defaultValue) throws ConfigurationException
name - property name.defaultValue - default value to use if connection has no such property.ConfigurationException - if property has unrecognized value.public String getCharsetProperty(String name) throws ConfigurationException
name - property name.ConfigurationException - if charset name is unsupported.public URL getUrlProperty(String name) throws ConfigurationException
Relative URIs are resolved using a script file location as a base.
name - property nameConfigurationException - if URL is malformed.public String getUrl()
URL format is arbitrary and specified by Service Provider.
public Map<String,String> getUrlQueryMap()
The query is assumed to have the following syntax: ?param=value¶m2=value¶m3
If parameter is declared twice, only the last value is returned in a map.
If parameter has only a key, but no value part than the returned map would contain key=key mapping, e.g.
jdbc:url?readonly produces a map of 1 entry readonly=readonly.
The drivers may use this method to support overriding connection parameters in an URL string.
public URL getResolvedUrl() throws ConfigurationException
ConfigurationException - if connection URL is malformed or null.public String getUser()
public String getPassword()
public String getSchema()
public String getCatalog()
public DriverContext getContext()
Copyright © 2006-2012. All Rights Reserved.