Class AbstractTask
- java.lang.Object
-
- org.nuxeo.connect.update.task.standalone.AbstractTask
-
- All Implemented Interfaces:
org.nuxeo.connect.update.task.Task
- Direct Known Subclasses:
CommandsTask
public abstract class AbstractTask extends Object implements org.nuxeo.connect.update.task.Task
- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>
env
A map of environment key/values that can be used in XML install files as variables.static String
ENV_BUNDLES
static String
ENV_CONFIG
static String
ENV_EAR
Set only on JBoss - the EAR root directory pathstatic String
ENV_HOME
static String
ENV_HOSTAPP_NAME
The host application name.static String
ENV_HOSTAPP_VERSION
The host application versionstatic String
ENV_LIB
static String
ENV_SERVER_HOME
static String
ENV_SYSLIB
static String
ENV_TEMPLATES
static String
ENV_TIMESTAMP
protected org.nuxeo.connect.update.LocalPackage
pkg
static String
PKG_ID
static String
PKG_NAME
static String
PKG_ROOT
static String
PKG_VERSION
protected boolean
restart
protected String
serverPathPrefix
protected org.nuxeo.connect.update.PackageUpdateService
service
protected UpdateManager
updateMgr
protected boolean
updateMgrLoaded
-
Constructor Summary
Constructors Constructor Description AbstractTask(org.nuxeo.connect.update.PackageUpdateService pus)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Map<Object,Object>
createContextMap(Map<String,String> params)
protected abstract void
doRollback()
protected abstract void
doRun(Map<String,String> params)
abstract void
doValidate(org.nuxeo.connect.update.ValidationStatus status)
File
getFile(String key)
Get a file given its key in the environment map.org.nuxeo.connect.update.LocalPackage
getPackage()
String
getRelativeFilePath(File file)
UpdateManager
getUpdateManager()
void
initialize(org.nuxeo.connect.update.LocalPackage pkg, boolean restart)
abstract boolean
isInstallTask()
boolean
isRestartRequired()
protected String
loadParametrizedFile(File file, Map<String,String> params)
void
rollback()
protected abstract void
rollbackDone()
void
run(Map<String,String> params)
protected void
saveParams(Map<String,String> params)
void
setRestartRequired(boolean isRestartRequired)
protected abstract void
taskDone()
org.nuxeo.connect.update.ValidationStatus
validate()
protected org.nuxeo.connect.update.LocalPackage
validateInstall(org.nuxeo.connect.update.ValidationStatus status)
-
-
-
Field Detail
-
PKG_ID
public static final String PKG_ID
- See Also:
- Constant Field Values
-
PKG_NAME
public static final String PKG_NAME
- See Also:
- Constant Field Values
-
PKG_VERSION
public static final String PKG_VERSION
- See Also:
- Constant Field Values
-
PKG_ROOT
public static final String PKG_ROOT
- See Also:
- Constant Field Values
-
ENV_HOME
public static final String ENV_HOME
- See Also:
- Constant Field Values
-
ENV_SERVER_HOME
public static final String ENV_SERVER_HOME
- Since:
- 5.5
- See Also:
- Constant Field Values
-
ENV_EAR
public static final String ENV_EAR
Set only on JBoss - the EAR root directory path- See Also:
- Constant Field Values
-
ENV_LIB
public static final String ENV_LIB
- See Also:
- Constant Field Values
-
ENV_SYSLIB
public static final String ENV_SYSLIB
- See Also:
- Constant Field Values
-
ENV_BUNDLES
public static final String ENV_BUNDLES
- See Also:
- Constant Field Values
-
ENV_CONFIG
public static final String ENV_CONFIG
- See Also:
- Constant Field Values
-
ENV_TEMPLATES
public static final String ENV_TEMPLATES
- Since:
- 5.5
- See Also:
- Constant Field Values
-
ENV_TIMESTAMP
public static final String ENV_TIMESTAMP
- See Also:
- Constant Field Values
-
ENV_HOSTAPP_NAME
public static final String ENV_HOSTAPP_NAME
The host application name.
-
ENV_HOSTAPP_VERSION
public static final String ENV_HOSTAPP_VERSION
The host application version
-
restart
protected boolean restart
-
pkg
protected org.nuxeo.connect.update.LocalPackage pkg
-
serverPathPrefix
protected String serverPathPrefix
-
updateMgr
protected UpdateManager updateMgr
-
updateMgrLoaded
protected boolean updateMgrLoaded
-
service
protected org.nuxeo.connect.update.PackageUpdateService service
-
-
Method Detail
-
isInstallTask
public abstract boolean isInstallTask()
-
initialize
public void initialize(org.nuxeo.connect.update.LocalPackage pkg, boolean restart) throws org.nuxeo.connect.update.PackageException
- Specified by:
initialize
in interfaceorg.nuxeo.connect.update.task.Task
- Throws:
org.nuxeo.connect.update.PackageException
-
getFile
public File getFile(String key)
Get a file given its key in the environment map. If no key exists then null is returned.
-
isRestartRequired
public boolean isRestartRequired()
- Specified by:
isRestartRequired
in interfaceorg.nuxeo.connect.update.task.Task
-
getPackage
public org.nuxeo.connect.update.LocalPackage getPackage()
- Specified by:
getPackage
in interfaceorg.nuxeo.connect.update.task.Task
-
loadParametrizedFile
protected String loadParametrizedFile(File file, Map<String,String> params) throws IOException
- Throws:
IOException
-
saveParams
protected void saveParams(Map<String,String> params) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
run
public void run(Map<String,String> params) throws org.nuxeo.connect.update.PackageException
- Specified by:
run
in interfaceorg.nuxeo.connect.update.task.Task
- Throws:
org.nuxeo.connect.update.PackageException
-
getUpdateManager
public UpdateManager getUpdateManager() throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
rollbackDone
protected abstract void rollbackDone() throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
taskDone
protected abstract void taskDone() throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
rollback
public void rollback() throws org.nuxeo.connect.update.PackageException
- Specified by:
rollback
in interfaceorg.nuxeo.connect.update.task.Task
- Throws:
org.nuxeo.connect.update.PackageException
-
setRestartRequired
public void setRestartRequired(boolean isRestartRequired)
- Specified by:
setRestartRequired
in interfaceorg.nuxeo.connect.update.task.Task
-
doRun
protected abstract void doRun(Map<String,String> params) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
doRollback
protected abstract void doRollback() throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
validate
public org.nuxeo.connect.update.ValidationStatus validate() throws org.nuxeo.connect.update.PackageException
- Specified by:
validate
in interfaceorg.nuxeo.connect.update.task.Task
- Throws:
org.nuxeo.connect.update.PackageException
-
doValidate
public abstract void doValidate(org.nuxeo.connect.update.ValidationStatus status) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
validateInstall
protected org.nuxeo.connect.update.LocalPackage validateInstall(org.nuxeo.connect.update.ValidationStatus status) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
-