static Map loadPoints()

in alerting/service/src/main/java/org/apache/karaf/decanter/alerting/service/store/LuceneStoreImpl.java [70:94]


    static Map<String, PointsConfig> loadPoints() throws Exception {
        Map<String, PointsConfig> points = new HashMap<>();
        Properties pointsStore = new Properties();
        File file = Paths.get(System.getProperty("karaf.data"), POINTS_DIRECTORY).toFile();
        if (file.exists()) {
            FileReader reader = new FileReader(Paths.get(System.getProperty("karaf.data"), POINTS_DIRECTORY).toFile());
            pointsStore.load(reader);
            for (Object key : pointsStore.keySet()) {
                String value = pointsStore.get(key).toString();
                if (value.equals("double")) {
                    points.put(key.toString(), new PointsConfig(NumberFormat.getInstance(), Double.class));
                }
                if (value.equals("float")) {
                    points.put(key.toString(), new PointsConfig(NumberFormat.getInstance(), Float.class));
                }
                if (value.equals("integer")) {
                    points.put(key.toString(), new PointsConfig(NumberFormat.getInstance(), Integer.class));
                }
                if (value.equals("long")) {
                    points.put(key.toString(), new PointsConfig(NumberFormat.getInstance(), Long.class));
                }
            }
        }
        return points;
    }