public abstract class SecureAdminCommand extends Object implements AdminCommand
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.
Modifier and Type | Field and Description |
---|---|
static String |
ADMIN_LISTENER_NAME |
protected Domain |
domain |
Constructor and Description |
---|
SecureAdminCommand() |
Modifier and Type | Method and 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.
|
public static final String ADMIN_LISTENER_NAME
@Inject protected Domain domain
protected abstract String transactionErrorMessageKey()
Each concrete subclass overrides this to supply the relevant message key.
public void run() throws TransactionFailure, SecureAdminHelper.SecureAdminCommandException
This is separate from the execute method so it can be invoked during upgrade.
public void execute(AdminCommandContext context)
execute
in interface AdminCommand
context
- Copyright © 2020. All rights reserved.