FileDocCategorySizeDatePackage
ARG_noprompt.javaAPI DocGlassfish v2 API5587Mon Aug 13 15:58:00 BST 2007com.sun.enterprise.tools.upgrade.common.arguments

ARG_noprompt

public class ARG_noprompt extends ArgumentHandler
author
Hans Hrasna

Fields Summary
private String
defaultAdminUser
private String
defaultAdminPassword
private String
defaultMasterPassword
Constructors Summary
public ARG_noprompt(ParsedArgument pa)
Creates a new instance of ARG_noprompt

    
           
       
        super(pa);
		commonInfo.setNoprompt(true);
		
        //Silent upgrade support with default values
        if (commonInfo.getAdminUserName() == null){
            commonInfo.setAdminUserName(defaultAdminUser);
            interactiveMap.put(ArgsParser.ADMINUSER,defaultAdminUser);
        }
        if (commonInfo.getAdminPassword() == null){
            commonInfo.setAdminPassword(defaultAdminPassword);
            interactiveMap.put(ArgsParser.ADMINPASSWORD,defaultAdminPassword);
        }
        if (commonInfo.getMasterPassword() == null) {
            commonInfo.setMasterPassword(defaultMasterPassword);
        }
        
        // set up silent certificate upgrade
        commonInfo.setCertificateConversionFlag(true);
        List domainList = commonInfo.getDomainList();
        Iterator it = domainList.iterator();
        while (it.hasNext()){
            //attempt certificate migration for each domain
            String domainName = (String)it.next();
            commonInfo.setCurrentDomain(domainName);
            //commonInfo.setJksCAKeystorePassword(password);
            String password = UpgradeUtils.getUpgradeUtils(commonInfo).getJvmOptionValueFromSourceConfig("javax.net.ssl.keyStorePassword");
            if(password == null) {
                password = commonInfo.getMasterPassword();
            }
            commonInfo.setJksKeystorePassword(password);
            String trustPassword = UpgradeUtils.getUpgradeUtils(commonInfo).getJvmOptionValueFromSourceConfig("javax.net.ssl.trustStorePassword");
            if(trustPassword == null) {
                trustPassword = commonInfo.getMasterPassword();
            }
            commonInfo.setJksCAKeystorePassword(trustPassword);
            commonInfo.addDomainOptionName(domainName);
            interactiveMap.put(ArgsParser.DOMAIN + "-" + commonInfo.getCurrentDomain(), domainName);
            interactiveMap.put(ArgsParser.JKSPWD + "-" + domainName, password);
            interactiveMap.put(ArgsParser.CAPWD + "-" + domainName, password);
            interactiveMap.put(ArgsParser.NSSPWD + "-" + domainName, password);
            interactiveMap.put(ArgsParser.TARGETNSSPWD + "-" + domainName, password);
            commonInfo.setCertDbPassword(commonInfo.getCurrentDomain(), password);
            String jksPath=commonInfo.getSourceJKSKeyStorePath();
            if(!PasswordVerifier.verifyKeystorePassword(jksPath,password )) {
                commonInfo.recover();
                _logger.severe(sm.getString("enterprise.tools.upgrade.cli.Invalid_jks_keypair_password"));
                System.exit(1);
            }
            String trustJksPath = commonInfo.getSourceTrustedJKSKeyStorePath();
            if(!PasswordVerifier.verifyKeystorePassword(trustJksPath,trustPassword)) {
                commonInfo.recover();
                _logger.severe(sm.getString("enterprise.tools.upgrade.cli.Invalid_jks_CA_password"));
                System.exit(1);
            }
        }
    
Methods Summary