Subversion Repositories eFlore/Applications.del

Rev

Rev 938 | Rev 1010 | 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"));
30
		urls.put("del", configuration.get("delUrl"));
31
		urls.put("bogue", configuration.get("bogueUrl"));
32
		urls.put("commentaire", configuration.get("commentaireUrl"));
33
	}
34
 
35
	/**
36
	 * Accesseur pour l'url de base du serveur jrest
37
	 *
38
	 * @return une url de la forme http://emplacement_serveur/jrest
39
	 */
40
	public String getServiceBaseUrl() {
41
		return getUrl("base");
42
	}
43
 
44
	public String getUrl(String code) {
553 jpm 45
		String url = "";
532 jpm 46
		if (urls.containsKey(code)) {
553 jpm 47
			url = urls.get(code);
532 jpm 48
		}
553 jpm 49
		return url;
532 jpm 50
	}
51
 
52
}