Builder withDatasources()

in src/main/java/org/apache/sling/commons/metrics/rrd4j/impl/RRD4JReporter.java [98:124]


        Builder withDatasources(String[] datasources) {
            if (datasources == null) {
                datasources = new String[0];
            }

            this.indexedDS.clear();
            this.dictionary.clear();

            int i = 0;
            for (String ds : datasources) {
                String[] tokens = ds.split(":");
                if (tokens.length == 6) {
                    String key = normalize(tokens[1]);
                    tokens[1] = String.valueOf(i);
                    try {
                        indexedDS.add(checkDataSource(join(":", tokens)));
                        dictionary.put(key, i);
                    } catch (IllegalArgumentException ex) {
                        LOGGER.warn("Ignoring malformed datasource {}.", ds);
                    }
                } else {
                    LOGGER.warn("Ignoring malformed datasource {}.", ds);
                }
                i++;
            }
            return this;
        }