Class AbstractUpgradeOperation<T>
java.lang.Object
org.craftercms.commons.upgrade.impl.operations.AbstractUpgradeOperation<T>
- Type Parameters:
T
- The target type supported
- All Implemented Interfaces:
UpgradeOperation<T>
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
UpdateVersionUpgradeOperation
public abstract class AbstractUpgradeOperation<T>
extends Object
implements UpgradeOperation<T>, org.springframework.context.ApplicationContextAware
Base class for all
UpgradeOperation
implementations that provides access to system resources
Supported YAML properties:
- currentVersion: (required) the version number that will be upgraded
- nextVersion (required) the version number to use after the upgrade
- Since:
- 3.1.5
- Author:
- joseross
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
doExecute
(UpgradeContext<T> context) protected void
doInit
(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) void
execute
(UpgradeContext<T> context) Performs a single upgrade operation.void
init
(String currentVersion, String nextVersion, org.apache.commons.configuration2.HierarchicalConfiguration<?> config) Initializes the instance with the given configurationprotected org.springframework.core.io.Resource
loadResource
(String path) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setEnabled
(boolean enabled)
-
Field Details
-
logger
protected org.slf4j.Logger logger -
currentVersion
The current version. -
nextVersion
The next version. -
enabled
protected boolean enabledIndicates if the operation should be executed, true by default -
applicationContext
protected org.springframework.context.ApplicationContext applicationContextThe application context
-
-
Constructor Details
-
AbstractUpgradeOperation
public AbstractUpgradeOperation()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
-
setEnabled
public void setEnabled(boolean enabled) -
init
public void init(String currentVersion, String nextVersion, org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws ConfigurationException Description copied from interface:UpgradeOperation
Initializes the instance with the given configuration- Specified by:
init
in interfaceUpgradeOperation<T>
- Parameters:
currentVersion
- the current versionnextVersion
- the next versionconfig
- the operation configuration- Throws:
ConfigurationException
-
doInit
protected void doInit(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) throws ConfigurationException - Throws:
ConfigurationException
-
execute
Description copied from interface:UpgradeOperation
Performs a single upgrade operation.- Specified by:
execute
in interfaceUpgradeOperation<T>
- Parameters:
context
- the upgrade context- Throws:
UpgradeException
- if there is any error performing the upgrade
-
doExecute
- Throws:
Exception
-
loadResource
-