org.apache.maven.cli
Class App

java.lang.Object
  extended byorg.apache.maven.cli.App

public class App
extends java.lang.Object

The CLI wrapper for controlling MavenSession processes which are encapsulated in the MavenSession bean.

Version:
$Id: App.java,v 1.37.4.25 2004/06/26 14:52:06 dion Exp $
Author:
Jason van Zyl

Field Summary
static java.lang.String POM_FILE_NAME
          Default file name for an XML-based POM.
 
Constructor Summary
App()
          Constructor.
 
Method Summary
protected  void displayGoals()
          Display helpful information regarding all documented goals.
protected  void displayGoals(boolean pluginOnly, java.lang.String plugin)
          Display helpful information regarding all documented goals.
 void doMain(java.lang.String[] args, java.util.Date fullStart)
          Perform main operations in a non-static method.
protected  void exit(int status)
          To allow subclasses stop the app from exiting
protected  java.lang.String format(java.lang.String orig, int width, char pad)
          Produce a formatted/padded string.
protected static java.lang.String formatTime(long ms)
          Format a time string.
protected  org.apache.commons.cli.CommandLine getCli()
          Get the CLI parser.
 MavenJellyContext getRootContext()
          Retrieve the Jelly rootContext.
 void initialize(java.lang.String[] args)
          Perform initialization.
protected  void initializeRootContext()
          Initialize the IO streams.
 void initializeSystemProperties()
          Setup any system properties that have been specified on the CLI.
static void main(java.lang.String[] args)
          Main CLI entry point for MavenSession.
protected  void printConsoleMavenHeader()
          Prints the MavenSession header.
protected  void setCli(org.apache.commons.cli.CommandLine commandLine)
          Set the cli parser.
 void setRootContext(MavenJellyContext rootContext)
          Set Jelly rootContext.
protected  java.lang.String wrapConsoleMessage(java.lang.String msg, int wrapIndent, int lineWidth)
          Nicely wraps a message for console output, using a word BreakIterator instance to determine wrapping breaks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POM_FILE_NAME

public static final java.lang.String POM_FILE_NAME
Default file name for an XML-based POM.

See Also:
Constant Field Values
Constructor Detail

App

public App()
Constructor.

Method Detail

setRootContext

public void setRootContext(MavenJellyContext rootContext)
Set Jelly rootContext.

Parameters:
rootContext - The mavenSession jelly rootContext.

getRootContext

public MavenJellyContext getRootContext()
Retrieve the Jelly rootContext.

Returns:
The Jelly rootContext.

setCli

protected void setCli(org.apache.commons.cli.CommandLine commandLine)
Set the cli parser.

Parameters:
commandLine - The command line parser.

getCli

protected org.apache.commons.cli.CommandLine getCli()
Get the CLI parser.

Returns:
CommandLine The command line parser.

initialize

public void initialize(java.lang.String[] args)
                throws org.apache.commons.cli.ParseException,
                       java.net.MalformedURLException,
                       java.io.IOException
Perform initialization.

Parameters:
args - The command-line arguments.
Throws:
org.apache.commons.cli.ParseException - If there is an error parsing the command-line.
java.io.IOException - If there is an error while reading the project descriptor.
java.net.MalformedURLException - If any of the the URLs denoting the local or remote repositories is malformed.

initializeRootContext

protected void initializeRootContext()
                              throws java.io.IOException
Initialize the IO streams.

Throws:
java.io.IOException - on error creating XML output and handling System.err and out

initializeSystemProperties

public void initializeSystemProperties()
Setup any system properties that have been specified on the CLI.


doMain

public void doMain(java.lang.String[] args,
                   java.util.Date fullStart)
Perform main operations in a non-static method.

Parameters:
args - Arguments passed in from main().
fullStart - Date the mavenSession process was started.

printConsoleMavenHeader

protected void printConsoleMavenHeader()
Prints the MavenSession header.


displayGoals

protected void displayGoals()
Display helpful information regarding all documented goals.


displayGoals

protected void displayGoals(boolean pluginOnly,
                            java.lang.String plugin)
Display helpful information regarding all documented goals.

Parameters:
pluginOnly - show information for the given plugin only
plugin - plugin to show info for

format

protected java.lang.String format(java.lang.String orig,
                                  int width,
                                  char pad)
Produce a formatted/padded string.

Parameters:
orig - The string to format.
width - The width of the resulting formatted string.
pad - The trailing pad character.
Returns:
The formatted string, or the original string if the length is already >= width.

wrapConsoleMessage

protected java.lang.String wrapConsoleMessage(java.lang.String msg,
                                              int wrapIndent,
                                              int lineWidth)
Nicely wraps a message for console output, using a word BreakIterator instance to determine wrapping breaks.

Parameters:
msg - the string message for the console
wrapIndent - the number of characters to indent all lines after the first one
lineWidth - the console width that determines where to wrap
Returns:
the message wrapped for the console

formatTime

protected static java.lang.String formatTime(long ms)
Format a time string.

Parameters:
ms - Duration in ms.
Returns:
String The formatted time string.

main

public static void main(java.lang.String[] args)
Main CLI entry point for MavenSession.

Parameters:
args - CLI arguments.

exit

protected void exit(int status)
To allow subclasses stop the app from exiting

Parameters:
status - the value to exit with


Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.