diff options
Diffstat (limited to 'pdf-as-web/src/main/java')
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticFrontend.java | 72 | ||||
-rw-r--r-- | pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/impl/StatisticFileBackend.java | 1 |
2 files changed, 39 insertions, 34 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticFrontend.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticFrontend.java index 3c59a7cc..f006be54 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticFrontend.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticFrontend.java @@ -39,36 +39,41 @@ public class StatisticFrontend implements StatisticBackend { while (statisticIterator.hasNext()) { StatisticBackend statisticBackend = statisticIterator.next(); - - if(enabledBackends == null || enabledBackends.contains(statisticBackend - .getName())) { + + if (enabledBackends == null + || enabledBackends.contains(statisticBackend.getName())) { logger.info("adding Statistic Logger {} [{}]", statisticBackend .getName(), statisticBackend.getClass().getName()); - - statisticBackends.add(statisticBackend); + + statisticBackends.add(statisticBackend); } else { - logger.info("skipping Statistic Logger {} [{}]", statisticBackend - .getName(), statisticBackend.getClass().getName()); + logger.info("skipping Statistic Logger {} [{}]", + statisticBackend.getName(), statisticBackend.getClass() + .getName()); } } - - - Iterator<String> enabledBackendsIterator = enabledBackends - .iterator(); - while (enabledBackendsIterator.hasNext()) { - String enabledBackend = enabledBackendsIterator.next(); - statisticIterator = statisticBackends.iterator(); - boolean found = false; - while (statisticIterator.hasNext()) { - StatisticBackend statisticBackend = statisticIterator.next(); - if(statisticBackend.getName().equals(enabledBackend)) { - found = true; - break; + + if (enabledBackends != null) { + Iterator<String> enabledBackendsIterator = enabledBackends + .iterator(); + while (enabledBackendsIterator.hasNext()) { + String enabledBackend = enabledBackendsIterator.next(); + statisticIterator = statisticBackends.iterator(); + boolean found = false; + while (statisticIterator.hasNext()) { + StatisticBackend statisticBackend = statisticIterator + .next(); + if (statisticBackend.getName().equals(enabledBackend)) { + found = true; + break; + } + } + + if (!found) { + logger.warn( + "Failed to load statistic backend {}. Not in classpath?", + enabledBackend); } - } - - if(!found) { - logger.warn("Failed to load statistic backend {}. Not in classpath?", enabledBackend); } } } @@ -80,29 +85,28 @@ public class StatisticFrontend implements StatisticBackend { return _instance; } - @Override public String getName() { return StatisticFrontend.class.getSimpleName(); } - @Override public void storeEvent(StatisticEvent statisticEvent) { - - if(statisticEvent == null) { + + if (statisticEvent == null) { logger.warn("Tried to log null as statisticEvent!"); return; } - - if(statisticEvent.isLogged()) { + + if (statisticEvent.isLogged()) { logger.warn("Tried to relog statisticEvent!"); return; } - - Iterator<StatisticBackend> statisticBackendIterator = statisticBackends.iterator(); - - while(statisticBackendIterator.hasNext()) { + + Iterator<StatisticBackend> statisticBackendIterator = statisticBackends + .iterator(); + + while (statisticBackendIterator.hasNext()) { StatisticBackend statisticBackend = statisticBackendIterator.next(); statisticBackend.storeEvent(statisticEvent); } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/impl/StatisticFileBackend.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/impl/StatisticFileBackend.java index 531c47bf..997bcfdd 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/impl/StatisticFileBackend.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/stats/impl/StatisticFileBackend.java @@ -30,6 +30,7 @@ public class StatisticFileBackend implements StatisticBackend { addCSVValue(String.valueOf(statisticEvent.getTimestamp()), sb); addCSVValue(statisticEvent.getOperation().getName(), sb); addCSVValue(statisticEvent.getDevice(), sb); + addCSVValue(statisticEvent.getSource().getName(), sb); addCSVValue(statisticEvent.getProfileId(), sb); addCSVValue(String.valueOf(statisticEvent.getFilesize()), sb); addCSVValue(statisticEvent.getUserAgent(), sb); |