org.glassfish.api.admin
Class CommandModel

java.lang.Object
  extended by org.glassfish.api.admin.CommandModel

public abstract class CommandModel
extends java.lang.Object

Model for an administrative command

Author:
Jerome Dochez

Nested Class Summary
static class CommandModel.ParamModel
          Model for a command parameter.
 
Constructor Summary
CommandModel()
           
 
Method Summary
abstract  ExecuteOn getClusteringAttributes()
          Return the cluster parameters for this command or null if none are specified and defaults should be used.
abstract  java.lang.Class<?> getCommandClass()
          Return the class that defines the command.
abstract  java.lang.String getCommandName()
          Returns the command name as it is typed by the user.
abstract  java.lang.String getLocalizedDescription()
          Returns a localized description for this command
abstract  CommandModel.ParamModel getModelFor(java.lang.String paramName)
          Returns the parameter model for a particular parameter
 java.util.Collection<CommandModel.ParamModel> getParameters()
          Returns a collection of parameter model for all the parameters supported by this command.
abstract  java.util.Collection<java.lang.String> getParametersNames()
          Returns a collection of parameter names supported by this admininstrative command
static java.lang.String getParamName(Param param, java.lang.reflect.AnnotatedElement annotated)
          Get the Param name.
abstract  java.lang.String getUsageText()
          Returns a localized usage text for this command or null if the usage text should be generated from this model.
 boolean unknownOptionsAreOperands()
          Should an unknown option be considered an operand by asadmin?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandModel

public CommandModel()
Method Detail

getCommandName

public abstract java.lang.String getCommandName()
Returns the command name as it is typed by the user.

Returns:
the command name

getLocalizedDescription

public abstract java.lang.String getLocalizedDescription()
Returns a localized description for this command

Returns:
a localized displayable description

getUsageText

public abstract java.lang.String getUsageText()
Returns a localized usage text for this command or null if the usage text should be generated from this model.

Returns:
the usage text

getModelFor

public abstract CommandModel.ParamModel getModelFor(java.lang.String paramName)
Returns the parameter model for a particular parameter

Parameters:
paramName - the requested parameter model name
Returns:
the parameter model if the command supports a parameter of the passed name or null if not.

getParametersNames

public abstract java.util.Collection<java.lang.String> getParametersNames()
Returns a collection of parameter names supported by this admininstrative command

Returns:
all the command's paramter names.

getCommandClass

public abstract java.lang.Class<?> getCommandClass()
Return the class that defines the command. Normally this will be the class that provides the implementation of the command, but for generic CRUD commands it might be the config class that defines the command. The command class is used to locate resources related to the command, e.g., the command's man page. If the command model isn't associated with a command class, null is returned.

Returns:
the command class, or null if none

getClusteringAttributes

public abstract ExecuteOn getClusteringAttributes()
Return the cluster parameters for this command or null if none are specified and defaults should be used.

Returns:
a ExecuteOn annotation instance or null

getParameters

public java.util.Collection<CommandModel.ParamModel> getParameters()
Returns a collection of parameter model for all the parameters supported by this command.

Returns:
the command's parameters models.

getParamName

public static java.lang.String getParamName(Param param,
                                            java.lang.reflect.AnnotatedElement annotated)
Get the Param name. First it checks if the annotated Param includes a name, if not then it gets the name from the field. If the parameter is a password, add the prefix and change the name to upper case.

Parameters:
param - class annotation
annotated - annotated field or method
Returns:
the name of the param

unknownOptionsAreOperands

public boolean unknownOptionsAreOperands()
Should an unknown option be considered an operand by asadmin?

Returns:
true if unknown options are operands.


Copyright © 2012 GlassFish Community. All Rights Reserved.