Class SecureAdminCommand

  • All Implemented Interfaces:
    org.glassfish.api.admin.AdminCommand
    Direct Known Subclasses:
    DisableSecureAdminCommand, EnableSecureAdminCommand

    public abstract class SecureAdminCommand
    extends Object
    implements org.glassfish.api.admin.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 Detail

      • domain

        @Inject
        protected com.sun.enterprise.config.serverbeans.Domain domain
    • Constructor Detail

      • SecureAdminCommand

        public SecureAdminCommand()
    • 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 org.jvnet.hk2.config.TransactionFailure,
                        com.sun.enterprise.config.serverbeans.SecureAdminHelper.SecureAdminCommandException
        Performs the enable/disable logic for secure admin.

        This is separate from the execute method so it can be invoked during upgrade.

        Throws:
        org.jvnet.hk2.config.TransactionFailure
        com.sun.enterprise.config.serverbeans.SecureAdminHelper.SecureAdminCommandException
      • execute

        public void execute​(org.glassfish.api.admin.AdminCommandContext context)
        Executes the particular xxx-secure-admin command (enable or disable).
        Specified by:
        execute in interface org.glassfish.api.admin.AdminCommand
        Parameters:
        context -