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: package org.apache.axis2.schema.i18n;
020:
021: import org.apache.axis2.i18n.MessageBundle;
022: import org.apache.axis2.i18n.MessagesConstants;
023:
024: import java.util.Locale;
025: import java.util.MissingResourceException;
026: import java.util.ResourceBundle;
027:
028: /**
029: * @see org.apache.axis2.i18n.Messages
030: * The implementation is the same but just thisClass static reference
031: * has SchemaCompilerMessages.class
032: */
033: public class SchemaCompilerMessages {
034:
035: private static Class this Class = SchemaCompilerMessages.class;
036:
037: private static final String projectName = MessagesConstants.projectName;
038:
039: private static final String resourceName = MessagesConstants.resourceName;
040: private static final Locale locale = MessagesConstants.locale;
041:
042: private static final String packageName = getPackage(this Class
043: .getName());
044: private static final ClassLoader classLoader = this Class
045: .getClassLoader();
046:
047: private static final ResourceBundle parent = (MessagesConstants.rootPackageName
048: .equals(packageName)) ? null : MessagesConstants.rootBundle;
049:
050: /**
051: * ** NO NEED TO CHANGE ANYTHING BELOW ****
052: */
053:
054: private static final MessageBundle messageBundle = new MessageBundle(
055: projectName, packageName, resourceName, locale,
056: classLoader, parent);
057:
058: /**
059: * Gets a message from resource.properties from the package of the given object.
060: *
061: * @param key The resource key
062: * @return Returns the formatted message.
063: */
064: public static String getMessage(String key)
065: throws MissingResourceException {
066: return messageBundle.getMessage(key);
067: }
068:
069: /**
070: * Get a message from resource.properties from the package of the given object.
071: *
072: * @param key The resource key
073: * @param arg0 The argument to place in variable {0}
074: * @return Returns the formatted message.
075: */
076: public static String getMessage(String key, String arg0)
077: throws MissingResourceException {
078: return messageBundle.getMessage(key, arg0);
079: }
080:
081: /**
082: * Gets a message from resource.properties from the package of the given object.
083: *
084: * @param key The resource key
085: * @param arg0 The argument to place in variable {0}
086: * @param arg1 The argument to place in variable {1}
087: * @return Returns the formatted message.
088: */
089: public static String getMessage(String key, String arg0, String arg1)
090: throws MissingResourceException {
091: return messageBundle.getMessage(key, arg0, arg1);
092: }
093:
094: /**
095: * Gets a message from resource.properties from the package of the given object.
096: *
097: * @param key The resource key
098: * @param arg0 The argument to place in variable {0}
099: * @param arg1 The argument to place in variable {1}
100: * @param arg2 The argument to place in variable {2}
101: * @return Returns the formatted message.
102: */
103: public static String getMessage(String key, String arg0,
104: String arg1, String arg2) throws MissingResourceException {
105: return messageBundle.getMessage(key, arg0, arg1, arg2);
106: }
107:
108: /**
109: * Get a message from resource.properties from the package of the given object.
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: * @param arg3 The argument to place in variable {3}
116: * @return Returns the formatted message.
117: */
118: public static String getMessage(String key, String arg0,
119: String arg1, String arg2, String arg3)
120: throws MissingResourceException {
121: return messageBundle.getMessage(key, arg0, arg1, arg2, arg3);
122: }
123:
124: /**
125: * Gets a message from resource.properties from the package of the given object.
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: * @param arg4 The argument to place in variable {4}
133: * @return Returns the formatted message.
134: */
135: public static String getMessage(String key, String arg0,
136: String arg1, String arg2, String arg3, String arg4)
137: throws MissingResourceException {
138: return messageBundle.getMessage(key, arg0, arg1, arg2, arg3,
139: arg4);
140: }
141:
142: /**
143: * Gets a message from resource.properties from the package of the given object.
144: *
145: * @param key The resource key
146: * @param args An array of objects to place in corresponding variables
147: * @return Returns the formatted message.
148: */
149: public static String getMessage(String key, String[] args)
150: throws MissingResourceException {
151: return messageBundle.getMessage(key, args);
152: }
153:
154: public static ResourceBundle getResourceBundle() {
155: return messageBundle.getResourceBundle();
156: }
157:
158: public static MessageBundle getMessageBundle() {
159: return messageBundle;
160: }
161:
162: private static String getPackage(String name) {
163: return name.substring(0, name.lastIndexOf('.')).intern();
164: }
165:
166: }
|