org.jomc.cli.commands
Class AbstractJomcCommand

Package class diagram package AbstractJomcCommand
java.lang.Object
  extended by org.jomc.cli.commands.AbstractJomcCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
CommitJavaClassesCommand, GenerateJavaBundlesCommand, ManageJavaSourcesCommand, MergeModulesCommand, ValidateJavaClassesCommand, ValidateModulesCommand

@Generated(value="org.jomc.tools.JavaSources",
           comments="See http://jomc.sourceforge.net/jomc/1.0-alpha-11/jomc-tools")
public abstract class AbstractJomcCommand
extends Object
implements Command

Base JOMC Command implementation.

Specifications

Properties

Dependencies

Messages

Version:
$Id: AbstractJomcCommand.java 1102 2009-12-07 03:01:58Z schulte2005 $
Author:
Christian Schulte 1.0

Nested Class Summary
 
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
AbstractJomcCommand()
          Creates a new AbstractJomcCommand instance.
 
Method Summary
 int execute(org.apache.commons.cli.CommandLine commandLine)
          Executes the command.
protected abstract  int executeCommand(org.apache.commons.cli.CommandLine commandLine)
           
 String getAbbreviatedName()
          Gets the abbreviated name of the command.
protected  ClassLoader getClassLoader(org.apache.commons.cli.CommandLine commandLine)
           
protected  org.apache.commons.cli.Option getClasspathOption()
           
static Level getDefaultLogLevel()
          Gets the default log level events are logged at.
protected  Set<File> getDocumentFiles(org.apache.commons.cli.CommandLine commandLine)
           
protected  org.apache.commons.cli.Option getDocumentsOption()
           
protected  org.jomc.tools.JavaBundles getJavaBundles()
           
protected  org.jomc.tools.JavaClasses getJavaClasses()
           
protected  org.jomc.tools.JavaSources getJavaSources()
           
 List<Command.Listener> getListeners()
          Gets the list of registered listeners.
 Level getLogLevel()
          Gets the log level of the instance.
 String getLongDescription(Locale locale)
          Gets the long description of the command.
protected  org.jomc.model.ModelManager getModelManager()
           
protected  org.jomc.model.ModelObjectValidator getModelObjectValidator()
           
protected  org.apache.commons.cli.Option getModuleLocationOption()
           
protected  org.apache.commons.cli.Option getModuleNameOption()
           
protected  org.jomc.model.Modules getModules(org.apache.commons.cli.CommandLine commandLine)
           
 String getName()
          Gets the name of the command.
protected  org.apache.commons.cli.Option getNoClasspathResolutionOption()
           
 org.apache.commons.cli.Options getOptions()
          Gets the options of the command.
 String getShortDescription(Locale locale)
          Gets the short description of the command.
protected  boolean isLoggable(Level level)
          Checks if a message at a given level is provided to the listeners of the instance.
protected  void log(Level level, String message, Throwable throwable)
          Notifies registered listeners.
protected  void log(org.jomc.model.ModelObjectValidationReport validationReport, javax.xml.bind.Marshaller marshaller)
           
static void setDefaultLogLevel(Level value)
          Sets the default log level events are logged at.
 void setLogLevel(Level value)
          Sets the log level of the instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJomcCommand

@Generated(value="org.jomc.tools.JavaSources",
           comments="See http://jomc.sourceforge.net/jomc/1.0-alpha-11/jomc-tools")
public AbstractJomcCommand()
Creates a new AbstractJomcCommand instance.

Method Detail

getListeners

public List<Command.Listener> getListeners()
Gets the list of registered listeners.

This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the object. This is why there is no set method for the listeners property.

Specified by:
getListeners in interface Command
Returns:
The list of registered listeners.
See Also:
log(java.util.logging.Level, java.lang.String, java.lang.Throwable)

getDefaultLogLevel

public static Level getDefaultLogLevel()
Gets the default log level events are logged at.

The default log level is controlled by system property org.jomc.cli.command.AbstractJomcCommand.defaultLogLevel holding the log level to log events at by default. If that property is not set, the WARNING default is returned.

Returns:
The log level events are logged at by default.
See Also:
getLogLevel(), Level.parse(java.lang.String)

setDefaultLogLevel

public static void setDefaultLogLevel(Level value)
Sets the default log level events are logged at.

Parameters:
value - The new default level events are logged at or null.
See Also:
getDefaultLogLevel()

getLogLevel

public Level getLogLevel()
Gets the log level of the instance.

Specified by:
getLogLevel in interface Command
Returns:
The log level of the instance.
See Also:
getDefaultLogLevel(), setLogLevel(java.util.logging.Level), isLoggable(java.util.logging.Level)

setLogLevel

public void setLogLevel(Level value)
Sets the log level of the instance.

Specified by:
setLogLevel in interface Command
Parameters:
value - The new log level of the instance or null.
See Also:
getLogLevel(), isLoggable(java.util.logging.Level)

getName

public String getName()
Description copied from interface: Command
Gets the name of the command.

Specified by:
getName in interface Command
Returns:
The name of the command.

getAbbreviatedName

public String getAbbreviatedName()
Description copied from interface: Command
Gets the abbreviated name of the command.

Specified by:
getAbbreviatedName in interface Command
Returns:
The abbreviated name of the command.

getShortDescription

public String getShortDescription(Locale locale)
Description copied from interface: Command
Gets the short description of the command.

Specified by:
getShortDescription in interface Command
Parameters:
locale - The locale of the short description to return.
Returns:
The short description of the command.

getLongDescription

public String getLongDescription(Locale locale)
Description copied from interface: Command
Gets the long description of the command.

Specified by:
getLongDescription in interface Command
Parameters:
locale - The locale of the long description to return.
Returns:
The long description of the command.

getOptions

public org.apache.commons.cli.Options getOptions()
Description copied from interface: Command
Gets the options of the command.

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

execute

public final int execute(org.apache.commons.cli.CommandLine commandLine)
Description copied from interface: Command
Executes the command.

Specified by:
execute in interface Command
Parameters:
commandLine - Command line to execute.
Returns:
The status code of the command.
See Also:
Command.STATUS_SUCCESS, Command.STATUS_FAILURE

executeCommand

protected abstract int executeCommand(org.apache.commons.cli.CommandLine commandLine)
                               throws Exception
Throws:
Exception

isLoggable

protected boolean isLoggable(Level level)
Checks if a message at a given level is provided to the listeners of the instance.

Parameters:
level - The level to test.
Returns:
true if messages at level are provided to the listeners of the instance; false if messages at level are not provided to the listeners of the instance.
Throws:
NullPointerException - if level is null.
See Also:
getLogLevel(), setLogLevel(java.util.logging.Level)

log

protected void log(Level level,
                   String message,
                   Throwable throwable)
Notifies registered listeners.

Parameters:
level - The level of the event.
message - The message of the event or null.
throwable - The throwable of the event null.
Throws:
NullPointerException - if level is null.
See Also:
getListeners(), isLoggable(java.util.logging.Level)

log

protected void log(org.jomc.model.ModelObjectValidationReport validationReport,
                   javax.xml.bind.Marshaller marshaller)
            throws javax.xml.bind.JAXBException
Throws:
javax.xml.bind.JAXBException

getModelManager

protected org.jomc.model.ModelManager getModelManager()

getModelObjectValidator

protected org.jomc.model.ModelObjectValidator getModelObjectValidator()

getJavaBundles

protected org.jomc.tools.JavaBundles getJavaBundles()

getJavaClasses

protected org.jomc.tools.JavaClasses getJavaClasses()

getJavaSources

protected org.jomc.tools.JavaSources getJavaSources()

getClasspathOption

protected org.apache.commons.cli.Option getClasspathOption()

getDocumentsOption

protected org.apache.commons.cli.Option getDocumentsOption()

getModuleLocationOption

protected org.apache.commons.cli.Option getModuleLocationOption()

getModuleNameOption

protected org.apache.commons.cli.Option getModuleNameOption()

getNoClasspathResolutionOption

protected org.apache.commons.cli.Option getNoClasspathResolutionOption()

getClassLoader

protected ClassLoader getClassLoader(org.apache.commons.cli.CommandLine commandLine)
                              throws IOException
Throws:
IOException

getDocumentFiles

protected Set<File> getDocumentFiles(org.apache.commons.cli.CommandLine commandLine)
                              throws IOException
Throws:
IOException

getModules

protected org.jomc.model.Modules getModules(org.apache.commons.cli.CommandLine commandLine)
                                     throws IOException,
                                            SAXException,
                                            javax.xml.bind.JAXBException
Throws:
IOException
SAXException
javax.xml.bind.JAXBException


Copyright © 2005-2009 The JOMC Project. All Rights Reserved.