|
From: Joseph I. <jos...@us...> - 2007-05-05 21:15:13
|
Update of /cvsroot/tolven/tolvenSecurityCommon/src/org/tolven/security/util/credential/certificate In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25260/src/org/tolven/security/util/credential/certificate Modified Files: Tag: P_JI_JavaGenCred CertificateManager.java CredentialsDeployer.java Log Message: Separate certificate deployment from truststore deployment, since truststore deal only with the wiring of certificates. Index: CredentialsDeployer.java =================================================================== RCS file: /cvsroot/tolven/tolvenSecurityCommon/src/org/tolven/security/util/credential/certificate/Attic/CredentialsDeployer.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** CredentialsDeployer.java 5 May 2007 11:26:42 -0000 1.1.2.6 --- CredentialsDeployer.java 5 May 2007 21:15:13 -0000 1.1.2.7 *************** *** 65,69 **** } ! public void deploy(CertificateHelper helper) throws IOException { this.helper = helper; ArrayList deployInfoList = new ArrayList(); --- 65,69 ---- } ! public void deployCertificates(CertificateHelper helper) throws IOException { this.helper = helper; ArrayList deployInfoList = new ArrayList(); *************** *** 71,75 **** deployInfoList.addAll(getKeyDetailDeployInfo()); deployInfoList.addAll(getCertificateKeyStoreDetailsDeployInfo()); - deployInfoList.addAll(getTrustStoreDetailsDeployInfo()); Iterator<DeployInfo> iter = deployInfoList.iterator(); DeployInfo deployInfo = null; --- 71,74 ---- *************** *** 88,91 **** --- 87,108 ---- } + public void deployTrustStores(CertificateHelper helper) throws IOException { + this.helper = helper; + Iterator<DeployInfo> iter = getTrustStoreDetailsDeployInfo().iterator(); + DeployInfo deployInfo = null; + String host = null; + while (iter.hasNext()) { + deployInfo = iter.next(); + host = deployInfo.getCopyTo().toURL().getHost(); + System.out.println("Deploying:\n\t" + deployInfo.getCopyFrom() + " TO\n\t" + deployInfo.getCopyTo()); + if (host == null || host.trim().length() == 0) { + FileUtils.copyFile(deployInfo.getCopyFrom(), deployInfo.getCopyTo()); + } else { + //TODO: Requires Password Input Management + scp(deployInfo.getCopyFrom(), deployInfo.getCopyTo(), new byte[0]); + } + } + } + private List getCertificateDetailDeployInfo() { ArrayList deployInfoList = new ArrayList(); Index: CertificateManager.java =================================================================== RCS file: /cvsroot/tolven/tolvenSecurityCommon/src/org/tolven/security/util/credential/certificate/Attic/CertificateManager.java,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -C2 -d -r1.1.2.15 -r1.1.2.16 *** CertificateManager.java 5 May 2007 11:52:50 -0000 1.1.2.15 --- CertificateManager.java 5 May 2007 21:15:13 -0000 1.1.2.16 *************** *** 60,64 **** } CredentialsDeployer credentialsDeployer = new CredentialsDeployer(); ! credentialsDeployer.deploy(getCertificateHelper()); } --- 60,74 ---- } CredentialsDeployer credentialsDeployer = new CredentialsDeployer(); ! credentialsDeployer.deployCertificates(getCertificateHelper()); ! } ! ! public void deployTrustStores() throws IOException, InterruptedException, JAXBException, SAXException { ! if (getCertificateHelper() == null) { ! setCertificateHelper(new CertificateHelper(getPropertiesFileName())); ! updatePropertyPasswords(getCertificateHelper().getProperties()); ! getCertificateHelper().initialize(); ! } ! CredentialsDeployer credentialsDeployer = new CredentialsDeployer(); ! credentialsDeployer.deployTrustStores(getCertificateHelper()); } *************** *** 91,94 **** --- 101,105 ---- certManager.processCertificateInfo(); certManager.deployCertificates(); + certManager.deployTrustStores(); System.out.println("done"); } |