com.xpn.xwiki.tool.doc
Class AbstractDocumentMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.xpn.xwiki.tool.doc.AbstractDocumentMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AttachMojo

public abstract class AbstractDocumentMojo
extends org.apache.maven.plugin.AbstractMojo

An abstract Mojo that knows how to load a XWikiDocument from XML and to write XML from a XWikiDocument

Version:
$Id: 55cf250f527cfebbe14df6bbf4ea783fff496e8f $

Field Summary
protected  File outputDirectory
          The target directory to write the document back to
protected  File sourceDocument
          The document to perform the update on
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractDocumentMojo()
           
 
Method Summary
protected  XWikiContext createXWikiContext()
           
protected  File getSpaceDirectory(File directory, File document)
          Return the space directory as a File for a given document in a given directory, creating the directories on the fly if the do not exists
protected  XWikiDocument loadFromXML(File file)
          Loads a XWikiDocument from a XML file
protected  void writeToXML(XWikiDocument doc, File file)
          Write a XWiki document to a XML file, without rendering and without versions.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

sourceDocument

protected File sourceDocument
The document to perform the update on


outputDirectory

protected File outputDirectory
The target directory to write the document back to

Constructor Detail

AbstractDocumentMojo

public AbstractDocumentMojo()
                     throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException
Method Detail

createXWikiContext

protected XWikiContext createXWikiContext()
                                   throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

loadFromXML

protected XWikiDocument loadFromXML(File file)
                             throws org.apache.maven.plugin.MojoExecutionException
Loads a XWikiDocument from a XML file

Parameters:
file - the xml file to load
Returns:
the XWiki document loaded from XML
Throws:
org.apache.maven.plugin.MojoExecutionException

writeToXML

protected void writeToXML(XWikiDocument doc,
                          File file)
                   throws org.apache.maven.plugin.MojoExecutionException
Write a XWiki document to a XML file, without rendering and without versions.

Parameters:
doc - the document to write XML for
file - the file to write the document to
Throws:
org.apache.maven.plugin.MojoExecutionException

getSpaceDirectory

protected File getSpaceDirectory(File directory,
                                 File document)
                          throws org.apache.maven.plugin.MojoExecutionException
Return the space directory as a File for a given document in a given directory, creating the directories on the fly if the do not exists

Parameters:
document - the document to get space for
directory - the directory in which the space will be written
Returns:
the space as a File
Throws:
org.apache.maven.plugin.MojoExecutionException


Copyright © 2004–2014 XWiki. All rights reserved.