Source Code Cross Referenced for MessageBundle.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.text.MessageFormat;
023:        import java.util.Locale;
024:        import java.util.MissingResourceException;
025:        import java.util.ResourceBundle;
026:
027:        /**
028:         * Accept parameters for ProjectResourceBundle, but defer object instantiation (and therefore
029:         * resource bundle loading) until required.
030:         */
031:        public class MessageBundle {
032:            private boolean loaded = false;
033:
034:            private ProjectResourceBundle _resourceBundle = null;
035:
036:            private final String projectName;
037:            private final String packageName;
038:            private final String resourceName;
039:            private final Locale locale;
040:            private final ClassLoader classLoader;
041:            private final ResourceBundle parent;
042:
043:            public final ProjectResourceBundle getResourceBundle() {
044:                if (!loaded) {
045:                    _resourceBundle = ProjectResourceBundle.getBundle(
046:                            projectName, packageName, resourceName, locale,
047:                            classLoader, parent);
048:                    loaded = true;
049:                }
050:                return _resourceBundle;
051:            }
052:
053:            /** Construct a new ExtendMessages */
054:            public MessageBundle(String projectName, String packageName,
055:                    String resourceName, Locale locale,
056:                    ClassLoader classLoader, ResourceBundle parent)
057:                    throws MissingResourceException {
058:                this .projectName = projectName;
059:                this .packageName = packageName;
060:                this .resourceName = resourceName;
061:                this .locale = locale;
062:                this .classLoader = classLoader;
063:                this .parent = parent;
064:            }
065:
066:            /**
067:             * Gets a string message from the resource bundle for the given key
068:             *
069:             * @param key The resource key
070:             * @return The message
071:             */
072:            public String getMessage(String key)
073:                    throws MissingResourceException {
074:                return getMessage(key, (String[]) null);
075:            }
076:
077:            /**
078:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
079:             * variables that will be substituted with the given arguments. Variables have the format:</p>
080:             * <dir> This message has two variables: {0} and {1} </dir>
081:             *
082:             * @param key  The resource key
083:             * @param arg0 The argument to place in variable {0}
084:             * @return The message
085:             */
086:            public String getMessage(String key, String arg0)
087:                    throws MissingResourceException {
088:                return getMessage(key, new String[] { arg0 });
089:            }
090:
091:            /**
092:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
093:             * variables that will be substituted with the given arguments. Variables have the format:</p>
094:             * <dir> This message has two variables: {0} and {1} </dir>
095:             *
096:             * @param key  The resource key
097:             * @param arg0 The argument to place in variable {0}
098:             * @param arg1 The argument to place in variable {1}
099:             * @return The message
100:             */
101:            public String getMessage(String key, String arg0, String arg1)
102:                    throws MissingResourceException {
103:                return getMessage(key, new String[] { arg0, arg1 });
104:            }
105:
106:            /**
107:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
108:             * variables that will be substituted with the given arguments. Variables have the format:</p>
109:             * <dir> This message has two variables: {0} and {1} </dir>
110:             *
111:             * @param key  The resource key
112:             * @param arg0 The argument to place in variable {0}
113:             * @param arg1 The argument to place in variable {1}
114:             * @param arg2 The argument to place in variable {2}
115:             * @return The message
116:             */
117:            public String getMessage(String key, String arg0, String arg1,
118:                    String arg2) throws MissingResourceException {
119:                return getMessage(key, new String[] { arg0, arg1, arg2 });
120:            }
121:
122:            /**
123:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
124:             * variables that will be substituted with the given arguments. Variables have the format:</p>
125:             * <dir> This message has two variables: {0} and {1} </dir>
126:             *
127:             * @param key  The resource key
128:             * @param arg0 The argument to place in variable {0}
129:             * @param arg1 The argument to place in variable {1}
130:             * @param arg2 The argument to place in variable {2}
131:             * @param arg3 The argument to place in variable {3}
132:             * @return The message
133:             */
134:            public String getMessage(String key, String arg0, String arg1,
135:                    String arg2, String arg3) throws MissingResourceException {
136:                return getMessage(key, new String[] { arg0, arg1, arg2, arg3 });
137:            }
138:
139:            /**
140:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
141:             * variables that will be substituted with the given arguments. Variables have the format:</p>
142:             * <dir> This message has two variables: {0} and {1} </dir>
143:             *
144:             * @param key  The resource key
145:             * @param arg0 The argument to place in variable {0}
146:             * @param arg1 The argument to place in variable {1}
147:             * @param arg2 The argument to place in variable {2}
148:             * @param arg3 The argument to place in variable {3}
149:             * @param arg4 The argument to place in variable {4}
150:             * @return The message
151:             */
152:            public String getMessage(String key, String arg0, String arg1,
153:                    String arg2, String arg3, String arg4)
154:                    throws MissingResourceException {
155:                return getMessage(key, new String[] { arg0, arg1, arg2, arg3,
156:                        arg4 });
157:            }
158:
159:            /**
160:             * <p>Gets a string message from the resource bundle for the given key. The message may contain
161:             * variables that will be substituted with the given arguments. Variables have the format:</p>
162:             * <dir> This message has two variables: {0} and {1} </dir>
163:             *
164:             * @param key   The resource key
165:             * @param array An array of objects to place in corresponding variables
166:             * @return The message
167:             */
168:            public String getMessage(String key, String[] array)
169:                    throws MissingResourceException {
170:                String msg = null;
171:                if (getResourceBundle() != null) {
172:                    msg = getResourceBundle().getString(key);
173:                }
174:
175:                if (msg == null) {
176:                    throw new MissingResourceException(
177:                            "Cannot find resource key \"" + key
178:                                    + "\" in base name "
179:                                    + getResourceBundle().getResourceName(),
180:                            getResourceBundle().getResourceName(), key);
181:                }
182:
183:                return MessageFormat.format(msg, (Object[]) array);
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.