Package nz.org.riskscape.postgis
Class PostGISConnectionOptions
java.lang.Object
nz.org.riskscape.postgis.PostGISConnectionOptions
Contains values to use when connecting to the PostGIS database.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetHost()
int
getPort()
getUser()
void
setDatabase
(String database) void
setEnvironment
(Map<String, String> env) void
void
setLocation
(URI fromLocation) Parse the given location as a RiskScape specific-ish postgis URI.void
setPassword
(String password) void
setPort
(int port) void
Get a location URI that is broadly equivalent to point to the same DB.nz.org.riskscape.problem.ResultOrProblems<PostGISConnectionOptions>
validate()
Validate this set of connection options, including any issues with the location (if specified)
-
Field Details
-
URI_SCHEME
URI scheme for RiskScape's postgis URIs
- See Also:
-
ENV_PGPASSWORD
Name of environment variable containing a password
- See Also:
-
DEFAULT_PSQL_PORT
public static final int DEFAULT_PSQL_PORTPostgres listens on this port by default
- See Also:
-
-
Constructor Details
-
PostGISConnectionOptions
public PostGISConnectionOptions()
-
-
Method Details
-
setLocation
Parse the given location as a RiskScape specific-ish postgis URI.
The given URI is expected to be of the form 'postgis://USER[:PASSWORD]@HOST[:PORT]/DATABASE'. Any warnings from parsing the URI are preserved for validation later.
- Parameters:
fromLocation
- to parse
-
setEnvironment
-
validate
Validate this set of connection options, including any issues with the location (if specified)
- Returns:
- this options object, wrapped up with any warnings, if the options are good enough to generate a valid jdbc uri. Will return a failed result if there are missing fields.
-
toJdbcUri
- Returns:
- a uri suitable for use with constructing a JDBC datasource. Note that this might do terrible things if the options are not valid.
-
toLocation
Get a location URI that is broadly equivalent to point to the same DB. Exceptions are that the password is never included, but the port is always included.
-
getLocation
-
getHost
-
setHost
-
getPort
public int getPort() -
setPort
public void setPort(int port) -
getDatabase
-
setDatabase
-
getUser
-
setUser
-
getPassword
-
setPassword
-