org.apache.maven.plugins.help
Class AbstractEffectiveMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugins.help.AbstractHelpMojo
          extended by org.apache.maven.plugins.help.AbstractEffectiveMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
EffectivePomMojo, EffectiveSettingsMojo

public abstract class AbstractEffectiveMojo
extends AbstractHelpMojo

Base class with common utilities to write effective Pom/settings.

Since:
2.1
Version:
$Id: AbstractEffectiveMojo.java 901859 2010-01-21 21:22:59Z dennisl $
Author:
Vincent Siveton

Nested Class Summary
protected static class AbstractEffectiveMojo.SortedProperties
          Properties which provides a sorted keySet().
 
Field Summary
 
Fields inherited from class org.apache.maven.plugins.help.AbstractHelpMojo
LINE_LENGTH, output
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractEffectiveMojo()
           
 
Method Summary
protected static String addMavenNamespace(String effectiveXml, boolean isPom)
          Add a Pom/Settings namespaces to the effective XML content.
protected static void writeComment(XMLWriter writer, String comment)
          Write comments in a normalize way.
protected static void writeHeader(XMLWriter writer)
          Write comments in the Effective POM/settings header.
protected static void writeXmlFile(File output, String content, String encoding)
          Utility method to write an XML content in a given file.
 
Methods inherited from class org.apache.maven.plugins.help.AbstractHelpMojo
writeFile, writeFile
 
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
 

Constructor Detail

AbstractEffectiveMojo

public AbstractEffectiveMojo()
Method Detail

writeXmlFile

protected static void writeXmlFile(File output,
                                   String content,
                                   String encoding)
                            throws IOException
Utility method to write an XML content in a given file.

Parameters:
output - is the wanted output file.
content - contains the XML content to be written to the file.
encoding - is the wanted encoding to use when writing file.
Throws:
IOException - if any
See Also:
if encoding is null.

writeHeader

protected static void writeHeader(XMLWriter writer)
Write comments in the Effective POM/settings header.

Parameters:
writer - not null

writeComment

protected static void writeComment(XMLWriter writer,
                                   String comment)
Write comments in a normalize way.

Parameters:
writer - not null
comment - not null

addMavenNamespace

protected static String addMavenNamespace(String effectiveXml,
                                          boolean isPom)
Add a Pom/Settings namespaces to the effective XML content.

Parameters:
effectiveXml - not null the effective POM or Settings
isPom - if true add the Pom xsd url, otherwise add the settings xsd url.
Returns:
the content of the root element, i.e. <project/> or <settings/> with the Maven namespace or the original effective if an error occurred.
See Also:
POM_XSD_URL, SETTINGS_XSD_URL


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.