001package votorola.s.line; // Copyright 2007-2008, 2011, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import java.util.*;
004import votorola.a.response.line.*;
005import votorola.g.lang.*;
006import votorola.g.logging.*;
007import votorola.g.option.*;
008
009
010/** Main class of the executable <code>voqproperties</code> - a test tool to print the
011  * runtime properties.
012  *
013  *     @see <a href='../../../../../s/manual.xht#line-voqproperties' target='_top'>voqproperties</a>
014  */
015public @ThreadSafe final class VOQProperties
016{
017
018    private VOQProperties() {}
019
020
021
022    /** Runs the tool from the command line.
023      *
024      *     @param argv command line argument array
025      */
026    public static void main( String[] argv )
027    {
028        LoggerX.i(VOQProperties.class).info( "voqproperties is running with arguments " + Arrays.toString( argv ));
029        final Map<String,Option> optionMap = CommandLine.compileBaseOptions();
030        final int aFirstNonOption = GetoptX.parse( "voqproperties", argv, optionMap );
031        if( optionMap.get("help").hasOccured() )
032        {
033            System.out.print(
034              "Usage: voqproperties | sort\n" +
035              "Print the runtime properties of the Java VM.\n" );
036            return;
037        }
038
039        if( aFirstNonOption < argv.length )
040        {
041            System.err.println( GetoptX.createUnexpectedArgWarning(
042              "voqproperties", argv[aFirstNonOption] ));
043            System.err.println( GetoptX.createHelpPrompt( "voqproperties" ));
044            System.exit( 1 );
045        }
046
047        System.getProperties().list( System.out );
048    }
049
050
051
052}