info.magnolia.module.delta
Class PartialBootstrapTask

java.lang.Object
  extended by info.magnolia.module.delta.AbstractTask
      extended by info.magnolia.module.delta.PartialBootstrapTask
All Implemented Interfaces:
Task

public class PartialBootstrapTask
extends AbstractTask

This task is used to bootstrap a part of a file.

Author:
tmiyar

Constructor Summary
PartialBootstrapTask(String name, String description, String resource, String itemPath)
          Bootstraps fragment of file.
PartialBootstrapTask(String name, String description, String resource, String itemPath, int importUUIDBehavior)
           
PartialBootstrapTask(String name, String description, String resource, String itemPath, String targetResource)
          Bootstraps newly created file.
PartialBootstrapTask(String name, String description, String resource, String itemPath, String targetResource, int importUUIDBehavior)
           
 
Method Summary
protected  void bootstrap(String resourceName, String itemName, int importUUIDBehavior, InputStream stream)
           
 void execute(InstallContext ctx)
          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.
protected  String getItemName()
           
protected  String getItemPath()
           
protected  InputStream getNodeStream(String fileName, String nodePath)
           
protected  String getOutputResourceName(String resource, String itemPath)
           
protected  String getResource()
           
 
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

PartialBootstrapTask

public PartialBootstrapTask(String name,
                            String description,
                            String resource,
                            String itemPath)
Bootstraps fragment of file.

Parameters:
resource - - resource file i.e. /mgnl-bootstrap/standard-templating-kit/dialogs/pages/config.modules.standard-templating-kit.dialogs.pages.article.stkArticleProperties.xml
itemPath - - path in the file of the node you want to bootstrap i.e. /stkArticleProperties/tabCategorization

PartialBootstrapTask

public PartialBootstrapTask(String name,
                            String description,
                            String resource,
                            String itemPath,
                            String targetResource)
Bootstraps newly created file.

Parameters:
resource - - resource file i.e. /mgnl-bootstrap/standard-templating-kit/dialogs/pages/config.modules.standard-templating-kit.dialogs.pages.article.stkArticleProperties.xml
itemPath - - path in the file of the node you want to bootstrap i.e. /stkArticleProperties/tabCategorization
targetResource - - A target bootstrap file name in case you want to bootstrap the file in a different node /mgnl-bootstrap/standard-templating-kit/dialogs/pages/config.modules.standard-templating-kit.dialogs.pages.target.xml

PartialBootstrapTask

public PartialBootstrapTask(String name,
                            String description,
                            String resource,
                            String itemPath,
                            String targetResource,
                            int importUUIDBehavior)

PartialBootstrapTask

public PartialBootstrapTask(String name,
                            String description,
                            String resource,
                            String itemPath,
                            int importUUIDBehavior)
Method Detail

execute

public void execute(InstallContext ctx)
             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

getNodeStream

protected InputStream getNodeStream(String fileName,
                                    String nodePath)

bootstrap

protected void bootstrap(String resourceName,
                         String itemName,
                         int importUUIDBehavior,
                         InputStream stream)
                  throws IOException,
                         javax.jcr.RepositoryException
Throws:
IOException
javax.jcr.RepositoryException

getOutputResourceName

protected String getOutputResourceName(String resource,
                                       String itemPath)

getResource

protected String getResource()

getItemName

protected String getItemName()

getItemPath

protected String getItemPath()


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