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 voiddoExecute(UpgradeContext<T> context) protected voiddoInit(org.apache.commons.configuration2.HierarchicalConfiguration<?> config) voidexecute(UpgradeContext<T> context) Performs a single upgrade operation.voidinit(String currentVersion, String nextVersion, org.apache.commons.configuration2.HierarchicalConfiguration<?> config) Initializes the instance with the given configurationprotected org.springframework.core.io.ResourceloadResource(String path) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetEnabled(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:
setApplicationContextin 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:UpgradeOperationInitializes the instance with the given configuration- Specified by:
initin 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:UpgradeOperationPerforms a single upgrade operation.- Specified by:
executein interfaceUpgradeOperation<T>- Parameters:
context- the upgrade context- Throws:
UpgradeException- if there is any error performing the upgrade
-
doExecute
- Throws:
Exception
-
loadResource
-