Source Code Cross Referenced for Messages.java in  » Portal » liferay-portal-4.4.2 » org » apache » wsrp4j » exception » 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 » Portal » liferay portal 4.4.2 » org.apache.wsrp4j.exception 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000-2001,2004 The Apache Software Foundation.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.apache.wsrp4j.exception;
018:
019:        import java.io.InputStream;
020:        import java.util.Properties;
021:
022:        import org.apache.wsrp4j.log.LogManager;
023:        import org.apache.wsrp4j.log.Logger;
024:
025:        /**
026:         Holds all exception messages
027:         */
028:        public class Messages {
029:
030:            /** defines the lowest message code for common messages */
031:            public static final int COMMON_LOWER_BOUND = 1000;
032:
033:            /** defines the highest message code for common messages */
034:            public static final int COMMON_UPPER_BOUND = 1999;
035:
036:            /** defines the lowest message code for producer messages */
037:            public static final int PRODUCER_LOWER_BOUND = 2000;
038:
039:            /** defines the highest message code for producer messages */
040:            public static final int PRODUCER_UPPER_BOUND = 2999;
041:
042:            /** defines the lowest message code for provider messages */
043:            public static final int PROVIDER_LOWER_BOUND = 3000;
044:
045:            /** defines the highest message code for provider messages */
046:            public static final int PROVIDER_UPPER_BOUND = 3999;
047:
048:            /** defines the lowest message code for consumer messages */
049:            public static final int CONSUMER_LOWER_BOUND = 6000;
050:
051:            /** defines the highest message code for consumer messages */
052:            public static final int CONSUMER_UPPER_BOUND = 6999;
053:
054:            private static final String FILE_MSG_PROPERTIES = "wsrp-messages.properties";
055:
056:            private static final String MSG_EXCEPTION_ON_LOAD = "Error while loading messages from "
057:                    + FILE_MSG_PROPERTIES + ".";
058:
059:            private static final String MSG_NO_MSG_FOUND = "No message found.";
060:
061:            private static final String MSG_NO_MSG_FOUND_FOR = "No message found for ";
062:
063:            private static final String METHOD_INIT = "<init>";
064:
065:            private static final String METHOD_GET = "get()";
066:
067:            private static Logger logger = LogManager.getLogManager()
068:                    .getLogger(Messages.class);
069:
070:            private static Properties msgMap = new Properties();
071:
072:            /**
073:             Private constructor loads messages from <code>messages.properties</code> file in
074:             <code>org.apache.wsrp4j.exception</code>
075:             */
076:            private Messages() {
077:
078:                //load properties file
079:                try {
080:                    InputStream in = getClass().getClassLoader()
081:                            .getResourceAsStream(FILE_MSG_PROPERTIES);
082:                    msgMap.load(in);
083:                } catch (Exception e) {
084:                    logger.text(Logger.ERROR, METHOD_INIT, e,
085:                            MSG_EXCEPTION_ON_LOAD);
086:                }
087:            }
088:
089:            /**
090:             Returns an error message for a message code
091:             @param msgCode code that identifies a message
092:             @return String representing a message
093:             */
094:            public static String get(int msgCode) {
095:                String msg = (String) msgMap.get(new Integer(msgCode)
096:                        .toString());
097:                if (msg == null) {
098:                    msg = MSG_NO_MSG_FOUND;
099:                    if (logger.isLogging(Logger.TRACE_LOW)) {
100:                        logger.text(Logger.TRACE_LOW, METHOD_GET,
101:                                MSG_NO_MSG_FOUND_FOR + msgCode + " in "
102:                                        + FILE_MSG_PROPERTIES + ".");
103:                    }
104:                }
105:                return msg;
106:            }
107:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.