Class CommandLineArguments


  • public class CommandLineArguments
    extends java.lang.Object
    Helper class to encapsulate the funcionality concerning command line arguments
    Author:
    Andi Hotz, (c) Sahits GmbH, 2013 Created on Jan 16, 2013
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void checkMinimalHeight​(int height)  
      org.apache.commons.cli.Options createCommandLineOptions()  
      boolean isClient​(org.apache.commons.cli.CommandLine cmdLine)
      Check weather the application is started as client.
      boolean isServer​(org.apache.commons.cli.CommandLine cmdLine)
      Check weather the application is started as server.
      boolean isStandalone​(org.apache.commons.cli.CommandLine cmdLine)
      Check wether the commandline arguments for standalone are set.
      org.apache.commons.cli.CommandLine parseCommandLine​(org.apache.commons.cli.Options options, java.lang.String[] args)  
      void persistAsPropertyFile​(org.apache.commons.cli.CommandLine cmdLine)
      Set the spring profiles and write some properties, which will be used by Spring.
      void printHelp​(org.apache.commons.cli.Options options)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandLineArguments

        public CommandLineArguments()
    • Method Detail

      • createCommandLineOptions

        public org.apache.commons.cli.Options createCommandLineOptions()
      • parseCommandLine

        public org.apache.commons.cli.CommandLine parseCommandLine​(org.apache.commons.cli.Options options,
                                                                   java.lang.String[] args)
      • printHelp

        public void printHelp​(org.apache.commons.cli.Options options)
      • isStandalone

        public boolean isStandalone​(org.apache.commons.cli.CommandLine cmdLine)
        Check wether the commandline arguments for standalone are set.
        Parameters:
        cmdLine - command line object
        Returns:
        true if both client and server arguments are specified or neither.
      • isServer

        public boolean isServer​(org.apache.commons.cli.CommandLine cmdLine)
        Check weather the application is started as server.
        Parameters:
        cmdLine - command line object
        Returns:
        true if only the server flag is set
      • isClient

        public boolean isClient​(org.apache.commons.cli.CommandLine cmdLine)
        Check weather the application is started as client.
        Parameters:
        cmdLine - command line object
        Returns:
        true if only the client flag is set
      • persistAsPropertyFile

        public void persistAsPropertyFile​(org.apache.commons.cli.CommandLine cmdLine)
        Set the spring profiles and write some properties, which will be used by Spring.
        Parameters:
        cmdLine - command line object
      • checkMinimalHeight

        private void checkMinimalHeight​(int height)