Source Code Cross Referenced for Message.java in  » Content-Management-System » dspace » org » dspace » app » xmlui » wing » 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 » Content Management System » dspace » org.dspace.app.xmlui.wing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Message.java
003:         *
004:         * Version: $Revision: 1.3 $
005:         *
006:         * Date: $Date: 2006/06/02 21:48:19 $
007:         *
008:         * Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
009:         * Institute of Technology.  All rights reserved.
010:         *
011:         * Redistribution and use in source and binary forms, with or without
012:         * modification, are permitted provided that the following conditions are
013:         * met:
014:         *
015:         * - Redistributions of source code must retain the above copyright
016:         * notice, this list of conditions and the following disclaimer.
017:         *
018:         * - Redistributions in binary form must reproduce the above copyright
019:         * notice, this list of conditions and the following disclaimer in the
020:         * documentation and/or other materials provided with the distribution.
021:         *
022:         * - Neither the name of the Hewlett-Packard Company nor the name of the
023:         * Massachusetts Institute of Technology nor the names of their
024:         * contributors may be used to endorse or promote products derived from
025:         * this software without specific prior written permission.
026:         *
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
030:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
032:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
033:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
034:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
035:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
036:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
037:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
038:         * DAMAGE.
039:         */
040:        package org.dspace.app.xmlui.wing;
041:
042:        /**
043:         * 
044:         * This class represents an i18n message, which is composed of three parts: a 
045:         * catalogue, a key, and a set of dictionary parameters. The catalogue tells 
046:         * the translater where to find the key, the key tells the transformer which 
047:         * specific text should be used, and the parameters provide for non translated 
048:         * data to be inserted into the resulting string.
049:         * 
050:         * This class design such that the Message object can be made static my any 
051:         * class that needs to use it. If dicionary parameters are used then a new 
052:         * instance is created specificaly for those parameters, this prevents 
053:         * concurent threads from over writting parameters of each other.
054:         * 
055:         * @author Scott Phillips
056:         */
057:
058:        public class Message {
059:            /** What catalogue this key is to be found in. */
060:            protected final String catalogue;
061:
062:            /** The key to look up in the catalogue. */
063:            protected final String key;
064:
065:            /**
066:             * Create a new translatable element.
067:             * 
068:             * @param catalogue
069:             *            The catalogue were this key is to be found.
070:             * @param key
071:             *            The key to look up in the catalogue.
072:             */
073:            public Message(String catalogue, String key) {
074:                this .catalogue = catalogue;
075:                this .key = key;
076:            }
077:
078:            /**
079:             * 
080:             * @return The catalogue this key is to be found in.
081:             */
082:            public String getCatalogue() {
083:                return this .catalogue;
084:            }
085:
086:            /**
087:             * 
088:             * @return The key to look-up in the catalogue.
089:             */
090:            public String getKey() {
091:                return this .key;
092:            }
093:
094:            /** 
095:             * 
096:             * Parameterize this translate key by specifying 
097:             * dictionary parameters. This will not modify the 
098:             * current translate object but instead create a 
099:             * cloned copy that has been parameterized.
100:             * 
101:             * @param object The dictionary parameters
102:             */
103:            public Message parameterize(Object... dictionaryParameters) {
104:                return new ParameterizedMessage(catalogue, key,
105:                        dictionaryParameters);
106:            }
107:
108:            /**
109:             * Return any dictionary parameters that are used by this
110:             * translation message.
111:             * 
112:             * Since this is the basic implementation it does not support
113:             * parameters we just return an empty array.
114:             * 
115:             * @return Any parameters to the catalogue key
116:             */
117:            public Object[] getDictionaryParameters() {
118:                return new Object[0];
119:            }
120:
121:            /**
122:             * 
123:             * Specialized translate class that handles parameterized messages.
124:             * Parameterized messages contain a catalogue and key like normal but
125:             * also add the ability for extra parameters to be added to the
126:             * message. These parameters are inserted into the final translated
127:             * string based upon the key's definition. 
128:             *
129:             * No one out side of this class should even know this class exists,
130:             * hence the privacy, but haveing two implementations allows us to
131:             * sepearete all the functionality for paramaterization into this
132:             * one place. Since most of the messages used are unparameterized
133:             * this is not wasted on them and is only invoked when needed. There 
134:             * may be some performance increase by doing this but i doubt it is 
135:             * of much consequence, instead the main reason is to be able to create
136:             * a new instance when messages are parameterized so that concurrent
137:             * threads do not step on each other.
138:             * 
139:             */
140:            private static class ParameterizedMessage extends Message {
141:                /**
142:                 * Parameters to the dictionary key, they may be filled into places in the
143:                 * final translated version
144:                 */
145:                private final Object[] dictionaryParameters;
146:
147:                /**
148:                 * Create a new translatable element.
149:                 * 
150:                 * @param catalogue
151:                 *            The catalogue were this key is to be found.
152:                 * @param key
153:                 *            The key to look up in the catalogue.
154:                 */
155:                public ParameterizedMessage(String catalogue, String key,
156:                        Object... dictionaryParameters) {
157:                    super (catalogue, key);
158:                    this .dictionaryParameters = dictionaryParameters;
159:                }
160:
161:                /**
162:                 * Return the dicionary parameters for this message.
163:                 * 
164:                 * @return Any parameters to the catalogue key
165:                 */
166:                public Object[] getDictionaryParameters() {
167:                    return dictionaryParameters;
168:                }
169:            }
170:
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.