/** * Generate few namespaces for this logging application. Resolve number of namespaces for this app * based on applicationNamespaceLength property and set them to LogFiles. * * @param logFileList input list of logFiles, which contain only filepath and package qualified * name. * @return same list of logFiles, but each of them has filled appropriate namespace. */ public static Set<LogFile> generateNamespaces(Set<LogFile> logFileList) { LOG.applicationNamespaceLength(Utils.getApplicationNamespaceLength()).trace(); for (LogFile lf : logFileList) { if (lf.getPackageName() == null) { LOG.emptyPackageNameInFile(lf.getFilepath()).error(); } String namespace = createNamespace(lf.getPackageName()); LOG.new_namespace(namespace).trace(); lf.setNamespace(namespace); } return logFileList; }
/** * Add LogFile object to namespaceCreationMap. When all files are parsed, use this map to create * new files. * * @param logFile to add to namespaceCreationMap */ public static void addToNamespaceCreationMap(LogFile logFile) { if (logFile == null) { throw new IllegalArgumentException("logFile is null!"); } LOG.namespaceNamespaceClass(logFile.getWholeNamespace()).trace(); Set<LogFile> logFiles; if (namespaceCreationMap.containsKey(logFile.getWholeNamespace())) { logFiles = namespaceCreationMap.get(logFile.getWholeNamespace()); } else { logFiles = new TreeSet<>(); } logFiles.add(logFile); namespaceCreationMap.put(logFile.getWholeNamespace(), logFiles); }