001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/csct/resources/css/Resources.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/exse/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     It has been implemented within SEAGIS - An OpenSource implementation of OpenGIS specification
012     (C) 2001, Institut de Recherche pour le D�veloppement (http://sourceforge.net/projects/seagis/)
013     SEAGIS Contacts:  Surveillance de l'Environnement Assist�e par Satellite
014     Institut de Recherche pour le D�veloppement / US-Espace
015     mailto:seasnet@teledetection.fr
016    
017    
018     This library is free software; you can redistribute it and/or
019     modify it under the terms of the GNU Lesser General Public
020     License as published by the Free Software Foundation; either
021     version 2.1 of the License, or (at your option) any later version.
022    
023     This library is distributed in the hope that it will be useful,
024     but WITHOUT ANY WARRANTY; without even the implied warranty of
025     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
026     Lesser General Public License for more details.
027    
028     You should have received a copy of the GNU Lesser General Public
029     License along with this library; if not, write to the Free Software
030     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
031    
032     Contact:
033    
034     Andreas Poth
035     lat/lon GmbH
036     Aennchenstr. 19
037     53115 Bonn
038     Germany
039     E-Mail: poth@lat-lon.de
040    
041     Klaus Greve
042     Department of Geography
043     University of Bonn
044     Meckenheimer Allee 166
045     53115 Bonn
046     Germany
047     E-Mail: klaus.greve@uni-bonn.de
048    
049     
050     ---------------------------------------------------------------------------*/
051    package org.deegree.model.csct.resources.css;
052    
053    // Miscellaneous
054    import java.util.Locale;
055    import java.util.MissingResourceException;
056    
057    import org.deegree.model.csct.resources.ResourceBundle;
058    
059    /**
060     * Base class for local-dependent resources. Instances of this class should
061     * never been created directly. Use the factory method {@link #getResources}
062     * or use static methods instead.
063     *
064     * @version 1.0
065     * @author Martin Desruisseaux
066     */
067    public class Resources extends ResourceBundle {
068        /**
069         * Construct a resource bundle using english language.
070         * This is the default when no resource are available
071         * in user language.
072         */
073        public Resources() {
074            super( // Set 'true' in front of language to use as default.
075                   false ? Resources_fr.FILEPATH : true ? Resources_en.FILEPATH : null );
076        }
077    
078        /**
079         * Construct a resource bundle
080         * using the specified UTF8 file.
081         */
082        Resources( final String filepath ) {
083            super( filepath );
084        }
085    
086        /**
087         * Returns the name of the logger to use,
088         * which is <code>org.deegree.model.csct.css</code>.
089         */
090        protected String getLoggerName() {
091            return "org.deegree.model.csct.css";
092        }
093    
094        /**
095         * Returns resources in the given locale.
096         *
097         * @param  locale The locale, or <code>null</code> for the default locale.
098         * @return Resources in the given locale.
099         * @throws MissingResourceException if resources can't be found.
100         */
101        public static Resources getResources( Locale locale )
102                                throws MissingResourceException {
103            if ( locale == null )
104                locale = Locale.ENGLISH;
105    
106            return new Resources_en();
107            //return (Resources) getBundle(Resources.class.getName(), locale);
108        }
109    
110        /**
111         * Gets a string for the given key from this resource bundle or one of its parents.
112         *
113         * @param  key The key for the desired string.
114         * @return The string for the given key.
115         * @throws MissingResourceException If no object for the given key can be found.
116         */
117        public static String format( final int key )
118                                throws MissingResourceException {
119            return getResources( null ).getString( key );
120        }
121    
122        /**
123         * Gets a string for the given key are replace all occurence of "{0}"
124         * with values of <code>arg0</code>.
125         *
126         * @param  key The key for the desired string.
127         * @param  arg0 Value to substitute to "{0}".
128         * @return The formatted string for the given key.
129         * @throws MissingResourceException If no object for the given key can be found.
130         */
131        public static String format( final int key, final Object arg0 )
132                                throws MissingResourceException {
133            return getResources( null ).getString( key, arg0 );
134        }
135    
136        /**
137         * Gets a string for the given key are replace all occurence of "{0}",
138         * "{1}", with values of <code>arg0</code>, <code>arg1</code>.
139         *
140         * @param  key The key for the desired string.
141         * @param  arg0 Value to substitute to "{0}".
142         * @param  arg1 Value to substitute to "{1}".
143         * @return The formatted string for the given key.
144         * @throws MissingResourceException If no object for the given key can be found.
145         */
146        public static String format( final int key, final Object arg0, final Object arg1 )
147                                throws MissingResourceException {
148            return getResources( null ).getString( key, arg0, arg1 );
149        }
150    
151        /**
152         * Gets a string for the given key are replace all occurence of "{0}",
153         * "{1}", with values of <code>arg0</code>, <code>arg1</code>, etc.
154         *
155         * @param  key The key for the desired string.
156         * @param  arg0 Value to substitute to "{0}".
157         * @param  arg1 Value to substitute to "{1}".
158         * @param  arg2 Value to substitute to "{2}".
159         * @return The formatted string for the given key.
160         * @throws MissingResourceException If no object for the given key can be found.
161         */
162        public static String format( final int key, final Object arg0, final Object arg1,
163                                    final Object arg2 )
164                                throws MissingResourceException {
165            return getResources( null ).getString( key, arg0, arg1, arg2 );
166        }
167    }