throws IOException {
if (! (credential instanceof GlobusGSSCredentialImpl) ) {
log.error("Could not create credential file.");
return null;
}
GlobusGSSCredentialImpl gssCredential =
(GlobusGSSCredentialImpl)credential;
String fileName = getCredentialFileName(dn);
File file = null;
// If file doesn't exist then create it...
if (fileName == null) {
// Get file name in which to store credential
fileName = activeCredentialDir
+ DN2MD5Filename(gssCredential.getGlobusCredential().getIdentityCertificate());
file = new File(fileName);
} else {
file = new File(fileName);
}
if (file.exists()) {
file.delete();
}
log.info("Saving credential [" + dn + "] to file " + fileName);
// Write credential to file output stream
FileOutputStream fileOut = null;
try {
fileOut = new FileOutputStream(file);
gssCredential.getGlobusCredential().save(fileOut);
} finally {
if (fileOut != null) {
fileOut.close();
}
}