Subversion Repositories eFlore/Applications.del

Rev

Rev 532 | Rev 554 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
532 jpm 1
package org.tela_botanica.del.client.config;
2
 
3
import java.util.LinkedHashMap;
4
 
553 jpm 5
import com.google.gwt.core.client.GWT;
532 jpm 6
import com.google.gwt.i18n.client.Dictionary;
7
 
8
/**
9
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
10
 * javascript (config.js)
11
 *
12
 * @author Jean-Pascal MILCENT
13
 *
14
 */
15
public class Config {
16
 
17
 
18
	/**
19
	 * Tableau associatif contenant les identifiants des urls externes
20
	 */
21
	private LinkedHashMap<String, String> urls = new LinkedHashMap<String, String>();
22
 
23
	/**
24
	 * Constructeur sans argument
25
	 */
26
	public Config() {
27
		// on utilise le dictionnaire d'internationalisation pour lire les variables du fichier javascript
28
		Dictionary configuration = Dictionary.getDictionary("configuration");
29
		urls.put("base", configuration.get("serviceBaseUrl"));
553 jpm 30
		urls.put("nomSciCompletionService", configuration.get("nomSciCompletionService"));
31
		urls.put("communeCompletionService", configuration.get("communeCompletionService"));
532 jpm 32
		urls.put("del", configuration.get("delUrl"));
33
		urls.put("bogue", configuration.get("bogueUrl"));
34
		urls.put("commentaire", configuration.get("commentaireUrl"));
35
	}
36
 
37
	/**
38
	 * Accesseur pour l'url de base du serveur jrest
39
	 *
40
	 * @return une url de la forme http://emplacement_serveur/jrest
41
	 */
42
	public String getServiceBaseUrl() {
43
		return getUrl("base");
44
	}
45
 
46
	public String getUrl(String code) {
553 jpm 47
		String url = "";
532 jpm 48
		if (urls.containsKey(code)) {
553 jpm 49
			url = urls.get(code);
532 jpm 50
		}
553 jpm 51
		return url;
532 jpm 52
	}
53
 
54
}