public class ConnectionParameters
extends java.lang.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(java.lang.String name)
Parses property value as boolean flag.
|
boolean |
getBooleanProperty(java.lang.String name,
boolean defaultValue)
Parses property value as a boolean flag.
|
java.lang.String |
getCatalog() |
java.lang.String |
getCharsetProperty(java.lang.String name)
Parses property value as a charset encoding name.
|
DriverContext |
getContext()
Get a drivers context.
|
java.lang.Integer |
getIntegerProperty(java.lang.String name) |
java.lang.Integer |
getIntegerProperty(java.lang.String name,
int defaultValue)
Returns the value of integer property.
|
java.lang.Number |
getNumberProperty(java.lang.String name,
java.lang.Number defaultValue)
Returns numeric value of the property.
|
java.lang.String |
getPassword()
Optional user password for connection.
|
java.util.Map<java.lang.String,?> |
getProperties()
This method returns properties for connection specified inside <connection> element
|
java.lang.Object |
getProperty(java.lang.String name)
Convenience method which returns property by name.
|
java.net.URL |
getResolvedUrl()
Returns the url property resolved relative to a script location.
|
java.lang.String |
getSchema() |
java.lang.String |
getStringProperty(java.lang.String name)
Returns string value of the property.
|
java.lang.String |
getUrl()
Returns connection URL.
|
java.net.URL |
getUrlProperty(java.lang.String name)
Parses property value as URL parameter.
|
java.util.Map<java.lang.String,java.lang.String> |
getUrlQueryMap()
Convenience method which parses URL string, extracts a query string and returns a map of URL query parameters.
|
java.lang.String |
getUser()
Optional user name for connection.
|
java.lang.String |
toString() |
protected ConnectionParameters()
public ConnectionParameters(ConnectionEl conf, DriverContext context)
conf
- connection declaration element.context
- driver context.public java.util.Map<java.lang.String,?> getProperties()
public java.lang.Object getProperty(java.lang.String name)
name
- property namegetProperties()
public java.lang.String getStringProperty(java.lang.String name)
name
- property name.public java.lang.Integer getIntegerProperty(java.lang.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 java.lang.Integer getIntegerProperty(java.lang.String name) throws ConfigurationException
ConfigurationException
public java.lang.Number getNumberProperty(java.lang.String name, java.lang.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(java.lang.String name) throws ConfigurationException
false
.name
- property name.ConfigurationException
- if property has unrecognized value.getBooleanProperty(String,boolean)
public boolean getBooleanProperty(java.lang.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 java.lang.String getCharsetProperty(java.lang.String name) throws ConfigurationException
name
- property name.ConfigurationException
- if charset name is unsupported.public java.net.URL getUrlProperty(java.lang.String name) throws ConfigurationException
Relative URIs are resolved using a script file location as a base.
name
- property nameConfigurationException
- if URL is malformed.public java.lang.String getUrl()
URL format is arbitrary and specified by Service Provider.
public java.util.Map<java.lang.String,java.lang.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 java.net.URL getResolvedUrl() throws ConfigurationException
ConfigurationException
- if connection URL is malformed or null.public java.lang.String getUser()
public java.lang.String getPassword()
public java.lang.String getSchema()
public java.lang.String getCatalog()
public DriverContext getContext()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © Copyright 2006-2019 The Scriptella Project Team.