Class SqlVersionStorage
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.migration.storage.impl.SqlVersionStorage
- All Implemented Interfaces:
VersionStorage
,LogEnabled
,Serviceable
SQL implementation of
VersionStorage
, to manage the list of versions in a database-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_initVersionsTableIfNeeded
(String dataSourceId) Create the versions table if neededvoid
addVersion
(Version version) Add a versiongetAllVersions
(String componentIdentifier, VersionConfiguration versionConfiguration, String versionHandlerId) Get the history of all versions for a component identifiergetConfiguration
(String componentId, Configuration versionConfiguration) Create a specific object containing usefull data for the handler/storagegetCurrentVersion
(String componentIdentifier, VersionConfiguration versionConfiguration, String versionHandlerId) Find the current version for a component identifiervoid
removeAllVersions
(String componentIdentifier, VersionConfiguration versionConfiguration) Remove all versions for a component identifiervoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_sourceResolver
Source resolver
-
-
Constructor Details
-
SqlVersionStorage
public SqlVersionStorage()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getCurrentVersion
public Version getCurrentVersion(String componentIdentifier, VersionConfiguration versionConfiguration, String versionHandlerId) throws MigrationException, NotMigrableInSafeModeException Description copied from interface:VersionStorage
Find the current version for a component identifier- Specified by:
getCurrentVersion
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to look forversionConfiguration
- configuration to useversionHandlerId
- id of theVersionHandler
- Returns:
- the current version for this component (can have a versionId null if no version is found), or null if it is impossible to determine the version (e.g. safe mode).
- Throws:
MigrationException
- Something went wrongNotMigrableInSafeModeException
- Impossible to determine the version
-
getAllVersions
public List<Version> getAllVersions(String componentIdentifier, VersionConfiguration versionConfiguration, String versionHandlerId) throws MigrationException, NotMigrableInSafeModeException Description copied from interface:VersionStorage
Get the history of all versions for a component identifier- Specified by:
getAllVersions
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to look forversionConfiguration
- configuration to useversionHandlerId
- id of theVersionHandler
- Returns:
- list of all versions for this component
- Throws:
MigrationException
- Something went wrongNotMigrableInSafeModeException
- Impossible to determine the version
-
addVersion
Description copied from interface:VersionStorage
Add a version- Specified by:
addVersion
in interfaceVersionStorage
- Parameters:
version
- Version to store (contains the component identifier)- Throws:
MigrationException
- Something went wrong
-
removeAllVersions
public void removeAllVersions(String componentIdentifier, VersionConfiguration versionConfiguration) throws MigrationException Description copied from interface:VersionStorage
Remove all versions for a component identifier- Specified by:
removeAllVersions
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to clearversionConfiguration
- configuration to use- Throws:
MigrationException
- Something went wrong
-
_initVersionsTableIfNeeded
Create the versions table if needed- Parameters:
dataSourceId
- the datasource where the table will be created- Throws:
MigrationException
- Something went wrong
-
getConfiguration
public VersionConfiguration getConfiguration(String componentId, Configuration versionConfiguration) throws ConfigurationException, NotMigrableInSafeModeException Description copied from interface:VersionStorage
Create a specific object containing usefull data for the handler/storage- Specified by:
getConfiguration
in interfaceVersionStorage
- Parameters:
componentId
- id of the componentversionConfiguration
- configuration from the plugin.xml- Returns:
- the confuguration object
- Throws:
ConfigurationException
- something wrong in the configurationNotMigrableInSafeModeException
- Impossible to determine the version
-