private static ICarbonLock getDataMapStatusLock() { return CarbonLockFactory .getSystemLevelCarbonLockObj(CarbonProperties.getInstance().getSystemFolderLocation(), LockUsage.DATAMAP_STATUS_LOCK); } }
/** * verify whether the file exists * if delete the file success or file not exists, then return true; otherwise return false * * @return boolean */ public static boolean cleanMdtFile() { String fileName = CarbonProperties.getInstance().getSystemFolderLocation() + CarbonCommonConstants.FILE_SEPARATOR + "datamap.mdtfile"; try { if (FileFactory.isFileExist(fileName)) { File file = new File(fileName); return file.delete(); } else { return true; } } catch (IOException e) { e.printStackTrace(); return false; } }
/** * verify whether the mdt file exists * if the file exists, then return true; otherwise return false * * @return boolean */ public static boolean verifyMdtFile() { String fileName = CarbonProperties.getInstance().getSystemFolderLocation() + CarbonCommonConstants.FILE_SEPARATOR + "datamap.mdtfile"; try { if (FileFactory.isFileExist(fileName)) { return true; } return false; } catch (IOException e) { throw new RuntimeException("IO exception:", e); } } }
@Override public DataMapStatusDetail[] getDataMapStatusDetails() throws IOException { String statusPath = CarbonProperties.getInstance().getSystemFolderLocation() + CarbonCommonConstants.FILE_SEPARATOR + DATAMAP_STATUS_FILE; Gson gsonObjectToRead = new Gson();
dataMapStatusList.removeAll(changedStatusDetails); writeLoadDetailsIntoFile(CarbonProperties.getInstance().getSystemFolderLocation() + CarbonCommonConstants.FILE_SEPARATOR + DATAMAP_STATUS_FILE, dataMapStatusList.toArray(new DataMapStatusDetail[dataMapStatusList.size()]));