Class SecureAdminCommand
- java.lang.Object
-
- com.sun.enterprise.security.admin.cli.SecureAdminCommand
-
- All Implemented Interfaces:
AdminCommand
- Direct Known Subclasses:
DisableSecureAdminCommand
,EnableSecureAdminCommand
public abstract class SecureAdminCommand extends Object implements AdminCommand
Provides common behavior for the enable and disable secure admin commands.This class, and the concrete subclasses EnableSecureAdminCommand and DisableSecureAdminComment, define what must be done in terms of steps. Each step has enable work and disable work. This class builds arrays of steps, one array which operates at the domain level and one which operates at the config level. The enable work of these steps is run in order through the array to fully enable secure admin, and the disable work of these steps are run in REVERSE order to fully disable secure admin.
I have defined the steps and their enable and disable work here, together in some inner classes, rather than separately in the EnableSecureAdminCommand and DisableSecureAdminCommand classes to try to keep common details together. The concrete subclasses can override a few methods, in particular overriding methods which return an Iterator over the steps to be performed. This way we have a single array of all the steps, with each class returning a forward-running or reverse-running iterator over those steps.
- Author:
- Tim Quinn
-
-
Field Summary
Fields Modifier and Type Field Description static String
ADMIN_LISTENER_NAME
protected Domain
domain
-
Constructor Summary
Constructors Constructor Description SecureAdminCommand()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute(AdminCommandContext context)
Executes the particular xxx-secure-admin command (enable or disable).void
run()
Performs the enable/disable logic for secure admin.protected abstract String
transactionErrorMessageKey()
Returns the error key for finding a message describing an error during the operation - either enable or disable.
-
-
-
Field Detail
-
ADMIN_LISTENER_NAME
public static final String ADMIN_LISTENER_NAME
- See Also:
- Constant Field Values
-
domain
@Inject protected Domain domain
-
-
Method Detail
-
transactionErrorMessageKey
protected abstract String transactionErrorMessageKey()
Returns the error key for finding a message describing an error during the operation - either enable or disable.Each concrete subclass overrides this to supply the relevant message key.
- Returns:
- the message key corresponding to the error message to display
-
run
public void run() throws TransactionFailure, SecureAdminHelper.SecureAdminCommandException
Performs the enable/disable logic for secure admin.This is separate from the execute method so it can be invoked during upgrade.
-
execute
public void execute(AdminCommandContext context)
Executes the particular xxx-secure-admin command (enable or disable).- Specified by:
execute
in interfaceAdminCommand
- Parameters:
context
-
-
-