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
FieldsModifier and TypeFieldDescriptionprotected MigrationExtensionPointThe migration extension pointprotected AmetysObjectResolverThe Ametys object resolverprotected VersionsRootHelperThe versions root helper -
Constructor Summary
Constructors -
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 identifiervoidremoveAllVersions(String componentIdentifier, VersionConfiguration configuration) Remove all versions for a component identifiervoidremoveVersion(String componentId, String versionNumber, VersionConfiguration configuration) Removes a stored versionvoidservice(ServiceManager manager) voidsetPluginInfo(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.voidstoreVersion(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:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
Description copied from interface:PluginAwareSets 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:
setPluginInfoin 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:VersionStorageGet the unique identifier- Specified by:
getIdin interfaceVersionStorage- Returns:
- The identifier
-
getVersions
public List<Version> getVersions(String componentId, VersionConfiguration configuration, MigrationEngine.MigrationComponent component) throws MigrationException Description copied from interface:VersionStorageGet the history of all versions for a component identifier- Specified by:
getVersionsin 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:VersionStorageCreate a specific object containing useful data for the handler/storage- Specified by:
createVersionConfigurationin 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:VersionStorageAdd a version- Specified by:
storeVersionin 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:VersionStorageCreates a new version object, used to initialize the migration process. This version is actually NOT stored.
Depending of the context, the createdVersioncould 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:
createVersionin 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:VersionStorageRemoves a stored version- Specified by:
removeVersionin 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:VersionStorageRemove all versions for a component identifier- Specified by:
removeAllVersionsin interfaceVersionStorage- Parameters:
componentIdentifier- component to clearconfiguration- configuration to use- Throws:
MigrationException- Something went wrong
-