Source Code Cross Referenced for Messages.java in  » Web-Services-AXIS2 » metadata » org » apache » axis2 » jaxws » i18n » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services AXIS2 » metadata » org.apache.axis2.jaxws.i18n 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:
020:        package org.apache.axis2.jaxws.i18n;
021:
022:        import java.util.HashMap;
023:        import java.util.Locale;
024:        import java.util.MissingResourceException;
025:        import java.util.ResourceBundle;
026:
027:        public class Messages {
028:            private static final Class this Class = Messages.class;
029:
030:            private static final String projectName = MessagesConstants.projectName;
031:
032:            private static final String resourceName = MessagesConstants.resourceName;
033:            private static final Locale locale = MessagesConstants.locale;
034:
035:            public static final String DEFAULT_MESSAGE_BUNDLE_KEY = "default";
036:            private static final String NO_MESSAGE_BUNDLE = "Message Bundle is not available";
037:
038:            private static final String packageName = getPackage(this Class
039:                    .getName());
040:            private static final ClassLoader classLoader = this Class
041:                    .getClassLoader();
042:
043:            private static final ResourceBundle parent = (MessagesConstants.rootPackageName
044:                    .equals(packageName)) ? null : MessagesConstants.rootBundle;
045:
046:            private static HashMap messageBundleMap = new HashMap();
047:
048:            static {
049:                MessageBundle defaultMessageBundle = new MessageBundle(
050:                        projectName, packageName, resourceName, locale,
051:                        classLoader, parent);
052:                addMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY,
053:                        defaultMessageBundle);
054:            }
055:
056:            /**
057:             * To add a new Message Bundle to the MessageBundle list.
058:             *
059:             * @param messageBundleKey The key which will be used to refer to this message bundle later.
060:             * @param messageBundle    The message bundle.
061:             */
062:            public static void addMessageBundle(String messageBundleKey,
063:                    MessageBundle messageBundle) {
064:                messageBundleMap.put(messageBundleKey, messageBundle);
065:            }
066:
067:            /**
068:             * Get a message from resource.properties from the package of the given object.
069:             *
070:             * @param key The resource key
071:             * @return The formatted message
072:             */
073:            public static String getMessage(String key)
074:                    throws MissingResourceException {
075:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
076:                return messageBundle.getMessage(key);
077:            }
078:
079:            /**
080:             * Get a message from resource.properties from the package of the given object.
081:             *
082:             * @param key  The resource key
083:             * @param arg0 The argument to place in variable {0}
084:             * @return The formatted message
085:             */
086:            public static String getMessage(String key, String arg0)
087:                    throws MissingResourceException {
088:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
089:                return messageBundle.getMessage(key, arg0);
090:            }
091:
092:            /**
093:             * Get a message from resource.properties from the package of the given object.
094:             *
095:             * @param key  The resource key
096:             * @param arg0 The argument to place in variable {0}
097:             * @param arg1 The argument to place in variable {1}
098:             * @return The formatted message
099:             */
100:            public static String getMessage(String key, String arg0, String arg1)
101:                    throws MissingResourceException {
102:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
103:                return messageBundle.getMessage(key, arg0, arg1);
104:            }
105:
106:            /**
107:             * Get a message from resource.properties from the package of the given object.
108:             *
109:             * @param key  The resource key
110:             * @param arg0 The argument to place in variable {0}
111:             * @param arg1 The argument to place in variable {1}
112:             * @param arg2 The argument to place in variable {2}
113:             * @return The formatted message
114:             */
115:            public static String getMessage(String key, String arg0,
116:                    String arg1, String arg2) throws MissingResourceException {
117:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
118:                return messageBundle.getMessage(key, arg0, arg1, arg2);
119:            }
120:
121:            /**
122:             * Get a message from resource.properties from the package of the given object.
123:             *
124:             * @param key  The resource key
125:             * @param arg0 The argument to place in variable {0}
126:             * @param arg1 The argument to place in variable {1}
127:             * @param arg2 The argument to place in variable {2}
128:             * @param arg3 The argument to place in variable {3}
129:             * @return The formatted message
130:             */
131:            public static String getMessage(String key, String arg0,
132:                    String arg1, String arg2, String arg3)
133:                    throws MissingResourceException {
134:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
135:                return messageBundle.getMessage(key, arg0, arg1, arg2, arg3);
136:            }
137:
138:            /**
139:             * Get a message from resource.properties from the package of the given object.
140:             *
141:             * @param key  The resource key
142:             * @param arg0 The argument to place in variable {0}
143:             * @param arg1 The argument to place in variable {1}
144:             * @param arg2 The argument to place in variable {2}
145:             * @param arg3 The argument to place in variable {3}
146:             * @param arg4 The argument to place in variable {4}
147:             * @return The formatted message
148:             */
149:            public static String getMessage(String key, String arg0,
150:                    String arg1, String arg2, String arg3, String arg4)
151:                    throws MissingResourceException {
152:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
153:                return messageBundle.getMessage(key, arg0, arg1, arg2, arg3,
154:                        arg4);
155:            }
156:
157:            /**
158:             * Get a message from resource.properties from the package of the given object.
159:             *
160:             * @param key  The resource key
161:             * @param args An array of objects to place in corresponding variables
162:             * @return The formatted message
163:             */
164:            public static String getMessage(String key, String[] args)
165:                    throws MissingResourceException {
166:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
167:                return messageBundle.getMessage(key, args);
168:            }
169:
170:            public static ResourceBundle getResourceBundle() {
171:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
172:                return messageBundle.getResourceBundle();
173:            }
174:
175:            public static MessageBundle getMessageBundle() {
176:                MessageBundle messageBundle = getMessageBundle(DEFAULT_MESSAGE_BUNDLE_KEY);
177:                return messageBundle;
178:            }
179:
180:            public static MessageBundle getMessageBundle(String messageBundleKey) {
181:                MessageBundle messageBundle = (MessageBundle) messageBundleMap
182:                        .get(messageBundleKey);
183:                return messageBundle;
184:            }
185:
186:            /**
187:             * Get a message from resource.properties from the package of the given object.
188:             *
189:             * @param messageBundleKey The key for getting the correct message bundle.
190:             * @param key              The resource key
191:             * @return The formatted message
192:             */
193:            public static String getMessageFromBundle(String messageBundleKey,
194:                    String key) throws MissingResourceException, Exception {
195:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
196:                if (messageBundle == null)
197:                    throw new Exception(NO_MESSAGE_BUNDLE);
198:
199:                return messageBundle.getMessage(key);
200:            }
201:
202:            /**
203:             * Get a message from resource.properties from the package of the given object.
204:             *
205:             * @param messageBundleKey The key for getting the correct message bundle.
206:             * @param key              The resource key
207:             * @param arg0             The argument to place in variable {0}
208:             * @return The formatted message
209:             */
210:            public static String getMessageFromBundle(String messageBundleKey,
211:                    String key, String arg0) throws MissingResourceException,
212:                    Exception {
213:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
214:                if (messageBundle == null)
215:                    throw new Exception(NO_MESSAGE_BUNDLE);
216:
217:                return messageBundle.getMessage(key, arg0);
218:            }
219:
220:            /**
221:             * Get a message from resource.properties from the package of the given object.
222:             *
223:             * @param messageBundleKey The key for getting the correct message bundle.
224:             * @param key              The resource key
225:             * @param arg0             The argument to place in variable {0}
226:             * @param arg1             The argument to place in variable {1}
227:             * @return The formatted message
228:             */
229:            public static String getMessageFromBundle(String messageBundleKey,
230:                    String key, String arg0, String arg1)
231:                    throws MissingResourceException, Exception {
232:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
233:                if (messageBundle == null)
234:                    throw new Exception(NO_MESSAGE_BUNDLE);
235:
236:                return messageBundle.getMessage(key, arg0, arg1);
237:            }
238:
239:            /**
240:             * Get a message from resource.properties from the package of the given object.
241:             *
242:             * @param messageBundleKey The key for getting the correct message bundle.
243:             * @param key              The resource key
244:             * @param arg0             The argument to place in variable {0}
245:             * @param arg1             The argument to place in variable {1}
246:             * @param arg2             The argument to place in variable {2}
247:             * @return The formatted message
248:             */
249:            public static String getMessageFromBundle(String messageBundleKey,
250:                    String key, String arg0, String arg1, String arg2)
251:                    throws MissingResourceException, Exception {
252:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
253:                if (messageBundle == null)
254:                    throw new Exception(NO_MESSAGE_BUNDLE);
255:
256:                return messageBundle.getMessage(key, arg0, arg1, arg2);
257:            }
258:
259:            /**
260:             * Get a message from resource.properties from the package of the given object.
261:             *
262:             * @param messageBundleKey The key for getting the correct message bundle.
263:             * @param key              The resource key
264:             * @param arg0             The argument to place in variable {0}
265:             * @param arg1             The argument to place in variable {1}
266:             * @param arg2             The argument to place in variable {2}
267:             * @param arg3             The argument to place in variable {3}
268:             * @return The formatted message
269:             */
270:            public static String getMessageFromBundle(String messageBundleKey,
271:                    String key, String arg0, String arg1, String arg2,
272:                    String arg3) throws MissingResourceException, Exception {
273:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
274:                if (messageBundle == null)
275:                    throw new Exception(NO_MESSAGE_BUNDLE);
276:
277:                return messageBundle.getMessage(key, arg0, arg1, arg2, arg3);
278:            }
279:
280:            /**
281:             * Get a message from resource.properties from the package of the given object.
282:             *
283:             * @param messageBundleKey The key for getting the correct message bundle.
284:             * @param key              The resource key
285:             * @param arg0             The argument to place in variable {0}
286:             * @param arg1             The argument to place in variable {1}
287:             * @param arg2             The argument to place in variable {2}
288:             * @param arg3             The argument to place in variable {3}
289:             * @param arg4             The argument to place in variable {4}
290:             * @return The formatted message
291:             */
292:            public static String getMessageFromBundle(String messageBundleKey,
293:                    String key, String arg0, String arg1, String arg2,
294:                    String arg3, String arg4) throws MissingResourceException,
295:                    Exception {
296:                MessageBundle messageBundle = getMessageBundle(messageBundleKey);
297:                if (messageBundle == null)
298:                    throw new Exception(NO_MESSAGE_BUNDLE);
299:
300:                return messageBundle.getMessage(key, arg0, arg1, arg2, arg3,
301:                        arg4);
302:            }
303:
304:            private static String getPackage(String name) {
305:                return name.substring(0, name.lastIndexOf('.')).intern();
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.