info.magnolia.module.delta
Class AbstractRepositoryTask

java.lang.Object
  extended by info.magnolia.module.delta.AbstractTask
      extended by info.magnolia.module.delta.AbstractRepositoryTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
AbstractConditionalRepositoryTask, AbstractModuleVersionHandler.ModuleVersionToLatestTask, AbstractNodeBuilderTask, AddFilterBypassTask, AddGroupToGroupTask, AddMimeMappingTask, AddRoleToGroupTask, AllChildrenNodesOperation, ChangeNodeTypesInUserWorkspace, ChangeNodeTypeTask, CopyNodeTask, CopyOrReplaceNodePropertiesTask, CreateNodePathTask, CreateNodeTask, FilterOrderingTask, MoveAndRenamePropertyTask, MoveMagnoliaUsersToRealmFolder, MoveNodeContentTask, MoveNodeTask, OrderNodeAfterTask, OrderNodeBeforeTask, PropertiesImportTask, QueryTask, RemoveMetadataFromExpressionsWorkspace, RemoveNodeTask, RemoveNodeWoChildren, RemovePermissionTask, RemovePropertyTask, ReplaceWrongDialogNodeTypeTask, SetDefaultWorkflowForActivationFlowCommands, SetPropertyTask, UpdateActivationConfigTask, UpdatedDefaultPublicURIWarning

public abstract class AbstractRepositoryTask
extends AbstractTask

An abstract implementation of AbstractTask which simply wraps the execute call in a try/catch block, avoiding many verbose and irrelevant code lines in actual tasks, leaving room for smarter and more interesting exception handling, when they can actually be handled.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Field Summary
 
Fields inherited from class info.magnolia.module.delta.AbstractTask
log
 
Constructor Summary
AbstractRepositoryTask(java.lang.String name, java.lang.String description)
           
 
Method Summary
protected abstract  void doExecute(InstallContext installContext)
           
 void execute(InstallContext installContext)
          A good-citizen task should execute itself responsibly: it should know what to do in case of problems: for instance, fixable or irrelevant issues should usually just be logged used the InstallContext methods, when the user can fix them later on.
 
Methods inherited from class info.magnolia.module.delta.AbstractTask
getDescription, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractRepositoryTask

public AbstractRepositoryTask(java.lang.String name,
                              java.lang.String description)
Method Detail

execute

public void execute(InstallContext installContext)
             throws TaskExecutionException
Description copied from interface: Task
A good-citizen task should execute itself responsibly: it should know what to do in case of problems: for instance, fixable or irrelevant issues should usually just be logged used the InstallContext methods, when the user can fix them later on. The task could also potentially do backups of nodes it needs to modify extensively, so the user could refer to the backups in case of problem. In the event of an unrecoverable issue, the Task could also throw a TaskExecutionException, knowing that will cancel the whole module's installation, update and startup. If a TaskExecutionException must be thrown, keep in mind that the exception message will still be shown to the end user, so try to keep them human readable.

Throws:
TaskExecutionException

doExecute

protected abstract void doExecute(InstallContext installContext)
                           throws javax.jcr.RepositoryException,
                                  TaskExecutionException
Throws:
javax.jcr.RepositoryException
TaskExecutionException


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.