- File configHomeDir = new File(CONFIG_HOME);
- File[] listOfFiles = configHomeDir.listFiles();
- if (listOfFiles != null) {
- for (File eachFile : listOfFiles) {
- if (eachFile.isFile()) {
- String fileNameWithoutExtension = FilenameUtils
- .removeExtension(eachFile.getName());
- String configFileNameWithoutExtension = FilenameUtils
- .removeExtension(configFileName);
- if (fileNameWithoutExtension
- .equals(configFileNameWithoutExtension)) {
- // delete the file
- eachFile.delete();
- }
- }
- }
- }
-
- /*FileWriter fw = new FileWriter(file.getAbsoluteFile());
- BufferedWriter bw = new BufferedWriter(fw);
- bw.write(jsonBody);
- bw.close();
- if (logger.isDebugEnabled()) {
- logger.debug("Configuration is succesfully saved");
- }*/
-
- try {
-
- if (policyName.endsWith(".xml")) {
- policyName = policyName.substring(0,
- policyName.lastIndexOf(".xml"));
- }
- PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator
- + path + "." + policyName + ".txt");
- out.println(jsonBody);
- out.close();
-
- } catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
- }
-
- } catch (IOException e) {
- e.printStackTrace();