Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java @ 171:7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Oct 2009 07:54:48 +0000 |
parents | 8cc96c9cc962 |
children | 7b4e2f80cba2 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Fri Oct 09 07:49:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java Fri Oct 09 07:54:48 2009 +0000 @@ -12,7 +12,7 @@ /** * @author Tim Englich <tim.englich@intevation.de> - * + * */ public class RessourceFactory { @@ -20,17 +20,17 @@ * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(RessourceFactory.class); - + /** * The singleton Instance of this Factory. */ private static RessourceFactory instance = null; private static String RESSOURCE_BASE_ID = "artifact.ressource.dir"; - + private static String ressourceName = "artifactMessages"; - private static String DEFAULT_DIR = "lang"; - + private static String DEFAULT_DIR = "lang"; + private String ressourceDir = null; /** @@ -43,39 +43,40 @@ /** * This Method provides an singleton Instance of this Class. + * * @return an singleton Instance of this Class */ - public static synchronized RessourceFactory getInstance(){ - if (instance == null){ + public static synchronized RessourceFactory getInstance() { + if (instance == null) { instance = new RessourceFactory(); } return instance; } - + /** * Deliveres the translated Value for an Key to an given Language - * @param locale The choosen locale - * @param key the key - * @param defaultValue the Value that should be returned. + * + * @param locale + * The choosen locale + * @param key + * the key + * @param defaultValue + * the Value that should be returned. * @return the translated Value */ - public String getRessource( - PreferredLocale [] preferredLocales, - String key, - String defaultValue - ) { + public String getRessource(PreferredLocale[] preferredLocales, String key, + String defaultValue) { if (key == null || preferredLocales.length == 0) { return defaultValue; } try { - ResourceBundle rb = ResourceBundle.getBundle( - ressourceDir + "/" + ressourceName, - preferredLocales[0].getLocale()); + ResourceBundle rb = ResourceBundle.getBundle(ressourceDir + "/" + + ressourceName, + preferredLocales[0].getLocale()); return rb.getString(key); - } - catch (MissingResourceException mre) { + } catch (MissingResourceException mre) { log.warn(mre.getLocalizedMessage()); return defaultValue; }