org.codehaus.mojo.webstart.generator
Class AbstractGenerator

java.lang.Object
  extended by org.codehaus.mojo.webstart.generator.AbstractGenerator
Direct Known Subclasses:
ExtensionGenerator, Generator, JarResourcesGenerator

public abstract class AbstractGenerator
extends Object

The abstract superclass for classes that generate the JNLP files produced by the various MOJOs available in the plugin.

Since:
30 Aug 2007
Version:
$Revision:$
Author:
Kevin Stembridge

Constructor Summary
protected AbstractGenerator(org.apache.maven.project.MavenProject mavenProject, File resourceLoaderPath, String defaultTemplateResourceName, File outputFile, String inputFileTemplatePath, String mainClass, String webstartJarURL)
          Creates a new AbstractGenerator.
 
Method Summary
protected  org.apache.velocity.VelocityContext createAndPopulateContext()
          Creates a Velocity context and populates it with replacement values for our pre-defined placeholders.
 void generate()
          Generate the JNLP file.
protected abstract  String getDependenciesText()
          Subclasses must implement this method to return the text that should replace the $dependencies placeholder in the JNLP template.
protected  String indentText(int level, String text)
          Add level space caracteres at the begin of each lines of the given text.
 void setExtraConfig(GeneratorExtraConfig extraConfig)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGenerator

protected AbstractGenerator(org.apache.maven.project.MavenProject mavenProject,
                            File resourceLoaderPath,
                            String defaultTemplateResourceName,
                            File outputFile,
                            String inputFileTemplatePath,
                            String mainClass,
                            String webstartJarURL)
Creates a new AbstractGenerator.

Parameters:
resourceLoaderPath - used to find the template in conjunction to inputFileTemplatePath
outputFile - The location of the file to be generated.
inputFileTemplatePath - relative to resourceLoaderPath
mainClass - The text that should replace the $mainClass placeholder in the JNLP template.
Throws:
IllegalArgumentException - if any argument is null.
Method Detail

setExtraConfig

public void setExtraConfig(GeneratorExtraConfig extraConfig)

generate

public final void generate()
                    throws Exception
Generate the JNLP file.

Throws:
Exception

getDependenciesText

protected abstract String getDependenciesText()
Subclasses must implement this method to return the text that should replace the $dependencies placeholder in the JNLP template.

Returns:
The dependencies text, never null.

createAndPopulateContext

protected org.apache.velocity.VelocityContext createAndPopulateContext()
Creates a Velocity context and populates it with replacement values for our pre-defined placeholders.

Returns:
Returns a velocity context with system and maven properties added

indentText

protected String indentText(int level,
                            String text)
Add level space caracteres at the begin of each lines of the given text.

Parameters:
level - the number of space caracteres to add
text - the text to prefix
Returns:
the indeted text


Copyright © 2005-2009 Codehaus. All Rights Reserved.