mil.dod.th.ose.sdk/src/mil/dod/th/ose/sdk/those/ThoseMain.java
public static void main(final String[] args) throws Exception
    {
        // Create options parser
        final OptionParser parser = new OptionParser();
        parser.accepts(OPTION_VERBOSE);
        parser.accepts(OPTION_ASSET).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_PHYLINK).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_LINKLAYER).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_TRANSPORT).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_DEFAULT_PROPS);
        parser.accepts(OPTION_PACKAGE_NAME).withRequiredArg();
        parser.accepts(OPTION_PHYS_LINK_TYPE).withRequiredArg();

        // Parse the command string (minus the sub command name)
        final OptionSet options;
        if (args.length == 0)
        {
            options = parser.parse();
        }
        else
        {
            try
            {
                options = parser.parse(args);
            }
            catch (final Exception ex)
            {
                for (int i = 0; i < args.length; i++)
                {
                    if (args[i].equals("-" + OPTION_VERBOSE))
                    {
                        throw ex;
                    }
                }
                
                OUT_STREAM.println("\nError parsing the given arguments:");
                OUT_STREAM.println(ex.getMessage());
                return;
            }
        }

        // Empty line before command output
        OUT_STREAM.println();

        // Get the list of non-option arguments (sub-command, etc.)
        final List<String> nonOptions = options.nonOptionArguments();
        if (nonOptions.isEmpty())
        {
            // Print usage info and return if no options/arguments are given
            OUT_STREAM.println(getUsage());
            return;
        }

        // Use first non-option argument as the sub-command
        final String subcmd = nonOptions.get(0);
        try
        {
            processSubcommand(subcmd, options);
        }
        catch (final Exception ex)
        {
            checkVerbose(ex, options);
            OUT_STREAM.println("\nError processing command: " + subcmd);
            OUT_STREAM.println(ex.getMessage());
        }
    }
/**
     * Application main function.
     * 
     * @param args
     *            Command line arguments
     * @throws Exception
     *            if an exception occurs processing the command
     */
Application main function.

@param args
Command line arguments
@throws Exception
if an exception occurs processing the command
Application main function . @param args Command line arguments @throws Exception if an exception occurs processing the command
public static void main(final String[] args) throws Exception
    {
        final OptionParser parser = new OptionParser();
        parser.accepts(OPTION_VERBOSE);
        parser.accepts(OPTION_ASSET).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_PHYLINK).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_LINKLAYER).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_TRANSPORT).withRequiredArg().ofType(String.class);
        parser.accepts(OPTION_DEFAULT_PROPS);
        parser.accepts(OPTION_PACKAGE_NAME).withRequiredArg();
        parser.accepts(OPTION_PHYS_LINK_TYPE).withRequiredArg();
        final OptionSet options;
        if (args.length == 0)
        {
            options = parser.parse();
        }
        else
        {
            try
            {
                options = parser.parse(args);
            }
            catch (final Exception ex)
            {
                for (int i = 0; i < args.length; i++)
                {
                    if (args[i].equals("-" + OPTION_VERBOSE))
                    {
                        throw ex;
                    }
                }
                OUT_STREAM.println("\nError parsing the given arguments:");
                OUT_STREAM.println(ex.getMessage());
                return;
            }
        }
        OUT_STREAM.println();
        final List<String> nonOptions = options.nonOptionArguments();
        if (nonOptions.isEmpty())
        {
            OUT_STREAM.println(getUsage());
            return;
        }
        final String subcmd = nonOptions.get(0);
        try
        {
            processSubcommand(subcmd, options);
        }
        catch (final Exception ex)
        {
            checkVerbose(ex, options);
            OUT_STREAM.println("\nError processing command: " + subcmd);
            OUT_STREAM.println(ex.getMessage());
        }
    }
public static void main ( final String [ ] args ) throws Exception { final OptionParser parser = new OptionParser ( ) ; parser . accepts ( OPTION_VERBOSE ) ; parser . accepts ( OPTION_ASSET ) . withRequiredArg ( ) . ofType ( String . class ) ; parser . accepts ( OPTION_PHYLINK ) . withRequiredArg ( ) . ofType ( String . class ) ; parser . accepts ( OPTION_LINKLAYER ) . withRequiredArg ( ) . ofType ( String . class ) ; parser . accepts ( OPTION_TRANSPORT ) . withRequiredArg ( ) . ofType ( String . class ) ; parser . accepts ( OPTION_DEFAULT_PROPS ) ; parser . accepts ( OPTION_PACKAGE_NAME ) . withRequiredArg ( ) ; parser . accepts ( OPTION_PHYS_LINK_TYPE ) . withRequiredArg ( ) ; final OptionSet options ; if ( args . length == 0 ) { options = parser . parse ( ) ; } else { try { options = parser . parse ( args ) ; } catch ( final Exception ex ) { for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equals ( "-" + OPTION_VERBOSE ) ) { throw ex ; } } OUT_STREAM . println ( "\nError parsing the given arguments:" ) ; OUT_STREAM . println ( ex . getMessage ( ) ) ; return ; } } OUT_STREAM . println ( ) ; final List < String > nonOptions = options . nonOptionArguments ( ) ; if ( nonOptions . isEmpty ( ) ) { OUT_STREAM . println ( getUsage ( ) ) ; return ; } final String subcmd = nonOptions . get ( 0 ) ; try { processSubcommand ( subcmd , options ) ; } catch ( final Exception ex ) { checkVerbose ( ex , options ) ; OUT_STREAM . println ( "\nError processing command: " + subcmd ) ; OUT_STREAM . println ( ex . getMessage ( ) ) ; } }
Application main function.
Application main function .
// Create options parser // Parse the command string (minus the sub command name) // Empty line before command output // Get the list of non-option arguments (sub-command, etc.) // Print usage info and return if no options/arguments are given // Use first non-option argument as the sub-command