EMMA Coverage Report (generated Wed Feb 03 01:24:19 UTC 2010)
[all classes][org.jomc.cli]

COVERAGE SUMMARY FOR SOURCE FILE [Jomc.java]

nameclass, %method, %block, %line, %
Jomc.java100% (2/2)90%  (26/29)86%  (851/995)88%  (155.6/176)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Jomc100% (1/1)89%  (24/27)85%  (838/982)88%  (152.6/173)
main (String []): void 0%   (0/1)0%   (0/4)0%   (0/2)
setDefaultLogLevel (Level): void 0%   (0/1)0%   (0/3)0%   (0/2)
setPrintWriter (PrintWriter): void 0%   (0/1)0%   (0/4)0%   (0/2)
getMessage (Throwable): String 100% (1/1)53%  (8/15)60%  (3/5)
isLoggable (Level): boolean 100% (1/1)65%  (11/17)63%  (1.9/3)
getDebugOption (): Option 100% (1/1)75%  (15/20)91%  (2.7/3)
getFailOnWarningsOption (): Option 100% (1/1)75%  (15/20)91%  (2.7/3)
getHelpCommandName (): String 100% (1/1)75%  (15/20)91%  (2.7/3)
getLocale (): Locale 100% (1/1)75%  (15/20)91%  (2.7/3)
getVerboseOption (): Option 100% (1/1)75%  (15/20)91%  (2.7/3)
getCommands (): Command [] 100% (1/1)76%  (16/21)91%  (2.7/3)
getDescPad (): int 100% (1/1)76%  (16/21)91%  (2.7/3)
getLeftPad (): int 100% (1/1)76%  (16/21)91%  (2.7/3)
getWidth (): int 100% (1/1)76%  (16/21)91%  (2.7/3)
<static initializer> 100% (1/1)80%  (8/10)90%  (1.8/2)
getCommandLineInfoMessage (Locale, String): String 100% (1/1)81%  (21/26)93%  (2.8/3)
getUsageMessage (Locale, String): String 100% (1/1)81%  (21/26)93%  (2.8/3)
getIllegalArgumentsMessage (Locale, String, String): String 100% (1/1)83%  (25/30)94%  (2.8/3)
formatLogLines (Level, String): String 100% (1/1)86%  (37/43)75%  (6/8)
log (Level, String, Throwable): void 100% (1/1)87%  (86/99)91%  (20/22)
jomc (String []): int 100% (1/1)92%  (434/473)95%  (72/76)
Jomc (): void 100% (1/1)100% (6/6)100% (3/3)
getDefaultLogLevel (): Level 100% (1/1)100% (10/10)100% (3/3)
getLogLevel (): Level 100% (1/1)100% (9/9)100% (3/3)
getPrintWriter (): PrintWriter 100% (1/1)100% (13/13)100% (3/3)
run (String []): int 100% (1/1)100% (6/6)100% (1/1)
setLogLevel (Level): void 100% (1/1)100% (4/4)100% (2/2)
     
class Jomc$1100% (1/1)100% (2/2)100% (13/13)100% (3/3)
Jomc$1 (Jomc): void 100% (1/1)100% (6/6)100% (1/1)
onLog (Level, String, Throwable): void 100% (1/1)100% (7/7)100% (2/2)

1// SECTION-START[License Header]
2// <editor-fold defaultstate="collapsed" desc=" Generated License ">
3/*
4 *   Copyright (c) 2010 The JOMC Project
5 *   Copyright (c) 2005 Christian Schulte <cs@jomc.org>
6 *   All rights reserved.
7 *
8 *   Redistribution and use in source and binary forms, with or without
9 *   modification, are permitted provided that the following conditions
10 *   are met:
11 *
12 *     o Redistributions of source code must retain the above copyright
13 *       notice, this list of conditions and the following disclaimer.
14 *
15 *     o Redistributions in binary form must reproduce the above copyright
16 *       notice, this list of conditions and the following disclaimer in
17 *       the documentation and/or other materials provided with the
18 *       distribution.
19 *
20 *   THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS"
21 *   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 *   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 *   PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR
24 *   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 *   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 *   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 *   OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 *   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30 *   ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 *   $Id: Jomc.java 1452 2010-02-02 05:35:30Z schulte2005 $
33 *
34 */
35// </editor-fold>
36// SECTION-END
37package org.jomc.cli;
38 
39import java.io.BufferedReader;
40import java.io.IOException;
41import java.io.PrintWriter;
42import java.io.StringReader;
43import java.io.StringWriter;
44import java.util.logging.Level;
45import org.apache.commons.cli.CommandLine;
46import org.apache.commons.cli.GnuParser;
47import org.apache.commons.cli.HelpFormatter;
48import org.apache.commons.cli.Options;
49import org.apache.commons.cli.ParseException;
50import org.apache.commons.lang.StringUtils;
51import org.jomc.model.DefaultModelProcessor;
52import org.jomc.model.DefaultModelProvider;
53import org.jomc.model.bootstrap.DefaultSchemaProvider;
54import org.jomc.model.bootstrap.DefaultServiceProvider;
55 
56// SECTION-START[Documentation]
57// <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
58/**
59 * JOMC command line interface.
60 * <p><b>Properties</b><ul>
61 * <li>"{@link #getDescPad descPad}"
62 * <blockquote>Property of type {@code int}.
63 * <p>The number of characters of padding to be prefixed to each description line.</p>
64 * </blockquote></li>
65 * <li>"{@link #getHelpCommandName helpCommandName}"
66 * <blockquote>Property of type {@code java.lang.String}.
67 * <p>The name of the command used to request help.</p>
68 * </blockquote></li>
69 * <li>"{@link #getLeftPad leftPad}"
70 * <blockquote>Property of type {@code int}.
71 * <p>The number of characters of padding to be prefixed to each line.</p>
72 * </blockquote></li>
73 * <li>"{@link #getWidth width}"
74 * <blockquote>Property of type {@code int}.
75 * <p>The number of characters per line for the usage statement.</p>
76 * </blockquote></li>
77 * </ul></p>
78 * <p><b>Dependencies</b><ul>
79 * <li>"{@link #getCommands Commands}"<blockquote>
80 * Dependency on {@code org.jomc.cli.Command} at specification level 1.0-alpha-16.</blockquote></li>
81 * <li>"{@link #getDebugOption DebugOption}"<blockquote>
82 * Dependency on {@code org.apache.commons.cli.Option} bound to an instance.</blockquote></li>
83 * <li>"{@link #getFailOnWarningsOption FailOnWarningsOption}"<blockquote>
84 * Dependency on {@code org.apache.commons.cli.Option} bound to an instance.</blockquote></li>
85 * <li>"{@link #getLocale Locale}"<blockquote>
86 * Dependency on {@code java.util.Locale} at specification level 1.1 bound to an instance.</blockquote></li>
87 * <li>"{@link #getVerboseOption VerboseOption}"<blockquote>
88 * Dependency on {@code org.apache.commons.cli.Option} bound to an instance.</blockquote></li>
89 * </ul></p>
90 * <p><b>Messages</b><ul>
91 * <li>"{@link #getCommandLineInfoMessage commandLineInfo}"<table>
92 * <tr><td valign="top">English:</td><td valign="top"><pre>Command line:
93 * {0}</pre></td></tr>
94 * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Kommandozeile:
95 * {0}</pre></td></tr>
96 * </table>
97 * <li>"{@link #getIllegalArgumentsMessage illegalArguments}"<table>
98 * <tr><td valign="top">English:</td><td valign="top"><pre>Illegal arguments. Type &raquo;jomc {0} {1}&laquo; for further information.</pre></td></tr>
99 * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Ung&uuml;ltige Argumente. Geben Sie &raquo;jomc {0} {1}&laquo; f&uuml;r weitere Informationen ein.</pre></td></tr>
100 * </table>
101 * <li>"{@link #getUsageMessage usage}"<table>
102 * <tr><td valign="top">English:</td><td valign="top"><pre>Type &raquo;jomc &lt;command&gt; {0}&laquo; for further information.</pre></td></tr>
103 * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Geben Sie &raquo;jomc &lt;Befehl&gt; {0}&laquo; f&uuml;r weitere Informationen ein.</pre></td></tr>
104 * </table>
105 * </ul></p>
106 *
107 * @author <a href="mailto:cs@jomc.org">Christian Schulte</a> 1.0
108 * @version $Id: Jomc.java 1452 2010-02-02 05:35:30Z schulte2005 $
109 */
110// </editor-fold>
111// SECTION-END
112// SECTION-START[Annotations]
113// <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
114@javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
115                             comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
116// </editor-fold>
117// SECTION-END
118public class Jomc
119{
120    // SECTION-START[Jomc]
121 
122    /**
123     * Log level events are logged at by default.
124     * @see #getDefaultLogLevel()
125     */
126    private static final Level DEFAULT_LOG_LEVEL = Level.WARNING;
127 
128    /** Default log level. */
129    private static volatile Level defaultLogLevel;
130 
131    /** Print writer of the instance. */
132    private PrintWriter printWriter;
133 
134    /** Log level of the instance. */
135    private Level logLevel;
136 
137    /** Greatest severity logged by the command. */
138    private Level severity = Level.ALL;
139 
140    /**
141     * Gets the print writer of the instance.
142     *
143     * @return The print writer of the instance.
144     */
145    public PrintWriter getPrintWriter()
146    {
147        if ( this.printWriter == null )
148        {
149            this.printWriter = new PrintWriter( System.out, true );
150        }
151 
152        return this.printWriter;
153    }
154 
155    /**
156     * Sets the print writer of the instance.
157     *
158     * @param value The new print writer of the instance or {@code null}.
159     */
160    public void setPrintWriter( final PrintWriter value )
161    {
162        this.printWriter = value;
163    }
164 
165    /**
166     * Gets the default log level events are logged at.
167     * <p>The default log level is controlled by system property {@code org.jomc.cli.Jomc.defaultLogLevel} holding the
168     * log level to log events at by default. If that property is not set, the {@code WARNING} default is returned.</p>
169     *
170     * @return The log level events are logged at by default.
171     *
172     * @see #getLogLevel()
173     * @see Level#parse(java.lang.String)
174     */
175    public static Level getDefaultLogLevel()
176    {
177        if ( defaultLogLevel == null )
178        {
179            defaultLogLevel = Level.parse( System.getProperty(
180                "org.jomc.cli.Jomc.defaultLogLevel", DEFAULT_LOG_LEVEL.getName() ) );
181 
182        }
183 
184        return defaultLogLevel;
185    }
186 
187    /**
188     * Sets the default log level events are logged at.
189     *
190     * @param value The new default level events are logged at or {@code null}.
191     *
192     * @see #getDefaultLogLevel()
193     */
194    public static void setDefaultLogLevel( final Level value )
195    {
196        defaultLogLevel = value;
197    }
198 
199    /**
200     * Gets the log level of the instance.
201     *
202     * @return The log level of the instance.
203     *
204     * @see #getDefaultLogLevel()
205     * @see #setLogLevel(java.util.logging.Level)
206     * @see #isLoggable(java.util.logging.Level)
207     */
208    public Level getLogLevel()
209    {
210        if ( this.logLevel == null )
211        {
212            this.logLevel = getDefaultLogLevel();
213        }
214 
215        return this.logLevel;
216    }
217 
218    /**
219     * Sets the log level of the instance.
220     *
221     * @param value The new log level of the instance or {@code null}.
222     *
223     * @see #getLogLevel()
224     * @see #isLoggable(java.util.logging.Level)
225     */
226    public void setLogLevel( final Level value )
227    {
228        this.logLevel = value;
229    }
230 
231    /**
232     * Checks if a message at a given level is provided to the listeners of the instance.
233     *
234     * @param level The level to test.
235     *
236     * @return {@code true} if messages at {@code level} are provided to the listeners of the instance;
237     * {@code false} if messages at {@code level} are not provided to the listeners of the instance.
238     *
239     * @throws NullPointerException if {@code level} is {@code null}.
240     *
241     * @see #getLogLevel()
242     * @see #setLogLevel(java.util.logging.Level)
243     */
244    public boolean isLoggable( final Level level )
245    {
246        if ( level == null )
247        {
248            throw new NullPointerException( "level" );
249        }
250 
251        return level.intValue() >= this.getLogLevel().intValue();
252    }
253 
254    /**
255     * Processes the given arguments and executes the corresponding command.
256     *
257     * @param args Arguments to process.
258     *
259     * @return Status code.
260     *
261     * @see Command#STATUS_SUCCESS
262     * @see Command#STATUS_FAILURE
263     */
264    public int jomc( final String[] args )
265    {
266        Command cmd = null;
267        this.severity = Level.ALL;
268 
269        try
270        {
271            DefaultModelProvider.setDefaultModuleLocation( "META-INF/jomc-cli.xml" );
272            DefaultModelProcessor.setDefaultTransformerLocation( "META-INF/jomc-cli.xsl" );
273            DefaultSchemaProvider.setDefaultSchemaLocation( "META-INF/jomc-schemas.xml" );
274            DefaultServiceProvider.setDefaultServiceLocation( "META-INF/jomc-services.xml" );
275 
276            final StringBuilder commandInfo = new StringBuilder();
277 
278            for ( Command c : this.getCommands() )
279            {
280                if ( cmd == null && args != null && args.length > 0 &&
281                     ( args[0].equals( c.getName() ) || args[0].equals( c.getAbbreviatedName() ) ) )
282                {
283                    cmd = c;
284                }
285 
286                commandInfo.append( StringUtils.rightPad( c.getName(), 25 ) ).append( " : " ).
287                    append( c.getShortDescription( this.getLocale() ) ).append( " (" ).append( c.getAbbreviatedName() ).
288                    append( ")" ).append( System.getProperty( "line.separator" ) );
289 
290            }
291 
292            if ( cmd == null )
293            {
294                this.getPrintWriter().println( this.getUsageMessage( this.getLocale(), this.getHelpCommandName() ) );
295                this.getPrintWriter().println();
296                this.getPrintWriter().println( commandInfo.toString() );
297                return Command.STATUS_FAILURE;
298            }
299 
300            final String[] commandArguments = new String[ args.length - 1 ];
301            System.arraycopy( args, 1, commandArguments, 0, commandArguments.length );
302 
303            if ( commandArguments.length > 0 && this.getHelpCommandName().equals( commandArguments[0] ) )
304            {
305                final StringWriter usage = new StringWriter();
306                final StringWriter opts = new StringWriter();
307                final HelpFormatter formatter = new HelpFormatter();
308                final Options options = cmd.getOptions();
309                options.addOption( this.getDebugOption() );
310                options.addOption( this.getVerboseOption() );
311                options.addOption( this.getFailOnWarningsOption() );
312 
313                PrintWriter pw = new PrintWriter( usage );
314                formatter.printUsage( pw, this.getWidth(), cmd.getName(), options );
315                pw.close();
316 
317                pw = new PrintWriter( opts );
318                formatter.printOptions( pw, this.getWidth(), options, this.getLeftPad(), this.getDescPad() );
319                pw.close();
320 
321                this.getPrintWriter().println( cmd.getShortDescription( this.getLocale() ) );
322                this.getPrintWriter().println();
323                this.getPrintWriter().println( usage.toString() );
324                this.getPrintWriter().println( opts.toString() );
325                this.getPrintWriter().println();
326                this.getPrintWriter().println( cmd.getLongDescription( this.getLocale() ) );
327                this.getPrintWriter().println();
328                return Command.STATUS_SUCCESS;
329            }
330 
331            cmd.getListeners().add( new Command.Listener()
332            {
333 
334                public void onLog( final Level level, final String message, final Throwable t )
335                {
336                    log( level, message, t );
337                }
338 
339            } );
340 
341            DefaultModelProvider.setDefaultModuleLocation( null );
342            DefaultModelProcessor.setDefaultTransformerLocation( null );
343            DefaultSchemaProvider.setDefaultSchemaLocation( null );
344            DefaultServiceProvider.setDefaultServiceLocation( null );
345 
346            final Options options = cmd.getOptions();
347            options.addOption( this.getDebugOption() );
348            options.addOption( this.getVerboseOption() );
349            options.addOption( this.getFailOnWarningsOption() );
350 
351            final CommandLine commandLine = new GnuParser().parse( options, commandArguments );
352            final boolean debug = commandLine.hasOption( this.getDebugOption().getOpt() );
353            final boolean verbose = commandLine.hasOption( this.getVerboseOption().getOpt() );
354 
355            if ( debug || verbose )
356            {
357                this.setLogLevel( debug ? Level.ALL : Level.INFO );
358            }
359 
360            cmd.setLogLevel( this.getLogLevel() );
361 
362            if ( this.isLoggable( Level.FINE ) )
363            {
364                final StringBuilder argumentInfo = new StringBuilder();
365 
366                for ( int i = 0; i < args.length; i++ )
367                {
368                    argumentInfo.append( "\t[" ).append( i ).append( "]='" ).append( args[i] ).append( "'" ).
369                        append( System.getProperty( "line.separator" ) );
370 
371                }
372 
373                this.log( Level.FINE, this.getCommandLineInfoMessage(
374                    this.getLocale(), argumentInfo.toString() ), null );
375 
376            }
377 
378            final boolean failOnWarnings = commandLine.hasOption( this.getFailOnWarningsOption().getOpt() );
379 
380            final int status = cmd.execute( commandLine );
381            if ( status == Command.STATUS_SUCCESS && failOnWarnings &&
382                 this.severity.intValue() >= Level.WARNING.intValue() )
383            {
384                return Command.STATUS_FAILURE;
385            }
386 
387            return status;
388        }
389        catch ( final ParseException e )
390        {
391            this.log( Level.SEVERE, this.getIllegalArgumentsMessage(
392                this.getLocale(), cmd.getName(), this.getHelpCommandName() ), e );
393 
394            return Command.STATUS_FAILURE;
395        }
396        catch ( final Throwable t )
397        {
398            this.log( Level.SEVERE, t.getMessage(), t );
399            return Command.STATUS_FAILURE;
400        }
401        finally
402        {
403            DefaultModelProvider.setDefaultModuleLocation( null );
404            DefaultModelProcessor.setDefaultTransformerLocation( null );
405            DefaultSchemaProvider.setDefaultSchemaLocation( null );
406            DefaultServiceProvider.setDefaultServiceLocation( null );
407            this.getPrintWriter().flush();
408        }
409    }
410 
411    /**
412     * Main entry point.
413     *
414     * @param args The application arguments.
415     */
416    public static void main( final String[] args )
417    {
418        System.exit( run( args ) );
419    }
420 
421    /**
422     * Main entry point without exiting the VM.
423     *
424     * @param args The application arguments.
425     *
426     * @return Status code.
427     *
428     * @see Command#STATUS_SUCCESS
429     * @see Command#STATUS_FAILURE
430     */
431    public static int run( final String[] args )
432    {
433        return new Jomc().jomc( args );
434    }
435 
436    /**
437     * Logs to the print writer of the instance.
438     *
439     * @param level The level of the event.
440     * @param message The message of the event or {@code null}.
441     * @param throwable The throwable of the event {@code null}.
442     *
443     * @throws NullPointerException if {@code level} is {@code null}.
444     */
445    protected void log( final Level level, final String message, final Throwable throwable )
446    {
447        if ( level == null )
448        {
449            throw new NullPointerException( "level" );
450        }
451 
452        if ( this.severity.intValue() < level.intValue() )
453        {
454            this.severity = level;
455        }
456 
457        if ( this.isLoggable( level ) )
458        {
459            if ( message != null )
460            {
461                this.getPrintWriter().print( this.formatLogLines( level, "" ) );
462                this.getPrintWriter().print( this.formatLogLines( level, message ) );
463            }
464 
465            if ( throwable != null )
466            {
467                this.getPrintWriter().print( this.formatLogLines( level, "" ) );
468                final String m = this.getMessage( throwable );
469 
470                if ( m != null )
471                {
472                    this.getPrintWriter().print( this.formatLogLines( level, m ) );
473                }
474                else
475                {
476                    this.getPrintWriter().print( this.formatLogLines( level, throwable.toString() ) );
477                }
478 
479                if ( this.getLogLevel().intValue() < Level.INFO.intValue() )
480                {
481                    final StringWriter stackTrace = new StringWriter();
482                    final PrintWriter pw = new PrintWriter( stackTrace );
483                    throwable.printStackTrace( pw );
484                    pw.flush();
485                    this.getPrintWriter().print( this.formatLogLines( level, stackTrace.toString() ) );
486                }
487            }
488        }
489 
490        this.getPrintWriter().flush();
491    }
492 
493    private String formatLogLines( final Level level, final String text )
494    {
495        try
496        {
497            final StringBuilder lines = new StringBuilder();
498            final BufferedReader reader = new BufferedReader( new StringReader( text ) );
499 
500            String line;
501            while ( ( line = reader.readLine() ) != null )
502            {
503                lines.append( "[" ).append( level.getLocalizedName() ).append( "] " );
504                lines.append( line ).append( System.getProperty( "line.separator" ) );
505            }
506 
507            return lines.toString();
508        }
509        catch ( final IOException e )
510        {
511            throw new AssertionError( e );
512        }
513    }
514 
515    private String getMessage( final Throwable throwable )
516    {
517        if ( throwable != null )
518        {
519            if ( throwable.getMessage() != null )
520            {
521                return throwable.getMessage();
522            }
523 
524            return this.getMessage( throwable.getCause() );
525        }
526 
527        return null;
528    }
529 
530    // SECTION-END
531    // SECTION-START[Constructors]
532    // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
533 
534    /** Creates a new {@code Jomc} instance. */
535    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
536                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
537    public Jomc()
538    {
539        // SECTION-START[Default Constructor]
540        super();
541        // SECTION-END
542    }
543    // </editor-fold>
544    // SECTION-END
545    // SECTION-START[Dependencies]
546    // <editor-fold defaultstate="collapsed" desc=" Generated Dependencies ">
547 
548    /**
549     * Gets the {@code Commands} dependency.
550     * <p>This method returns any available object of the {@code org.jomc.cli.Command} specification at specification level 1.0-alpha-16.</p>
551     * <p>That specification does not apply to any scope. A new object is returned whenever requested.</p>
552     * @return The {@code Commands} dependency.
553     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
554     */
555    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
556                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
557    private org.jomc.cli.Command[] getCommands()
558    {
559        final org.jomc.cli.Command[] _d = (org.jomc.cli.Command[]) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Commands" );
560        assert _d != null : "'Commands' dependency not found.";
561        return _d;
562    }
563 
564    /**
565     * Gets the {@code DebugOption} dependency.
566     * <p>This method returns the "{@code JOMC CLI Debug Option}" object of the {@code org.apache.commons.cli.Option} specification.</p>
567     * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p>
568     * @return The {@code DebugOption} dependency.
569     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
570     */
571    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
572                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
573    private org.apache.commons.cli.Option getDebugOption()
574    {
575        final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "DebugOption" );
576        assert _d != null : "'DebugOption' dependency not found.";
577        return _d;
578    }
579 
580    /**
581     * Gets the {@code FailOnWarningsOption} dependency.
582     * <p>This method returns the "{@code JOMC CLI Fail-On-Warnings Option}" object of the {@code org.apache.commons.cli.Option} specification.</p>
583     * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p>
584     * @return The {@code FailOnWarningsOption} dependency.
585     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
586     */
587    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
588                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
589    private org.apache.commons.cli.Option getFailOnWarningsOption()
590    {
591        final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "FailOnWarningsOption" );
592        assert _d != null : "'FailOnWarningsOption' dependency not found.";
593        return _d;
594    }
595 
596    /**
597     * Gets the {@code Locale} dependency.
598     * <p>This method returns the "{@code default}" object of the {@code java.util.Locale} specification at specification level 1.1.</p>
599     * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p>
600     * @return The {@code Locale} dependency.
601     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
602     */
603    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
604                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
605    private java.util.Locale getLocale()
606    {
607        final java.util.Locale _d = (java.util.Locale) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Locale" );
608        assert _d != null : "'Locale' dependency not found.";
609        return _d;
610    }
611 
612    /**
613     * Gets the {@code VerboseOption} dependency.
614     * <p>This method returns the "{@code JOMC CLI Verbose Option}" object of the {@code org.apache.commons.cli.Option} specification.</p>
615     * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p>
616     * @return The {@code VerboseOption} dependency.
617     * @throws org.jomc.ObjectManagementException if getting the dependency instance fails.
618     */
619    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
620                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
621    private org.apache.commons.cli.Option getVerboseOption()
622    {
623        final org.apache.commons.cli.Option _d = (org.apache.commons.cli.Option) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "VerboseOption" );
624        assert _d != null : "'VerboseOption' dependency not found.";
625        return _d;
626    }
627    // </editor-fold>
628    // SECTION-END
629    // SECTION-START[Properties]
630    // <editor-fold defaultstate="collapsed" desc=" Generated Properties ">
631 
632    /**
633     * Gets the value of the {@code descPad} property.
634     * @return The number of characters of padding to be prefixed to each description line.
635     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
636     */
637    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
638                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
639    private int getDescPad()
640    {
641        final java.lang.Integer _p = (java.lang.Integer) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "descPad" );
642        assert _p != null : "'descPad' property not found.";
643        return _p.intValue();
644    }
645 
646    /**
647     * Gets the value of the {@code helpCommandName} property.
648     * @return The name of the command used to request help.
649     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
650     */
651    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
652                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
653    private java.lang.String getHelpCommandName()
654    {
655        final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "helpCommandName" );
656        assert _p != null : "'helpCommandName' property not found.";
657        return _p;
658    }
659 
660    /**
661     * Gets the value of the {@code leftPad} property.
662     * @return The number of characters of padding to be prefixed to each line.
663     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
664     */
665    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
666                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
667    private int getLeftPad()
668    {
669        final java.lang.Integer _p = (java.lang.Integer) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "leftPad" );
670        assert _p != null : "'leftPad' property not found.";
671        return _p.intValue();
672    }
673 
674    /**
675     * Gets the value of the {@code width} property.
676     * @return The number of characters per line for the usage statement.
677     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
678     */
679    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
680                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
681    private int getWidth()
682    {
683        final java.lang.Integer _p = (java.lang.Integer) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "width" );
684        assert _p != null : "'width' property not found.";
685        return _p.intValue();
686    }
687    // </editor-fold>
688    // SECTION-END
689    // SECTION-START[Messages]
690    // <editor-fold defaultstate="collapsed" desc=" Generated Messages ">
691 
692    /**
693     * Gets the text of the {@code commandLineInfo} message.
694     * <p><b>Templates</b><br/><table>
695     * <tr><td valign="top">English:</td><td valign="top"><pre>Command line:
696     * {0}</pre></td></tr>
697     * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Kommandozeile:
698     * {0}</pre></td></tr>
699     * </table></p>
700     * @param locale The locale of the message to return.
701     * @param commandLine Format argument.
702     * @return The text of the {@code commandLineInfo} message.
703     *
704     * @throws org.jomc.ObjectManagementException if getting the message instance fails.
705     */
706    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
707                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
708    private String getCommandLineInfoMessage( final java.util.Locale locale, final java.lang.String commandLine )
709    {
710        final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "commandLineInfo", locale, commandLine );
711        assert _m != null : "'commandLineInfo' message not found.";
712        return _m;
713    }
714 
715    /**
716     * Gets the text of the {@code illegalArguments} message.
717     * <p><b>Templates</b><br/><table>
718     * <tr><td valign="top">English:</td><td valign="top"><pre>Illegal arguments. Type &raquo;jomc {0} {1}&laquo; for further information.</pre></td></tr>
719     * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Ung&uuml;ltige Argumente. Geben Sie &raquo;jomc {0} {1}&laquo; f&uuml;r weitere Informationen ein.</pre></td></tr>
720     * </table></p>
721     * @param locale The locale of the message to return.
722     * @param command Format argument.
723     * @param helpCommandName Format argument.
724     * @return The text of the {@code illegalArguments} message.
725     *
726     * @throws org.jomc.ObjectManagementException if getting the message instance fails.
727     */
728    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
729                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
730    private String getIllegalArgumentsMessage( final java.util.Locale locale, final java.lang.String command, final java.lang.String helpCommandName )
731    {
732        final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "illegalArguments", locale, command, helpCommandName );
733        assert _m != null : "'illegalArguments' message not found.";
734        return _m;
735    }
736 
737    /**
738     * Gets the text of the {@code usage} message.
739     * <p><b>Templates</b><br/><table>
740     * <tr><td valign="top">English:</td><td valign="top"><pre>Type &raquo;jomc &lt;command&gt; {0}&laquo; for further information.</pre></td></tr>
741     * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>Geben Sie &raquo;jomc &lt;Befehl&gt; {0}&laquo; f&uuml;r weitere Informationen ein.</pre></td></tr>
742     * </table></p>
743     * @param locale The locale of the message to return.
744     * @param helpCommandName Format argument.
745     * @return The text of the {@code usage} message.
746     *
747     * @throws org.jomc.ObjectManagementException if getting the message instance fails.
748     */
749    @javax.annotation.Generated( value = "org.jomc.tools.JavaSources",
750                                 comments = "See http://jomc.sourceforge.net/jomc/1.0-alpha-16/jomc-tools" )
751    private String getUsageMessage( final java.util.Locale locale, final java.lang.String helpCommandName )
752    {
753        final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "usage", locale, helpCommandName );
754        assert _m != null : "'usage' message not found.";
755        return _m;
756    }
757    // </editor-fold>
758    // SECTION-END
759}

[all classes][org.jomc.cli]
EMMA 2.0.5312 (C) Vladimir Roubtsov