Subversion Repositories eFlore/Applications.cel

Rev

Rev 235 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.modeles;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Dictionary;

/**
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
 * javascript (config.js)
 * 
 * @author aurelien
 * 
 */
public class Configuration {

        /**
         * L'url de base du serveur jrest
         */
        private static String serviceBaseUrl;

        private static String imageBaseUrl;
        
        private static String suiviBugUrl ;
        
        private static String aideBaseUrl ;

        /**
         * Constructeur sans argument
         */
        public Configuration() {
                // on utilise le dictionnaire d'internationalisation pour lire les
                // variables du fichier javascript
                
                if(GWT.isScript()) {
                        serviceBaseUrl = Dictionary.getDictionary("configuration").get(
                                        "serviceBaseUrl");
                        suiviBugUrl = Dictionary.getDictionary("configuration").get(
                        "suiviBugUrl");
                        imageBaseUrl = Dictionary.getDictionary("configuration").get(
                        "imageBaseUrl");
                        aideBaseUrl = Dictionary.getDictionary("configuration").get(
                        "aideBaseUrl");
                }
                else
                {
                        serviceBaseUrl = "http://localhost/jrest";
                        suiviBugUrl = "http://www.tela-botanica.org/suivi/index.php?do=newtask&project=2";
                        aideBaseUrl = "http://www.tela-botanica.org/wikini/eflore/wakka.php?wiki=AideCEL";
                        imageBaseUrl = "http://localhost/Documents/images_serveur/"; 
                }
        }

        /**
         * Accesseur pour l'url de base du serveur jrest
         * 
         * @return une url de la forme http://emplacement_serveur/jrest
         */
        public static String getServiceBaseUrl() {
                return serviceBaseUrl;
        }
        
        /**
         * Accesseur pour l'url de base du suivi de bug
         * 
         * @return une url pointant vers le suivi des bugs
         */
        public static String getSuiviBugUrl() {
                return suiviBugUrl;
        }
        
        /**
         * Accesseur pour l'url de base des images
         * 
         * @return une url pointant vers la racine du dossier contenant les images
         */
        public static String getImageBaseUrl() {
                return imageBaseUrl ;
        }
        
        /**
         * Accesseur pour l'url de base de l'aide
         * 
         * @return une url pointant vers la racine de l'aide
         */
        public static String getAideBaseUrl() {
                return aideBaseUrl ;
        }
        
        

}