Source Code Cross Referenced for Support.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » generation » start » 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 » Database ORM » Speedo_1.4.5 » org.objectweb.speedo.generation.start 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (C) 2001-2004 France Telecom R&D
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */package org.objectweb.speedo.generation.start;
018:
019:        import java.util.ResourceBundle;
020:        import java.util.Locale;
021:        import java.util.Hashtable;
022:        import java.text.MessageFormat;
023:
024:        class I18NHelper {
025:            private static Hashtable bundles = new Hashtable();
026:            private static Locale locale = Locale.getDefault();
027:
028:            /**
029:             * Constructor
030:             */
031:            public I18NHelper() {
032:            }
033:
034:            /**
035:             * Load ResourceBundle by bundle name
036:             */
037:            public static ResourceBundle loadBundle(String bundleName) {
038:                ResourceBundle messages = (ResourceBundle) bundles
039:                        .get(bundleName);
040:
041:                if (messages == null) //not found as loaded - add
042:                {
043:                    messages = ResourceBundle.getBundle(bundleName, locale);
044:                    bundles.put(bundleName, messages);
045:                }
046:                return messages;
047:            }
048:
049:            /**
050:             * Returns message as String
051:             */
052:            final public static String getMessage(ResourceBundle messages,
053:                    String messageKey) {
054:                return messages.getString(messageKey);
055:            }
056:
057:            /**
058:             * Formats message by adding Array of arguments
059:             */
060:            final public static String getMessage(ResourceBundle messages,
061:                    String messageKey, Object msgArgs[]) {
062:                for (int i = 0; i < msgArgs.length; i++) {
063:                    if (msgArgs[i] == null)
064:                        msgArgs[i] = ""; // NOI18N
065:                }
066:                MessageFormat formatter = new MessageFormat(messages
067:                        .getString(messageKey));
068:                return formatter.format(msgArgs);
069:            }
070:
071:            /**
072:             * Formats message by adding a String argument
073:             */
074:            final public static String getMessage(ResourceBundle messages,
075:                    String messageKey, String arg) {
076:                Object[] args = { arg };
077:                return getMessage(messages, messageKey, args);
078:            }
079:
080:            /**
081:             * Formats message by adding two String arguments
082:             */
083:            final public static String getMessage(ResourceBundle messages,
084:                    String messageKey, String arg1, String arg2) {
085:                Object[] args = { arg1, arg2 };
086:                return getMessage(messages, messageKey, args);
087:            }
088:
089:            /**
090:             * Formats message by adding three String arguments
091:             */
092:            final public static String getMessage(ResourceBundle messages,
093:                    String messageKey, String arg1, String arg2, String arg3) {
094:                Object[] args = { arg1, arg2, arg3 };
095:                return getMessage(messages, messageKey, args);
096:            }
097:
098:            /**
099:             *
100:             * Formats message by adding an Object as an argument
101:             */
102:            final public static String getMessage(ResourceBundle messages,
103:                    String messageKey, Object arg) {
104:                Object[] args = { arg };
105:                return getMessage(messages, messageKey, args);
106:            }
107:
108:            /**
109:             * Formats message by adding an int as an argument
110:             */
111:            final public static String getMessage(ResourceBundle messages,
112:                    String messageKey, int arg) {
113:                Object[] args = { new Integer(arg) };
114:                return getMessage(messages, messageKey, args);
115:            }
116:
117:            /**
118:             * Formats message by adding a boolean as an argument
119:             */
120:            final public static String getMessage(ResourceBundle messages,
121:                    String messageKey, boolean arg) {
122:                Object[] args = { String.valueOf(arg) };
123:                return getMessage(messages, messageKey, args);
124:            }
125:        }
126:
127:        /**
128:         * Basic support for enhancer implementation.
129:         */
130:        public class Support extends Assertion {
131:            //^olsen: hack
132:            static public Timer timer = new Timer();
133:
134:            /**
135:             * I18N message handler
136:             */
137:            static private ResourceBundle MESSAGES;
138:
139:            /**
140:             *
141:             */
142:            static {
143:                try {
144:                    MESSAGES = I18NHelper
145:                            .loadBundle("org.objectweb.speedo.generation.start.Bundle");
146:                } catch (java.util.MissingResourceException ex) {
147:                    ex.printStackTrace();
148:                }
149:            }
150:
151:            /**
152:             * Returns the I18N message.
153:             */
154:            static protected final String getI18N(String key) {
155:                return I18NHelper.getMessage(MESSAGES, key);
156:            }
157:
158:            /**
159:             * Returns the I18N message.
160:             */
161:            static protected final String getI18N(String key, String arg) {
162:                return I18NHelper.getMessage(MESSAGES, key, arg);
163:            }
164:
165:            /**
166:             * Returns the I18N message.
167:             */
168:            static protected final String getI18N(String key, String arg1,
169:                    String arg2) {
170:                return I18NHelper.getMessage(MESSAGES, key, arg1, arg2);
171:            }
172:
173:            /**
174:             * Returns the I18N message.
175:             */
176:            static protected final String getI18N(String key, String arg1,
177:                    String arg2, String arg3) {
178:                return I18NHelper.getMessage(MESSAGES, key, arg1, arg2, arg3);
179:            }
180:
181:            /**
182:             * Returns the I18N message.
183:             */
184:            static protected final String getI18N(String key, int arg1,
185:                    String arg2) {
186:                return I18NHelper.getMessage(MESSAGES, key, new Object[] {
187:                        new Integer(arg1), arg2 });
188:            }
189:
190:            /**
191:             * Returns the I18N message.
192:             */
193:            static protected final String getI18N(String key, Object[] args) {
194:                return I18NHelper.getMessage(MESSAGES, key, args);
195:            }
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.