Subversion Repositories eFlore/Applications.del

Rev

Rev 1104 | Rev 1165 | 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;
1104 gduche 7
import com.google.gwt.user.client.Window;
532 jpm 8
 
9
/**
10
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
11
 * javascript (config.js)
12
 *
13
 * @author Jean-Pascal MILCENT
14
 *
15
 */
16
public class Config {
17
 
18
 
19
	/**
20
	 * Tableau associatif contenant les identifiants des urls externes
21
	 */
22
	private LinkedHashMap<String, String> urls = new LinkedHashMap<String, String>();
23
 
24
	/**
25
	 * Constructeur sans argument
26
	 */
27
	public Config() {
28
		// on utilise le dictionnaire d'internationalisation pour lire les variables du fichier javascript
29
		Dictionary configuration = Dictionary.getDictionary("configuration");
30
		urls.put("base", configuration.get("serviceBaseUrl"));
31
		urls.put("del", configuration.get("delUrl"));
32
		urls.put("bogue", configuration.get("bogueUrl"));
33
		urls.put("commentaire", configuration.get("commentaireUrl"));
1010 aurelien 34
		urls.put("applisaisie", configuration.get("appliSaisieUrl"));
1079 gduche 35
		urls.put("annuaire", configuration.get("annuaireUrl"));
1104 gduche 36
		urls.put("eflore", configuration.get("efloreUrl"));
37
		urls.put("efloreTaxon", configuration.get("efloreTaxonUrl"));
38
		urls.put("bonnierPda", configuration.get("bonnierPdaUrl"));
39
		urls.put("ouvragesFlore", configuration.get("ouvragesFloreUrl"));
40
		urls.put("clesDetermination", configuration.get("clesDeterminationUrl"));
1120 gduche 41
		urls.put("rss", configuration.get("rssUrl"));
532 jpm 42
	}
43
 
44
	/**
45
	 * Accesseur pour l'url de base du serveur jrest
46
	 *
47
	 * @return une url de la forme http://emplacement_serveur/jrest
48
	 */
49
	public String getServiceBaseUrl() {
50
		return getUrl("base");
51
	}
52
 
53
	public String getUrl(String code) {
553 jpm 54
		String url = "";
532 jpm 55
		if (urls.containsKey(code)) {
553 jpm 56
			url = urls.get(code);
532 jpm 57
		}
553 jpm 58
		return url;
532 jpm 59
	}
60
 
61
}