public class DefaultDatabaseDarwinStorage extends AbstractDatabaseStorage implements DarwinStorage
DarwinStorage.SqlScriptStatusdataSource, dbResourceAccessor, jdbcTemplate, resourceAccessor, resourceLoader, transactionManager| Constructor and Description |
|---|
DefaultDatabaseDarwinStorage(ResourceNameAnalyzer resourceNameAnalyzer,
StorageChecker storageChecker) |
| Modifier and Type | Method and Description |
|---|---|
Patch |
getPatchByResourcePath(String resourcePath,
String componentName)
Returns record for the patch by its path and component name in case it exists in database.
|
VersionDescriptor |
getVersionDescriptorForComponent(String componentName)
Returns version descriptor for particular component.
|
void |
insertComponentToDatabase(String componentName)
Inserts information about the component to the database with initial data layer version of 1.0
|
Patch |
insertPatchToDatabase(String patchName,
String componentName,
LocalDateTime detectedOn,
Platform platform)
Inserts patch to db and returns its ID.
|
void |
insertSqlScriptToDB(Patch patch,
SqlCommand sqlCommand)
Inserts information about performed SQL command to database.
|
boolean |
isAnyPatchRecordedFor(String componentName)
Returns true if there is any patch recorded for this component.
|
boolean |
isPatchFinishedInDb(Patch patch)
Tries to find record for the patch in internal database and looks for timestamp
Patch#getFinishedOn() that
signalizes that patch was successfully and entirely applied. |
boolean |
isPatchRecordedByResourcePath(String resourcePath,
String componentName)
Check if the patch by its path and component name in case it exists in database.
|
void |
markPatchAsFinished(Patch patch)
Stores timestamp of the completely and successfully applied patch.
|
void |
updateSqlScriptInDB(Patch patch,
SqlCommand sqlCommand)
Updates information about performed SQL command in database.
|
void |
updateVersionDescriptorForComponent(String componentName,
String version)
Updates version descriptor for particular component.
|
DarwinStorage.SqlScriptStatus |
wasSqlCommandAlreadyExecuted(int patchId,
String script,
int occurrence)
Checks if is sql command was already applied to the database.
|
afterPropertiesSet, getPlatform, setDataSource, setResourceLoaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetResourceAccessorpublic DefaultDatabaseDarwinStorage(ResourceNameAnalyzer resourceNameAnalyzer, StorageChecker storageChecker)
public VersionDescriptor getVersionDescriptorForComponent(String componentName)
DarwinStoragegetVersionDescriptorForComponent in interface DarwinStoragecomponentName - unique identification of the component to retrieve version for.public void updateVersionDescriptorForComponent(String componentName, String version)
DarwinStorageupdateVersionDescriptorForComponent in interface DarwinStoragecomponentName - unique identification of the component for updating versionversion - of the componentpublic void insertSqlScriptToDB(Patch patch, SqlCommand sqlCommand)
DarwinStorageinsertSqlScriptToDB in interface DarwinStoragepatch - file name of the patchsqlCommand - contents of the SQL command inside the patchpublic void updateSqlScriptInDB(Patch patch, SqlCommand sqlCommand)
DarwinStorageupdateSqlScriptInDB in interface DarwinStoragepatch - file name of the patchsqlCommand - contents of the SQL command inside the patchpublic Patch insertPatchToDatabase(String patchName, String componentName, LocalDateTime detectedOn, Platform platform)
DarwinStorageinsertPatchToDatabase in interface DarwinStoragepatchName - file name of the patchcomponentName - unique identification of the component this patch belongs todetectedOn - date and time patch was observed for the first timeplatform - target database platform of the patchpublic void markPatchAsFinished(Patch patch)
DarwinStoragemarkPatchAsFinished in interface DarwinStoragepatch - identificationpublic Patch getPatchByResourcePath(String resourcePath, String componentName)
DarwinStoragegetPatchByResourcePath in interface DarwinStorageresourcePath - platform and name of patch, example mysql/patch_1.1.sqlcomponentName - name of component on which is patch appliedpublic boolean isPatchRecordedByResourcePath(String resourcePath, String componentName)
DarwinStorageisPatchRecordedByResourcePath in interface DarwinStorageresourcePath - platform and name of patch, example mysql/patch_1.1.sqlcomponentName - name of component on which is patch appliedpublic boolean isPatchFinishedInDb(Patch patch)
DarwinStoragePatch#getFinishedOn() that
signalizes that patch was successfully and entirely applied.isPatchFinishedInDb in interface DarwinStoragepatch - identificationpublic boolean isAnyPatchRecordedFor(String componentName)
DarwinStorageisAnyPatchRecordedFor in interface DarwinStoragecomponentName - name of component what we want checkpublic void insertComponentToDatabase(String componentName)
DarwinStorageinsertComponentToDatabase in interface DarwinStoragepublic DarwinStorage.SqlScriptStatus wasSqlCommandAlreadyExecuted(int patchId, String script, int occurrence)
DarwinStoragewasSqlCommandAlreadyExecuted in interface DarwinStoragepatchId - id of the patch this script is part ofscript - SqlCommand#getStatement()occurrence - number of the identical occurence of the same script in the patchCopyright © 2020 FG Forrest, a.s.. All rights reserved.