FileDocCategorySizeDatePackage
CertificateArgumentHandler.javaAPI DocGlassfish v2 API4860Fri May 04 22:35:06 BST 2007com.sun.enterprise.tools.upgrade.common.arguments

CertificateArgumentHandler

public abstract class CertificateArgumentHandler extends ArgumentHandler
author
Hans Hrasna

Fields Summary
Constructors Summary
public CertificateArgumentHandler(ParsedArgument pa)
Creates a new instance of CertificateArgumentHandler

        super(pa);
        commonInfo.setCertificateConversionFlag(true);
    
Methods Summary
protected voidprocessCertificatePasswords(java.lang.String pwdfile)
processCertificatePasswords Reads password triplets or doublets from passwordFile and sets them in CommonInfoModel format: domain_name instance_name password or: domain_name password

        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pwdfile)));
            while(reader.ready()){
                String entry = reader.readLine();
                StringTokenizer tokens = new StringTokenizer(entry, " ", false);
                int tokenCount = tokens.countTokens();
                if (tokenCount < 1){
                    _logger.severe(sm.getString("enterprise.tools.upgrade.cli.password_missing",pwdfile));
                    System.exit(1);
                }
                if (tokenCount > 1) {
                    String domainName = tokens.nextToken();                    
                    commonInfo.setCurrentDomain(domainName);
                    commonInfo.addDomainOptionName(domainName);
                }
                if (tokenCount == 3) {
                    commonInfo.setCurrentSourceInstance(tokens.nextToken());
                }
                setCertificatePassword(tokens.nextToken());
                if(commonInfo.getSourceVersion().equals(UpgradeConstants.VERSION_7X)) {
                    interactiveMap.put(ArgsParser.DOMAIN + "-" + commonInfo.getCurrentDomain() + ":" + commonInfo.getCurrentSourceInstance(), pwdfile);
                } else interactiveMap.put(ArgsParser.DOMAIN + "-" + commonInfo.getCurrentDomain(), pwdfile);
            }
        } catch(FileNotFoundException fe) {
            helpUsage();
            _logger.log(Level.SEVERE,sm.getString("enterprise.tools.upgrade.cli.password_file_missing",pwdfile),fe);
            System.exit(1);
        } catch(Exception io) {
            _logger.log(Level.SEVERE,sm.getString("enterprise.tools.upgrade.cli.password_missing",pwdfile),io);
            System.exit(1);
        }
    
protected abstract voidsetCertificatePassword(java.lang.String pwd)