Package org.exoplatform.commons.upgrade
Class UpgradeProductPlugin
java.lang.Object
org.exoplatform.container.component.BaseComponentPlugin
org.exoplatform.commons.upgrade.UpgradeProductPlugin
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
public abstract class UpgradeProductPlugin
extends org.exoplatform.container.component.BaseComponentPlugin
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanTrue if the upgrade execution should be processed asynchronously else, it will be executed synchronouslyprotected booleanDetermines whether the plugin should be executed once or even version upgrade.static final Stringprotected Stringstatic final Stringprotected StringThe plugin's product maven group identifier, by example: org.exoplatform.portal for gatein.protected StringThe target version of this upgrade Plugin.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.exoplatform.container.component.BaseComponentPlugin
desc, name -
Constructor Summary
ConstructorsConstructorDescriptionUpgradeProductPlugin(org.exoplatform.commons.api.settings.SettingService settingService, org.exoplatform.container.xml.InitParams initParams) UpgradeProductPlugin(org.exoplatform.container.xml.InitParams initParams) -
Method Summary
Modifier and TypeMethodDescriptionvoidExecute some operations synchronously after the execution of processUpgrade method synchronously or asynchronouslyvoidExecute some operations synchronously after the execution of processUpgrade method synchronously or asynchronouslyfinal booleanintfinal inthashCode()booleanbooleanDetermines if the plugin is enabled, this method will be called when adding the plugin to the upgradePlugins list.booleanabstract voidprocessUpgrade(String oldVersion, String newVersion) Proceed to the transparent upgrade, this method will be called if the Product version has changed, which means, it will be called once the stored Product Version and the one declared in ProductInfo are differentbooleanshouldProceedToUpgrade(String newVersion, String previousVersion) This method is called when a new version has been detected to decide whether proceed to upgrade or not.booleanshouldProceedToUpgrade(String newVersion, String previousGroupVersion, UpgradePluginExecutionContext previousUpgradePluginExecution) This method is called when a new version has been detected to decide whether proceed to upgrade or not.voidstoreValueForPlugin(String paramName, String paramValue) Methods inherited from class org.exoplatform.container.component.BaseComponentPlugin
getDescription, getName, setDescription, setName
-
Field Details
-
UPGRADE_COMPLETED_STATUS
- See Also:
-
PRODUCT_GROUP_ID
- See Also:
-
OLD_PRODUCT_GROUP_ID
- See Also:
-
UPGRADE_PLUGIN_ASYNC
- See Also:
-
UPGRADE_PLUGIN_TARGET_PARAMETER
- See Also:
-
UPGRADE_PLUGIN_EXECUTE_ONCE_PARAMETER
- See Also:
-
UPGRADE_PLUGIN_EXECUTION_ORDER
- See Also:
-
UPGRADE_PLUGIN_ENABLE
- See Also:
-
productGroupId
The plugin's product maven group identifier, by example: org.exoplatform.portal for gatein. -
oldProductGroupId
-
targetVersion
The target version of this upgrade Plugin. -
asyncUpgradeExecution
protected boolean asyncUpgradeExecutionTrue if the upgrade execution should be processed asynchronously else, it will be executed synchronously -
executeOnlyOnce
protected boolean executeOnlyOnceDetermines whether the plugin should be executed once or even version upgrade. If true, the method shouldProceedToUpgrade will not be called to test if the Upgrade Plugin should be executed or not.
-
-
Constructor Details
-
UpgradeProductPlugin
public UpgradeProductPlugin(org.exoplatform.commons.api.settings.SettingService settingService, org.exoplatform.container.xml.InitParams initParams) -
UpgradeProductPlugin
public UpgradeProductPlugin(org.exoplatform.container.xml.InitParams initParams)
-
-
Method Details
-
getProductGroupId
-
beforeUpgrade
public void beforeUpgrade()Execute some operations synchronously after the execution of processUpgrade method synchronously or asynchronously -
afterUpgrade
public void afterUpgrade()Execute some operations synchronously after the execution of processUpgrade method synchronously or asynchronously -
isAsyncUpgradeExecution
public boolean isAsyncUpgradeExecution() -
isExecuteOnlyOnce
public boolean isExecuteOnlyOnce() -
getTargetVersion
-
isEnabled
public boolean isEnabled()Determines if the plugin is enabled, this method will be called when adding the plugin to the upgradePlugins list. SeeUpgradeProductService.addUpgradePlugin(UpgradeProductPlugin)- Returns:
- true: if the plugin is enabled: should be added to the upgradePlugins list false: if the plugin is disabled: should not be added to the upgradePlugins list
-
processUpgrade
Proceed to the transparent upgrade, this method will be called if the Product version has changed, which means, it will be called once the stored Product Version and the one declared in ProductInfo are different- Parameters:
oldVersion- the old version that is stored in internal datasourcenewVersion- the new version read from ProductInfo Service
-
shouldProceedToUpgrade
This method is called when a new version has been detected to decide whether proceed to upgrade or not. It should take care that some versions could be skipped while upgrading, i.e: the upgrade could happen when the product is switched from version 1.0 to 1.3.- Parameters:
previousVersion- The previous version of plugin's productnewVersion- The previous version of plugin's product- Returns:
- true: if the plugin should be executed when switching product from previousVersion to newVersion false: if the upgrade isn't necessary
-
shouldProceedToUpgrade
public boolean shouldProceedToUpgrade(String newVersion, String previousGroupVersion, UpgradePluginExecutionContext previousUpgradePluginExecution) This method is called when a new version has been detected to decide whether proceed to upgrade or not. It will test on previous version of artifact, previous version of group and newer version to decide whether to upgrade or not. This method will call shouldProceedToUpgrade(previousVersion, newVersion) to include optional specific check(s).- Parameters:
newVersion- The current version of running serverpreviousGroupVersion- The previous version of plugin's product group (social, portal...) This parameter will be equals to '0' if first time it runs.previousUpgradePluginExecution- The previous version and execution count of plugin (retrieved from last run) This parameter will be null if first time it runs.- Returns:
- true: if the plugin should be executed when switching product from previousVersion to newVersion false: if the upgrade isn't necessary
-
equals
-
hashCode
public final int hashCode() -
getPluginExecutionOrder
public int getPluginExecutionOrder() -
getValue
-
storeValueForPlugin
-