Class JcrVersionStorage
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.repository.migration.jcr.JcrVersionStorage
- All Implemented Interfaces:
VersionStorage
,LogEnabled
,PluginAware
,Serviceable
public class JcrVersionStorage
extends AbstractLogEnabled
implements VersionStorage, Serviceable, PluginAware
JCR implementation of
VersionStorage
, to manage the list of versions in a repository-
Field Summary
Modifier and TypeFieldDescriptionprotected MigrationExtensionPoint
The migration extension pointprotected AmetysObjectResolver
The Ametys object resolverprotected VersionsRootHelper
The versions root helper -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateVersion
(String componentId, MigrationEngine.MigrationComponent component, VersionConfiguration storageConfiguration, Map<String, Object> additionalValues) Creates a new version object, used to initialize the migration process.createVersionConfiguration
(Configuration versionConfiguration) Create a specific object containing useful data for the handler/storagegetId()
Get the unique identifiergetVersions
(String componentId, VersionConfiguration configuration, MigrationEngine.MigrationComponent component) Get the history of all versions for a component identifiervoid
removeAllVersions
(String componentIdentifier, VersionConfiguration configuration) Remove all versions for a component identifiervoid
removeVersion
(String componentId, String versionNumber, VersionConfiguration configuration) Removes a stored versionvoid
service
(ServiceManager manager) void
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.void
storeVersion
(Version version) Add a versionMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_resolver
The Ametys object resolver -
_migrationEP
The migration extension point -
_versionsRootHelper
The versions root helper
-
-
Constructor Details
-
JcrVersionStorage
public JcrVersionStorage()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
getId
Description copied from interface:VersionStorage
Get the unique identifier- Specified by:
getId
in interfaceVersionStorage
- Returns:
- The identifier
-
getVersions
public List<Version> getVersions(String componentId, VersionConfiguration configuration, MigrationEngine.MigrationComponent component) throws MigrationException Description copied from interface:VersionStorage
Get the history of all versions for a component identifier- Specified by:
getVersions
in interfaceVersionStorage
- Parameters:
componentId
- the component idconfiguration
- configuration for this storagecomponent
- the context component- Returns:
- list of all versions for this component
- Throws:
MigrationException
- Something went wrong
-
createVersionConfiguration
public VersionConfiguration createVersionConfiguration(Configuration versionConfiguration) throws ConfigurationException, NotMigrableInSafeModeException Description copied from interface:VersionStorage
Create a specific object containing useful data for the handler/storage- Specified by:
createVersionConfiguration
in interfaceVersionStorage
- Parameters:
versionConfiguration
- configuration from the plugin.xml- Returns:
- the confuguration object
- Throws:
ConfigurationException
- something wrong in the configurationNotMigrableInSafeModeException
- it it's impossible to configure the versions in safe mode
-
storeVersion
Description copied from interface:VersionStorage
Add a version- Specified by:
storeVersion
in interfaceVersionStorage
- Parameters:
version
- Version to store (contains the component identifier)- Throws:
MigrationException
- Something went wrong
-
createVersion
public Version createVersion(String componentId, MigrationEngine.MigrationComponent component, VersionConfiguration storageConfiguration, Map<String, Object> additionalValues) throws MigrationExceptionDescription copied from interface:VersionStorage
Creates a new version object, used to initialize the migration process. This version is actually NOT stored.
Depending of the context, the createdVersion
could have the "0" number (ie. all actions should be executed), ornull
number (ie. only initialization action should be executed and the actual version number set to the highest available).- Specified by:
createVersion
in interfaceVersionStorage
- Parameters:
componentId
- the component idcomponent
- the context componentstorageConfiguration
- configuration for this storageadditionalValues
- all specific values used by upgrade actions- Returns:
- the newly created Version
- Throws:
MigrationException
- Impossible to create the version
-
removeVersion
public void removeVersion(String componentId, String versionNumber, VersionConfiguration configuration) throws MigrationException Description copied from interface:VersionStorage
Removes a stored version- Specified by:
removeVersion
in interfaceVersionStorage
- Parameters:
componentId
- the componentversionNumber
- the version to removeconfiguration
- the associated configuration- Throws:
MigrationException
- Something went wrong
-
removeAllVersions
public void removeAllVersions(String componentIdentifier, VersionConfiguration configuration) throws MigrationException Description copied from interface:VersionStorage
Remove all versions for a component identifier- Specified by:
removeAllVersions
in interfaceVersionStorage
- Parameters:
componentIdentifier
- component to clearconfiguration
- configuration to use- Throws:
MigrationException
- Something went wrong
-