Search in sources :

Example 1 with ConfigLevelContext

use of com.sun.enterprise.security.admin.cli.SecureAdminCommand.ConfigLevelContext in project Payara by payara.

the class SecureAdminUpgradeHelper method ensureConfigReady.

private boolean ensureConfigReady(final Config c) throws TransactionFailure {
    /*
         * See if this config is already set up for secure admin.
         */
    final NetworkConfig nc = c.getNetworkConfig();
    if (nc == null) {
        /*
             * If there is no network config for this configuration then it is
             * probably a test configuration of some sort.  In any case, there
             * is no lower-level network protocols to verify so declare this
             * config to be OK.
             */
        return true;
    }
    Protocol secAdminProtocol = nc.getProtocols().findProtocol(SecureAdminCommand.SEC_ADMIN_LISTENER_PROTOCOL_NAME);
    if (secAdminProtocol != null) {
        return true;
    }
    final EnableSecureAdminCommand enableCmd = new EnableSecureAdminCommand();
    final Config c_w = transaction().enroll(c);
    ConfigLevelContext configLevelContext = new ConfigLevelContext(topLevelContext(), c_w);
    for (Iterator<Work<ConfigLevelContext>> it = enableCmd.perConfigSteps(); it.hasNext(); ) {
        final Work<ConfigLevelContext> step = it.next();
        if (!step.run(configLevelContext)) {
            rollback();
            return false;
        }
    }
    return true;
}
Also used : ConfigLevelContext(com.sun.enterprise.security.admin.cli.SecureAdminCommand.ConfigLevelContext) Config(com.sun.enterprise.config.serverbeans.Config) NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) NetworkConfig(org.glassfish.grizzly.config.dom.NetworkConfig) Work(com.sun.enterprise.security.admin.cli.SecureAdminCommand.Work) Protocol(org.glassfish.grizzly.config.dom.Protocol)

Aggregations

Config (com.sun.enterprise.config.serverbeans.Config)1 ConfigLevelContext (com.sun.enterprise.security.admin.cli.SecureAdminCommand.ConfigLevelContext)1 Work (com.sun.enterprise.security.admin.cli.SecureAdminCommand.Work)1 NetworkConfig (org.glassfish.grizzly.config.dom.NetworkConfig)1 Protocol (org.glassfish.grizzly.config.dom.Protocol)1