Package com.persequor.extension.db
Class SqlDbPropertiesConfig
java.lang.Object
com.persequor.extension.db.SqlDbPropertiesConfig
- All Implemented Interfaces:
ISqlDbConfig
,DbType
This class reads
ISqlDbConfig
from the property file.
Whenever null is returned by any of the getters (e.g. property is not present in a configuration file) , the corresponding SAGA sql connection value will be used instead. You configuration file/environment could contain the following:
{prefix}.username=xxxx {prefix}.password=xxxx {prefix}.address=xxxx:yyyy,xxxx {prefix}.database-name=xxxx
Your own configuration class could look like:
public class ExtraModuleSqlConfig extends SqlDbPropertiesConfig{ @Inject public ExtraModuleSqlConfig() { super("extra-module-prefix"); } @Override public String getDefaultDatabaseName() { return "module_db"; } }
-
Constructor Details
-
SqlDbPropertiesConfig
-
-
Method Details
-
getUsername
- Specified by:
getUsername
in interfaceISqlDbConfig
- Returns:
- return username for the SQL database
-
getPassword
- Specified by:
getPassword
in interfaceISqlDbConfig
- Returns:
- return password for the provided username
-
getAddress
- Specified by:
getAddress
in interfaceISqlDbConfig
- Returns:
- comma separated server address list in form of (host):(port). Example: "myserver:3306,myserver2:3306"
-
getDatabaseName
Description copied from interface:ISqlDbConfig
This must be different from that of SAGA and other SAGA Modules.- Specified by:
getDatabaseName
in interfaceISqlDbConfig
- Returns:
- the unique database/tablespace used by this connection
-
getDatabaseParams
- Specified by:
getDatabaseParams
in interfaceISqlDbConfig
- Returns:
- ampersand (&) separated path parameters of JDBC URL Example: "myParam=true&mySecondParam=aValue"
-
getDefaultDatabaseName
You must return a default database to be used when SAGA is run without configuration files.- Returns:
- the default database to use.
-