KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > common > i18n > JmxTranslate


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Nicolas Modrzyk.
22  * Contributor(s): Emmanuel Cecchet.
23  */

24
25 package org.objectweb.cjdbc.common.i18n;
26
27 import java.util.MissingResourceException JavaDoc;
28 import java.util.ResourceBundle JavaDoc;
29
30 /**
31  * Class to translate the different messages of cjdbc.
32  *
33  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet </a>
34  * @author <a HREF="mailto:Nicolas.Modrzyk@inrialpes.fr">Nicolas Modrzyk </a>
35  * @version 1.0
36  */

37
38 public final class JmxTranslate extends I18N
39 {
40   /**
41    * JMX message description is stored in a different file
42    */

43   public static final String JavaDoc MBEANS_LANGUAGE_FILE = "c-jdbc-mbeans-description";
44
45   /**
46    * Translation bundle for C-JDBC messages
47    */

48   public static ResourceBundle JavaDoc bundle;
49
50   static
51   {
52     try
53     {
54       bundle = ResourceBundle.getBundle(MBEANS_LANGUAGE_FILE);
55     }
56     catch (MissingResourceException JavaDoc e)
57     {
58       e.printStackTrace();
59     }
60   }
61
62   /**
63    * @param key the key to translate
64    * @return translation
65    * @see I18N#get(ResourceBundle, String)
66    */

67   public static String JavaDoc get(String JavaDoc key)
68   {
69     return get(bundle, key);
70   }
71
72   /**
73    * @param key the key to translate
74    * @param parameter boolean parameter
75    * @return translation
76    * @see I18N#get(ResourceBundle, String, boolean)
77    */

78   public static String JavaDoc get(String JavaDoc key, boolean parameter)
79   {
80     return get(bundle, key, parameter);
81   }
82
83   /**
84    * @param key the key to translate
85    * @param parameter int parameter
86    * @return translation
87    * @see I18N#get(ResourceBundle, String, int)
88    */

89   public static String JavaDoc get(String JavaDoc key, int parameter)
90   {
91     return get(bundle, key, parameter);
92   }
93
94   /**
95    * @param key the key to translate
96    * @param parameter long parameter
97    * @return translation
98    * @see I18N#get(ResourceBundle, String, long)
99    */

100   public static String JavaDoc get(String JavaDoc key, long parameter)
101   {
102     return get(bundle, key, parameter);
103   }
104
105   /**
106    * @param key the key to translate
107    * @param parameters Object array parameter
108    * @return translation
109    * @see I18N#get(ResourceBundle, String, Object[])
110    */

111   public static String JavaDoc get(String JavaDoc key, Object JavaDoc[] parameters)
112   {
113     return get(bundle, key, parameters);
114   }
115
116   /**
117    * @param key the key to translate
118    * @param parameter Object parameter
119    * @return translation
120    * @see I18N#get(ResourceBundle, String, Object)
121    */

122   public static String JavaDoc get(String JavaDoc key, Object JavaDoc parameter)
123   {
124     return get(bundle, key, parameter);
125   }
126 }
Popular Tags