Class ProgramOptions


  • public class ProgramOptions
    extends Object
    Representation of the options known to the asadmin program. These options control the overall behavior of asadmin, e.g., the server to contact, and aren't specific to any of the commands supported by asadmin.

    In GlassFish v3, asadmin program options are normally specified before the asadmin command name, with command options after the command name (although intermixed program and command options are still supported for compatibility).

    • Constructor Detail

      • ProgramOptions

        public ProgramOptions​(Environment env)
                       throws CommandException
        Initialize program options based only on environment defaults, with no options from the command line.
        Parameters:
        env -
        Throws:
        CommandException
      • ProgramOptions

        public ProgramOptions​(ParameterMap options,
                              Environment env)
                       throws CommandException
        Initialize the programoptions based on parameters parsed from the command line, with defaults supplied by the environment.
        Parameters:
        options -
        env -
        Throws:
        CommandException
      • ProgramOptions

        public ProgramOptions​(ProgramOptions other)
        Copy constructor. Create a new ProgramOptions with the same options as the specified ProgramOptions.
        Parameters:
        other -
    • Method Detail

      • updateOptions

        public final void updateOptions​(ParameterMap newOptions)
                                 throws CommandException
        Update the program options based on the specified options from the command line.
        Parameters:
        newOptions -
        Throws:
        CommandException
      • getValidOptions

        public static Collection<CommandModel.ParamModel> getValidOptions()
        Return a set of all the valid program options.
        Returns:
        the valid program options
      • getHelpOption

        public static Collection<CommandModel.ParamModel> getHelpOption()
        Return a set of all the valid program options.
        Returns:
        the valid program options
      • toEnvironment

        public void toEnvironment​(Environment env)
        Copy the program options that were specified on the command line into the corresponding environment variables.
        Parameters:
        env -
      • getHost

        public String getHost()
        Returns:
        the host
      • setHost

        public void setHost​(String host)
        Parameters:
        host - the host to set
      • getPort

        public int getPort()
        Returns:
        the port
      • setPort

        public void setPort​(int port)
        Parameters:
        port - the port to set
      • setHostAndPort

        public void setHostAndPort​(HostAndPort address)
        Convenience method to set the host and port (and secure) attributes from a HostAndPort object.
        Parameters:
        address - the HostAndPort object from which to set the attributes
      • getUser

        public String getUser()
        Returns:
        the user
      • setUser

        public void setUser​(String user)
        Parameters:
        user - the user to set
      • getPassword

        public char[] getPassword()
        Returns:
        the password
      • getPasswordFile

        public String getPasswordFile()
        Returns:
        the passwordFile
      • setPasswordFile

        public void setPasswordFile​(String passwordFile)
        Parameters:
        passwordFile - the passwordFile to set
      • isSecure

        public boolean isSecure()
        Returns:
        the secure
      • setSecure

        public void setSecure​(boolean secure)
        Parameters:
        secure - the secure to set
      • setAuthToken

        public void setAuthToken​(String token)
      • getAuthToken

        public String getAuthToken()
      • setAuxInput

        public void setAuxInput​(String authInput)
      • getAuxInput

        public String getAuxInput()
      • isTerse

        public boolean isTerse()
        Returns:
        the terse
      • isExtraTerse

        public boolean isExtraTerse()
      • isAutoName

        public boolean isAutoName()
      • isDetachedCommand

        public boolean isDetachedCommand()
        Returns:
        detach option
      • isNotifyCommand

        public boolean isNotifyCommand()
        Returns:
        notify option
      • removeDetach

        public void removeDetach()
      • setTerse

        public void setTerse​(boolean terse)
        Parameters:
        terse - the terse to set
      • setExtraTerse

        public void setExtraTerse​(boolean extraTerse)
      • setAutoName

        public void setAutoName​(boolean autoName)
      • isEcho

        public boolean isEcho()
        Returns:
        the echo
      • setEcho

        public void setEcho​(boolean echo)
        Parameters:
        echo - the echo to set
      • isInteractive

        public boolean isInteractive()
        Returns:
        the interactive
      • setInteractive

        public void setInteractive​(boolean interactive)
        Parameters:
        interactive - the interactive to set
      • isHelp

        public boolean isHelp()
        Returns:
        the help
      • setHelp

        public void setHelp​(boolean help)
        Parameters:
        help - the help to set
      • isOptionsSet

        public boolean isOptionsSet()
        Returns:
        were options set on the command line?
      • setOptionsSet

        public void setOptionsSet​(boolean optionsSet)
        Set whether the program options have already been set.
        Parameters:
        optionsSet -
      • getProgramArguments

        public String[] getProgramArguments()
        Return an array of asadmin command line options that specify all the options of this ProgramOptions instance.
        Returns:
      • getPlainOption

        public String getPlainOption​(String name)
        Option by name just as was parsed. No added value.
        Parameters:
        name - The name of the option
        Returns:
        The value as parsed
      • getClassPath

        public String getClassPath()
        Returns:
        the classPath
      • setClassPath

        public void setClassPath​(String classPath)
        Parameters:
        classPath - the classPath to set
      • getClassName

        public String getClassName()
        Returns:
        the className
      • setClassName

        public void setClassName​(String className)
        Parameters:
        className - the className to set
      • getCommandName

        public String getCommandName()
        Returns:
        the name of the command (not the subcommand)
      • setCommandName

        public void setCommandName​(String commandName)
        Parameters:
        commandName - the name of the command (not the subcommand)
      • toString

        public String toString()
        String representation of the asadmin program options. Included in the --echo output.
        Overrides:
        toString in class Object
        Returns: