Class CommandsTask
- java.lang.Object
-
- org.nuxeo.connect.update.task.standalone.AbstractTask
-
- org.nuxeo.connect.update.task.standalone.CommandsTask
-
- All Implemented Interfaces:
org.nuxeo.connect.update.task.Task
- Direct Known Subclasses:
InstallTask,UninstallTask
public abstract class CommandsTask extends AbstractTask
A command based task.- Author:
- Bogdan Stefanescu
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedList<org.nuxeo.connect.update.task.Command>commandLogThe log is generated in the inverse order of commands to ensure last command is rollbacked first.protected List<org.nuxeo.connect.update.task.Command>commands-
Fields inherited from class org.nuxeo.connect.update.task.standalone.AbstractTask
env, ENV_BUNDLES, ENV_CONFIG, ENV_EAR, ENV_HOME, ENV_HOSTAPP_NAME, ENV_HOSTAPP_VERSION, ENV_LIB, ENV_SERVER_HOME, ENV_SYSLIB, ENV_TEMPLATES, ENV_TIMESTAMP, pkg, PKG_ID, PKG_NAME, PKG_ROOT, PKG_VERSION, restart, serverPathPrefix, service, updateMgr, updateMgrLoaded
-
-
Constructor Summary
Constructors Constructor Description CommandsTask(org.nuxeo.connect.update.PackageUpdateService pus)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddCommand(org.nuxeo.connect.update.task.Command command)Adds a command to this task.protected voiddoRollback()protected voiddoRun(Map<String,String> params)User parameters are not handled by default.voiddoValidate(org.nuxeo.connect.update.ValidationStatus status)protected abstract voidflush()List<org.nuxeo.connect.update.task.Command>getCommandLog()Gets the command log.List<org.nuxeo.connect.update.task.Command>getCommands()Gets the commands to execute.protected abstract FilegetCommandsFile()Get the commands file from where to load commands for this task.voidinitialize(org.nuxeo.connect.update.LocalPackage pkg, boolean restart)protected voidloadCommands()Load the commands of this task given the user parameters.StringparametrizePaths(String content)voidreadLog(Reader reader)voidwriteLog(File file)-
Methods inherited from class org.nuxeo.connect.update.task.standalone.AbstractTask
createContextMap, getFile, getPackage, getRelativeFilePath, getUpdateManager, isInstallTask, isRestartRequired, loadParametrizedFile, rollback, rollbackDone, run, saveParams, setRestartRequired, taskDone, validate, validateInstall
-
-
-
-
Field Detail
-
commands
protected final List<org.nuxeo.connect.update.task.Command> commands
-
commandLog
protected final LinkedList<org.nuxeo.connect.update.task.Command> commandLog
The log is generated in the inverse order of commands to ensure last command is rollbacked first.
-
-
Method Detail
-
getCommandsFile
protected abstract File getCommandsFile() throws org.nuxeo.connect.update.PackageException
Get the commands file from where to load commands for this task.- Throws:
org.nuxeo.connect.update.PackageException
-
initialize
public void initialize(org.nuxeo.connect.update.LocalPackage pkg, boolean restart) throws org.nuxeo.connect.update.PackageException- Specified by:
initializein interfaceorg.nuxeo.connect.update.task.Task- Overrides:
initializein classAbstractTask- Throws:
org.nuxeo.connect.update.PackageException
-
loadCommands
protected void loadCommands() throws org.nuxeo.connect.update.PackageExceptionLoad the commands of this task given the user parameters. The parameter map may be null.- Throws:
org.nuxeo.connect.update.PackageException
-
getCommands
public List<org.nuxeo.connect.update.task.Command> getCommands()
Gets the commands to execute.
-
getCommandLog
public List<org.nuxeo.connect.update.task.Command> getCommandLog()
Gets the command log. These are the commands ran so far.
-
addCommand
public void addCommand(org.nuxeo.connect.update.task.Command command)
Adds a command to this task.
-
doRun
protected void doRun(Map<String,String> params) throws org.nuxeo.connect.update.PackageException
User parameters are not handled by default. You need to implement your own task to do this.- Specified by:
doRunin classAbstractTask- Throws:
org.nuxeo.connect.update.PackageException
-
flush
protected abstract void flush() throws org.nuxeo.connect.update.PackageException- Throws:
org.nuxeo.connect.update.PackageException- Since:
- 5.6
-
doRollback
protected void doRollback() throws org.nuxeo.connect.update.PackageException- Specified by:
doRollbackin classAbstractTask- Throws:
org.nuxeo.connect.update.PackageException
-
doValidate
public void doValidate(org.nuxeo.connect.update.ValidationStatus status) throws org.nuxeo.connect.update.PackageException- Specified by:
doValidatein classAbstractTask- Throws:
org.nuxeo.connect.update.PackageException
-
writeLog
public void writeLog(File file) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
readLog
public void readLog(Reader reader) throws org.nuxeo.connect.update.PackageException
- Throws:
org.nuxeo.connect.update.PackageException
-
-