package org.n52.geolabel.server.config;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TransformationDescriptionResources {

    protected static final Logger log = LoggerFactory.getLogger(TransformationDescriptionResources.class);

    private static final String TRANSFORMATIONS_RESOURCE = "transformations";

    public static enum Source {
        ONLINE, FALLBACK, NA;
    }

    /**
     * map between normative URL and fallback
     */
    private Map<URL, String> transformationDescriptionResources = new HashMap<>();

    public TransformationDescriptionResources() {
        try {
            this.transformationDescriptionResources.put(new URL("http://geoviqua.github.io/geolabel/mappings/transformerGVQ.json"),
                                                        "/" + TRANSFORMATIONS_RESOURCE + "/transformer.json");
        }
        catch (MalformedURLException e) {
            log.error("Could not create transformation description resources.", e);
        }
    }

    public TransformationDescriptionResources(Map<URL, String> resources) {
        this();
        this.transformationDescriptionResources.putAll(resources);
    }

    public Map<URL, String> getTransformationDescriptionResources() {
        return this.transformationDescriptionResources;
    }

    public void setTransformationDescriptionResources(Map<URL, String> transformationDescriptionResources) {
        this.transformationDescriptionResources = transformationDescriptionResources;
    }

}

@@ -603,34 +603,9 @@
 ng%3E 
-transformationDescriptionR
+r
 esou
@@ -714,34 +714,9 @@
 his.
-transformationDescriptionR
+r
 esou
@@ -792,11 +792,8 @@
 rmer
-GVQ
 .jso
@@ -1153,51 +1153,10 @@
 this
-();%0A        this.transformationDescriptionR
+.r
 esou
@@ -1221,33 +1221,8 @@
  get
-TransformationDescription
 Reso
@@ -1255,34 +1255,9 @@
 his.
-transformationDescriptionR
+r
 esou
@@ -1292,33 +1292,8 @@
  set
-TransformationDescription
 Reso
@@ -1366,16 +1366,28 @@
    this.
+resources = 
 transfor
@@ -1416,45 +1416,375 @@
 rces
- = transformationDescriptionResources
+;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        StringBuilder builder = new StringBuilder();%0A        builder.append(%22TransformationDescriptionResources %5B%22);%0A        if (this.resources != null) %7B%0A            builder.append(%22resources=%22);%0A            builder.append(this.resources);%0A        %7D%0A        builder.append(%22%5D%22);%0A        return builder.toString()
 ;%0A  

update path to normative transformer file