org.jomc.cli.commands
Class AbstractJomcToolCommand

Package class diagram package AbstractJomcToolCommand
java.lang.Object
  extended by org.jomc.cli.commands.AbstractCommand
      extended by org.jomc.cli.commands.AbstractModletCommand
          extended by org.jomc.cli.commands.AbstractModelCommand
              extended by org.jomc.cli.commands.AbstractJomcToolCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
AbstractClassFileProcessorCommand, AbstractResourceFileProcessorCommand, AbstractSourceFileProcessorCommand

@Generated(value="org.jomc.tools.SourceFileProcessor 1.2.2",
           comments="See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2")
public abstract class AbstractJomcToolCommand
extends AbstractModelCommand

JOMC CLI JomcTool based command implementation.

Identifier:
JOMC CLI JomcTool Command
Name:
JOMC CLI JomcTool Command
Specifications:
JOMC CLI Command @ 1.0
Abstract:
Yes
Final:
No
Stateless:
No

Version:
1.2.5
Author:
Christian Schulte 1.2

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jomc.cli.commands.AbstractModletCommand
AbstractModletCommand.CommandLineClassLoader
 
Nested classes/interfaces inherited from interface org.jomc.cli.Command
Command.Listener
 
Field Summary
 
Fields inherited from interface org.jomc.cli.Command
STATUS_FAILURE, STATUS_SUCCESS
 
Constructor Summary
AbstractJomcToolCommand()
          Creates a new AbstractJomcToolCommand instance.
 
Method Summary
protected
<T extends JomcTool>
T
createJomcTool(String className, Class<T> type, CommandLine commandLine)
          Creates a new JomcTool object for a given class name and type.
protected
<T> T
createObject(String className, Class<T> type)
          Creates a new object for a given class name and type.
protected  Implementation getImplementation(CommandLine commandLine, Model model)
          Gets the implementation to process from a given model.
protected  Locale getLocale(CommandLine commandLine)
          Gets a locale from a command line.
protected  Module getModule(CommandLine commandLine, Model model)
          Gets the module to process from a given model.
 Options getOptions()
          Gets the options of the command.
protected  Specification getSpecification(CommandLine commandLine, Model model)
          Gets the specification to process from a given model.
protected  boolean isModulesProcessingRequested(CommandLine commandLine)
          Gets a flag indicating that all modules are requested to be processed.
protected  void postExecuteCommand(CommandLine commandLine)
          Called by the execute method after the preExecuteCommand/executeCommand methods even if those methods threw an exception.
 
Methods inherited from class org.jomc.cli.commands.AbstractModelCommand
createModelContext, getModel
 
Methods inherited from class org.jomc.cli.commands.AbstractModletCommand
createTransformer, getDocumentFiles, getModel, log
 
Methods inherited from class org.jomc.cli.commands.AbstractCommand
execute, executeCommand, getAbbreviatedName, getDefaultLogLevel, getExceptionMessage, getListeners, getLogLevel, getLongDescription, getName, getShortDescription, isLoggable, log, preExecuteCommand, setDefaultLogLevel, setLogLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJomcToolCommand

@Generated(value="org.jomc.tools.SourceFileProcessor 1.2.2",
           comments="See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2")
public AbstractJomcToolCommand()
Creates a new AbstractJomcToolCommand instance.

Method Detail

postExecuteCommand

protected void postExecuteCommand(CommandLine commandLine)
                           throws CommandExecutionException
Called by the execute method after the preExecuteCommand/executeCommand methods even if those methods threw an exception.

Overrides:
postExecuteCommand in class AbstractCommand
Parameters:
commandLine - The command line to execute.
Throws:
CommandExecutionException - if executing the command fails.
See Also:
AbstractCommand.execute(org.apache.commons.cli.CommandLine)

createObject

protected <T> T createObject(String className,
                             Class<T> type)
                  throws CommandExecutionException
Creates a new object for a given class name and type.

Type Parameters:
T - The type of the object to create.
Parameters:
className - The name of the class to create an object of.
type - The class of the type of object to create.
Returns:
A new instance of the class with name className.
Throws:
NullPointerException - if className or type is null.
CommandExecutionException - if creating a new object fails.

createJomcTool

protected <T extends JomcTool> T createJomcTool(String className,
                                                Class<T> type,
                                                CommandLine commandLine)
                                     throws CommandExecutionException
Creates a new JomcTool object for a given class name and type.

Type Parameters:
T - The type of the object to create.
Parameters:
commandLine - The CommandLine to configure the new JomcTool object with.
className - The name of the class to create an object of.
type - The class of the type of object to create.
Returns:
A new instance of the class with name className configured using commandLine.
Throws:
NullPointerException - if commandLine, className or type is null.
CommandExecutionException - if creating a new object fails.
See Also:
createObject(java.lang.String, java.lang.Class)

getSpecification

protected final Specification getSpecification(CommandLine commandLine,
                                               Model model)
Gets the specification to process from a given model.

Parameters:
commandLine - The command line specifying the specification to process.
model - The model to get the specification to process from.
Returns:
The specification to process or null.
Throws:
NullPointerException - if commandLine or model is null.

getImplementation

protected final Implementation getImplementation(CommandLine commandLine,
                                                 Model model)
Gets the implementation to process from a given model.

Parameters:
commandLine - The command line specifying the implementation to process.
model - The model to get the implementation to process from.
Returns:
The implementation to process or null.
Throws:
NullPointerException - if commandLine or model is null.

getModule

protected final Module getModule(CommandLine commandLine,
                                 Model model)
Gets the module to process from a given model.

Parameters:
commandLine - The command line specifying the implementation to process.
model - The model to get the module to process from.
Returns:
The module to process or null.
Throws:
NullPointerException - if model is null.

isModulesProcessingRequested

protected final boolean isModulesProcessingRequested(CommandLine commandLine)
Gets a flag indicating that all modules are requested to be processed.

Parameters:
commandLine - The command line to process.
Returns:
true, if processing of all modules is requested; false, else.
Throws:
NullPointerException - if commandLine is null.
See Also:
getSpecification(org.apache.commons.cli.CommandLine, org.jomc.modlet.Model), getImplementation(org.apache.commons.cli.CommandLine, org.jomc.modlet.Model), getModule(org.apache.commons.cli.CommandLine, org.jomc.modlet.Model)

getLocale

protected final Locale getLocale(CommandLine commandLine)
Gets a locale from a command line.

Parameters:
commandLine - The command line to get a locale from.
Returns:
The locale from commandLine or null, if commandLine does not hold options specifying a locale.

getOptions

@Generated(value="org.jomc.tools.SourceFileProcessor 1.2.2",
           comments="See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.2")
public Options getOptions()
Gets the options of the command.

Options:

Specification Implementation
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Classpath Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Country Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Default Template Profile Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Documents Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Implementation Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Indentation String Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Input Encoding Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Language Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Line Separator Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Locale Variant Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI ModelContextFactory Class Name Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Model Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Modlet Location Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Modlet Schema System Id Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Module Location Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Module Name Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI No Classpath Resolution Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI No Model Processing Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI No Model Resource Validation Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI No Modlet Resource Validation Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Output Encoding Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Platform Provider Location Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Provider Location Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Specification Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Template Encoding Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Template Location Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Template Profile Option
JOMC CLI Command Option (org.apache.commons.cli.Option) @ 1.2 JOMC CLI Transformer Location Option

Specified by:
getOptions in interface Command
Overrides:
getOptions in class AbstractModelCommand
Returns:
The options of the command.


Copyright © 2005-2012 The JOMC Project. All Rights Reserved.Get JOMC at SourceForge.net. Fast, secure and Free Open Source software downloads
Please note that this documentation is maintained by non-native english speaking authors. As such, you may encounter phrases or wordings which seem imprecise or may even have a totally different meaning to native english speaking readers than what the individual author was trying to express. If you are a native english speaking reader and find any such phrases or wordings we kindly ask you to send an email to the corresponding author and help us improve this documentation in order to avoid misunderstandings. You will find the authors' email addresses at the top of each class. Please accept our apologies for any inconvenience caused.