Package cz.metacentrum.perun.core.blImpl
Class DatabaseManagerBlImpl
java.lang.Object
cz.metacentrum.perun.core.blImpl.DatabaseManagerBlImpl
- All Implemented Interfaces:
DatabaseManagerBl
Database manager can work with database version and upgraded state of perun DB.
- Author:
- Michal Stava email:<stavamichal@gmail.com>
-
Field Summary
FieldsFields inherited from interface cz.metacentrum.perun.core.bl.DatabaseManagerBl
NAME_OF_ORACLE_ARRAY_METHOD
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createProperty
(String property) Create new property in configurations.getChangelogVersions
(String currentDBVersion, String fileName) Parses all new database versions from DB changelog file and creates from them list of DBVersion objects.Return current database version in string (ex. 3.0.1)Get DB driver information from datasource (name-version)Get DB information from datasource (name-version)Return JDBC template for performing custom simple SQLs where jdbc is not normally availablelong
Get time in ns "nanoseconds" of calling 1 simple update query to DB.protected void
boolean
propertyExists
(String property) Return true if property already exists, false if not.void
updateDatabaseVersion
(List<DBVersion> dbVersions) Method updates database to the current code version.
-
Field Details
-
POSTGRES_CHANGELOG
- See Also:
-
-
Constructor Details
-
DatabaseManagerBlImpl
-
-
Method Details
-
createProperty
Description copied from interface:DatabaseManagerBl
Create new property in configurations. Initial value will be "N/A".- Specified by:
createProperty
in interfaceDatabaseManagerBl
- Parameters:
property
- name of property to be created
-
getChangelogVersions
Description copied from interface:DatabaseManagerBl
Parses all new database versions from DB changelog file and creates from them list of DBVersion objects. The list contains all versions from currentDBVersion (without currentDBVersion itself) to now (the version at the top of the changelog file)- Specified by:
getChangelogVersions
in interfaceDatabaseManagerBl
- Parameters:
currentDBVersion
- current DB versionfileName
- DB changelog file name, file should be in resources- Returns:
- list of DBVersion objects ordered by version descending
-
getCurrentDatabaseVersion
Description copied from interface:DatabaseManagerBl
Return current database version in string (ex. 3.0.1)- Specified by:
getCurrentDatabaseVersion
in interfaceDatabaseManagerBl
- Returns:
- return current database version
-
getDatabaseDriverInformation
Description copied from interface:DatabaseManagerBl
Get DB driver information from datasource (name-version)- Specified by:
getDatabaseDriverInformation
in interfaceDatabaseManagerBl
- Returns:
- string information about database driver
-
getDatabaseInformation
Description copied from interface:DatabaseManagerBl
Get DB information from datasource (name-version)- Specified by:
getDatabaseInformation
in interfaceDatabaseManagerBl
- Returns:
- string information about database
-
getDatabaseManagerImpl
-
getJdbcPerunTemplate
Description copied from interface:DatabaseManagerBl
Return JDBC template for performing custom simple SQLs where jdbc is not normally available- Specified by:
getJdbcPerunTemplate
in interfaceDatabaseManagerBl
- Returns:
- Peruns JDBC template
-
getTimeOfQueryPerformance
public long getTimeOfQueryPerformance()Description copied from interface:DatabaseManagerBl
Get time in ns "nanoseconds" of calling 1 simple update query to DB. This query will update property for this purpose in configurations table.- Specified by:
getTimeOfQueryPerformance
in interfaceDatabaseManagerBl
- Returns:
- time of processing query in nanoseconds
-
initialize
protected void initialize() -
propertyExists
Description copied from interface:DatabaseManagerBl
Return true if property already exists, false if not.- Specified by:
propertyExists
in interfaceDatabaseManagerBl
- Parameters:
property
- name of property to check existence- Returns:
- true if property exists, false if not
-
updateDatabaseVersion
Description copied from interface:DatabaseManagerBl
Method updates database to the current code version. It takes list of dbVersions and executes all the commands from them. Commands from the oldest (lowest) version are executed first.- Specified by:
updateDatabaseVersion
in interfaceDatabaseManagerBl
- Parameters:
dbVersions
- list of dbVersion objects ordered by version descending, should not be empty
-