Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.connect.update.impl.task
Interface Command

All Known Implementing Classes:
AbstractCommand, Copy, Delete, Deploy, DeployConfig, Flush, FlushCoreCache, FlushJaasCache, Install, LoadJar, ParametrizedCopy, PostInstallCommand, ReloadProperties, Undeploy, UndeployConfig, Uninstall, UnloadJar

public interface Command

An atomic command that can be executed as part of a task. Commands are logged so that they can be rollbacked if needed. A command is assumed to be atomic - so that if anything goes wrong inside the execute method the command will not be rollbacked - only previous commands are rollbacked. If you need to implement a non atomic command then you should take care yourself of the partial rollback if an error occurs during the execution. The generic T represent the task type where this command can be executed

Author:
Bogdan Stefanescu

Method Summary
 String getId()
          The command id
 void initialize(Element element)
          Initialize a command parameters from a DOM element.
 boolean isPostInstall()
          Test if the command must be run at the end in an installation process.
 Command run(org.nuxeo.connect.update.task.Task task, Map<String,String> prefs)
          Execute the command and return the inverse command that can be used to rollback.
 void validate(org.nuxeo.connect.update.task.Task task, org.nuxeo.connect.update.ValidationStatus status)
          Validate if the command can be safely executed on the running platform.
 void writeTo(XmlWriter writer)
          Write the command as XML using the given XmlWriter.
 

Method Detail

isPostInstall

boolean isPostInstall()
Test if the command must be run at the end in an installation process. This is useful for flush like commands that reset application cache. These commands musty be executed at the install/uninstall end. By default the uninstall log is generated by using the inverse of the installation commands executed in the inverse order. This is not good for flush like commands that should always be executed at the end. For example if you have a copy and a flush command in the install.xml the generated uninstall.xml will have a flush and a delete command - but he order is not good since flush should be done at the end. By marking your command as post-install it will be put To implement a post-install command simply override PostInstallCommand.

Returns:

getId

String getId()
The command id

Returns:

run

Command run(org.nuxeo.connect.update.task.Task task,
            Map<String,String> prefs)
            throws org.nuxeo.connect.update.PackageException
Execute the command and return the inverse command that can be used to rollback. Can return null if no rollback command is needed.

Parameters:
task -
Throws:
org.nuxeo.connect.update.PackageException

validate

void validate(org.nuxeo.connect.update.task.Task task,
              org.nuxeo.connect.update.ValidationStatus status)
              throws org.nuxeo.connect.update.PackageException
Validate if the command can be safely executed on the running platform. The command should check if the artifacts it needs to copy or replace are consistent with the command configuration. If inconsistency is detected errors or warnings must be added to the status.

Parameters:
status -
Throws:
org.nuxeo.connect.update.PackageException

initialize

void initialize(Element element)
                throws org.nuxeo.connect.update.PackageException
Initialize a command parameters from a DOM element. This method will be called only once by the task when the commands are loaded from an XML file.

Parameters:
element -
Throws:
org.nuxeo.connect.update.PackageException

writeTo

void writeTo(XmlWriter writer)
Write the command as XML using the given XmlWriter. This method will be called by the task to create an uninstall.xml file.

Parameters:
writer -

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.