Source Code Cross Referenced for SchemaMessageProvider.java in  » Web-Server » Rimfaxe-Web-Server » org » apache » xerces » validators » schema » 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 Server » Rimfaxe Web Server » org.apache.xerces.validators.schema 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Apache Software License, Version 1.1
003:         *
004:         *
005:         * Copyright (c) 2000 The Apache Software Foundation.  All rights
006:         * reserved.
007:         *
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions
010:         * are met:
011:         *
012:         * 1. Redistributions of source code must retain the above copyright
013:         *    notice, this list of conditions and the following disclaimer.
014:         *
015:         * 2. Redistributions in binary form must reproduce the above copyright
016:         *    notice, this list of conditions and the following disclaimer in
017:         *    the documentation and/or other materials provided with the
018:         *    distribution.
019:         *
020:         * 3. The end-user documentation included with the redistribution,
021:         *    if any, must include the following acknowledgment:
022:         *       "This product includes software developed by the
023:         *        Apache Software Foundation (http://www.apache.org/)."
024:         *    Alternately, this acknowledgment may appear in the software itself,
025:         *    if and wherever such third-party acknowledgments normally appear.
026:         *
027:         * 4. The names "Xerces" and "Apache Software Foundation" must
028:         *    not be used to endorse or promote products derived from this
029:         *    software without prior written permission. For written
030:         *    permission, please contact apache@apache.org.
031:         *
032:         * 5. Products derived from this software may not be called "Apache",
033:         *    nor may "Apache" appear in their name, without prior written
034:         *    permission of the Apache Software Foundation.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         * ====================================================================
049:         *
050:         * This software consists of voluntary contributions made by many
051:         * individuals on behalf of the Apache Software Foundation and was
052:         * originally based on software copyright (c) 1999, International
053:         * Business Machines, Inc., http://www.apache.org.  For more
054:         * information on the Apache Software Foundation, please see
055:         * <http://www.apache.org/>.
056:         */
057:
058:        package org.apache.xerces.validators.schema;
059:
060:        import org.apache.xerces.utils.XMLMessageProvider;
061:        import java.util.ResourceBundle;
062:        import java.util.ListResourceBundle;
063:        import java.util.Locale;
064:
065:        /**
066:         * SchemaMessageProvider implements an XMLMessageProvider that
067:         * provides localizable error messages for the W3C XML Schema Language
068:         *
069:         */
070:        public class SchemaMessageProvider implements  XMLMessageProvider {
071:            /**
072:             * The domain of messages concerning the XML Schema: Structures specification.
073:             */
074:            public static final String SCHEMA_DOMAIN = "http://www.w3.org/TR/xml-schema-1";
075:
076:            /**
077:             *
078:             */
079:            public void setLocale(Locale locale) {
080:                fLocale = locale;
081:            }
082:
083:            /**
084:             *
085:             */
086:            public Locale getLocale() {
087:                return fLocale;
088:            }
089:
090:            /**
091:             * Creates a message from the specified key and replacement
092:             * arguments, localized to the given locale.
093:             *
094:             * @param locale    The requested locale of the message to be
095:             *                  created.
096:             * @param key       The key for the message text.
097:             * @param args      The arguments to be used as replacement text
098:             *                  in the message created.
099:             */
100:            public String createMessage(Locale locale, int majorCode,
101:                    int minorCode, Object args[]) {
102:                boolean throwex = false;
103:                if (fResourceBundle == null || locale != fLocale) {
104:                    if (locale != null)
105:                        fResourceBundle = ListResourceBundle.getBundle(
106:                                "org.apache.xerces.msg.SchemaMessages", locale);
107:                    if (fResourceBundle == null)
108:                        fResourceBundle = ListResourceBundle
109:                                .getBundle("org.apache.xerces.msg.SchemaMessages");
110:                }
111:                if (majorCode < 0 || majorCode >= fgMessageKeys.length) {
112:                    majorCode = MSG_BAD_MAJORCODE;
113:                    throwex = true;
114:                }
115:                String msgKey = fgMessageKeys[majorCode];
116:                String msg = fResourceBundle.getString(msgKey);
117:                if (args != null) {
118:                    try {
119:                        msg = java.text.MessageFormat.format(msg, args);
120:                    } catch (Exception e) {
121:                        msg = fResourceBundle
122:                                .getString(fgMessageKeys[MSG_FORMAT_FAILURE]);
123:                        msg += " " + fResourceBundle.getString(msgKey);
124:                    }
125:                }
126:
127:                if (throwex) {
128:                    throw new RuntimeException(msg);
129:                }
130:                return msg;
131:            }
132:
133:            //
134:            //
135:            //
136:            private Locale fLocale = null;
137:            private ResourceBundle fResourceBundle = null;
138:            //
139:            // Major codes
140:            //
141:            public static final int MSG_BAD_MAJORCODE = 0, //  majorCode parameter to createMessage was out of bounds
142:                    MSG_FORMAT_FAILURE = 1, //  exception thrown during messageFormat call
143:                    NoValidatorFor = 2,
144:                    IncorrectDatatype = 3,
145:                    AttMissingType = 4,
146:                    NotADatatype = 5,
147:                    TextOnlyContentWithType = 6,
148:                    FeatureUnsupported = 7,
149:                    NestedOnlyInElemOnly = 8,
150:                    EltRefOnlyInMixedElemOnly = 9,
151:                    OnlyInEltContent = 10,
152:                    OrderIsAll = 11,
153:                    DatatypeWithType = 12,
154:                    DatatypeQualUnsupported = 13,
155:                    GroupContentRestricted = 14,
156:                    UnknownBaseDatatype = 15,
157:                    BadAttWithRef = 16,
158:                    NoContentForRef = 17,
159:                    IncorrectDefaultType = 18,
160:                    IllegalAttContent = 19,
161:                    ValueNotInteger = 20,
162:                    DatatypeError = 21,
163:                    TypeAlreadySet = 22,
164:                    GenericError = 23,
165:                    UnclassifiedError = 24,
166:                    ContentError = 25,
167:                    AnnotationError = 26,
168:                    ListUnionRestrictionError = 27,
169:                    ProhibitedAttributePresent = 28,
170:                    // identity constraints
171:                    UniqueNotEnoughValues = 29,
172:                    KeyNotEnoughValues = 30,
173:                    KeyRefNotEnoughValues = 31,
174:                    DuplicateField = 32,
175:                    DuplicateUnique = 33,
176:                    DuplicateKey = 34,
177:                    KeyNotFound = 35,
178:                    UnknownField = 36,
179:                    KeyRefReferNotFound = 37,
180:                    FixedDiffersFromActual = 38,
181:                    // simpleType
182:                    InvalidBaseType = 39,
183:                    FieldMultipleMatch = 40,
184:                    KeyRefOutOfScope = 41,
185:                    AbsentKeyValue = 42,
186:                    KeyMatchesNillable = 43,
187:                    BadMinMaxForAllElem = 44,
188:                    BadMinMaxForGroupWithAll = 45,
189:                    SeqChoiceContentRestricted = 46,
190:                    AllContentRestricted = 47,
191:                    AllContentLimited = 48,
192:                    MinMaxOnGroupChild = 49,
193:                    BadMinMaxForAllGp = 50,
194:                    SchemaLocation = 51,
195:                    UniqueParticleAttribution = 52,
196:                    Con3X3ElementAppearance = 53,
197:                    Con3X3AttributeAppearance = 54,
198:                    Con3X3AttributeMustAppear = 55,
199:                    Con3X3AttributeInvalidValue = 56, CardinalityNotEqual = 57,
200:                    // ...
201:
202:                    MSG_MAX_CODE = 58;
203:            //
204:            // Minor Codes
205:            //
206:            public static final int MSG_NONE = 0;
207:
208:            public static final String[] fgMessageKeys = {
209:                    "BadMajorCode", //   0, "The majorCode parameter to createMessage was out of bounds."
210:                    "FormatFailed", //   1, "An internal error occurred while formatting the following message:"
211:                    "NoValidatorFor", //   2, "No validator for datatype {0}"
212:                    "IncorrectDatatype", //   3, "Incorrect datatype: {0}"
213:                    "AttMissingType", //   4, "The {0} attribute must appear with a type attribute."
214:                    "NotADatatype", //   5, "{0} is not a datatype."
215:                    "TextOnlyContentWithType", //   6, "The content attribute must be 'textOnly' if you specify a type attribute."
216:                    "FeatureUnsupported", //   7, "{0} is unsupported"
217:                    "NestedOnlyInElemOnly", //   8, "Nested Element decls only allowed in elemOnly content"
218:                    "EltRefOnlyInMixedElemOnly", //   9, "Element references only allowed in mixed or elemOnly content"
219:                    "OnlyInEltContent", //  10, "{0} only allowed in elemOnly content."
220:                    "OrderIsAll", //  11, "{0} not allowed if the order is all."
221:                    "DatatypeWithType", //  12, "Datatype qualifiers can only be used if you specify a type attribute."},
222:                    "DatatypeQualUnsupported", //  13, "The datatype qualifier {0} is not supported."
223:                    "GroupContentRestricted", //  14, "Error: {0} content must be one of choice, all or sequence.  Saw {1}"
224:                    "UnknownBaseDatatype", //  15, "Unknown base type {0} for type {1}." },
225:                    "BadAttWithRef", //  16, "ref cannot appear with any of type, abstract, block, final, nillable, default or fixed"},
226:                    "NoContentForRef", //  17, "Cannot have child content for an element declaration that has a ref attribute"
227:                    "IncorrectDefaultType", //  18, "Incorrect type for {0}'s default value: {1}"
228:                    "IllegalAttContent", //  19, "Illegal content {0} in attribute group"
229:                    "ValueNotInteger", //  20, "Value of {0} is not an integer"
230:                    "DatatypeError", //  21, "Datatype error {0}."
231:                    "TypeAlreadySet", //  22, "The type of the element has already been declared."
232:                    "GenericError", //  23, "Schema error: {0}."
233:                    "UnclassifiedError", //  24, "Unclassified error."
234:                    "ContentError", //  25, "Content (annotation?,..) is incorrect for type {0}"
235:                    "AnnotationError", //  26, "Annotation can only appear once: type {0}"
236:                    "ListUnionRestrictionError", //  27, "List | Union | Restriction content is invalid for type {0}"
237:                    "ProhibitedAttributePresent", //  28, attribue dcld prohibited is present
238:                    // identity constraint keys
239:                    "UniqueNotEnoughValues", "KeyNotEnoughValues",
240:                    "KeyRefNotEnoughValues", "DuplicateField",
241:                    "DuplicateUnique", "DuplicateKey", "KeyNotFound",
242:                    "UnknownField", "KeyRefReferNotFound",
243:                    "FixedDiffersFromActual", "InvalidBaseType",
244:                    "FieldMultipleMatch", "KeyRefOutOfScope", "AbsentKeyValue",
245:                    "KeyMatchesNillable", "BadMinMaxForAllElem",
246:                    "BadMinMaxForGroupWithAll", "SeqChoiceContentRestricted",
247:                    "AllContentRestricted", "AllContentLimited",
248:                    "MinMaxOnGroupChild", "BadMinMaxForAllGp",
249:                    "SchemaLocation", "UniqueParticleAttribution",
250:                    "Con3X3ElementAppearance", "Con3X3AttributeAppearance",
251:                    "Con3X3AttributeMustAppear", "Con3X3AttributeInvalidValue",
252:                    "CardinalityNotEqual",
253:            // END
254:            };
255:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.