LbConfigHelper.exportOtdProperties(lbr, fo);
}
if (retrieveFile) {
retrieveLbConfig(context, lbConfigFile, tmpLbWorkerFile);
}
LbConfig lbConfig = lbr.getLbConfig();
//Check for the case when lbtargets are provided
//In such a case, lbconfig will be null
if(lbConfig != null){
lbConfig.setLastExported();
}
String msg = LbLogUtil.getStringManager().getString(
"GeneratedFileLocation", lbConfigFile.toString());
return msg;
} finally {
if (fo != null) {
fo.close();
fo = null;
}
}
} else {
File tmpLbXmlFile = null;
if (retrieveFile) {
tmpLbXmlFile = File.createTempFile("load-balancer", ".xml");
tmpLbXmlFile.deleteOnExit();
} else {
if (lbConfigFile.exists()) {
String msg = LbLogUtil.getStringManager().getString(
"FileExists", lbConfigFile.getPath());
throw new Exception(msg);
}
if (!(lbConfigFile.getParentFile().exists())) {
String msg = LbLogUtil.getStringManager().getString(
"ParentFileMissing", lbConfigFile.getParent());
throw new Exception(msg);
}
tmpLbXmlFile = lbConfigFile;
}
FileOutputStream fo = null;
try {
fo = new FileOutputStream(tmpLbXmlFile);
LbConfigHelper.exportXml(lbr, fo);
if (retrieveFile) {
retrieveLbConfig(context, lbConfigFile, tmpLbXmlFile);
}
LbConfig lbConfig = lbr.getLbConfig();
//Check for the case when lbtargets are provided
//In such a case, lbconfig will be null
if(lbConfig != null){
lbConfig.setLastExported();
}
String msg = LbLogUtil.getStringManager().getString(
"GeneratedFileLocation", lbConfigFile.toString());
return msg;
} finally {