Method to start transformation of sun-acc XML file
logger.log(Level.INFO, stringManager.getString(
"upgrade.configTransfers.sunacc.startMessage"));
File sourceFile = new File(sourceFileName);
File targetFile = new File(targetFileName);
//Get the DOCTYPE and security-config of target file
try {
docType = this.getDOCTYPEString(targetFile);
secPolicyProperty = this.getSecurityConfigValue(targetFile);
} catch(Exception e) {}
//Backup the target file before processing
boolean renamed = targetFile.renameTo(new File(targetFileName+".bak"));
if(!renamed){
// This is possible if user is running the upgrade again
//and .bak is already created.
renamed = targetFile.delete();
}
//Transfer file contents if backed up
if(renamed){
try{
targetFile = new File(targetFileName);
targetFile.createNewFile();
this.transferFileContents(sourceFile, targetFile);
}catch(Exception ex){
// Log error message
logger.log(Level.SEVERE, stringManager.getString(
"upgrade.configTransfers.sunacc.startFailureMessage"),ex);
}
}else{
// Log error message : rename failure
logger.log(Level.SEVERE, stringManager.getString(
"upgrade.configTransfers.sunacc.renameFailureMessage"));
}