1/*2 * Copyright 2001-2008 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 *16 */1718package org.apache.juddi.config;
1920import java.util.ResourceBundle;
21import java.util.Locale;
2223/**24 * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>25 */26publicclassResourceConfig {
27publicstaticfinal String GLOBAL_MESSAGES_FILE = "messages";
2829privatestaticfinal ResourceBundle globalMessages;
3031static {
32try {
33 globalMessages = ResourceBundle.getBundle(GLOBAL_MESSAGES_FILE, Locale.getDefault());
34 }
35catch (Throwable t) {
36 System.err.println("Initial configuration failed:" + t);
37thrownew ExceptionInInitializerError(t);
38 }
39 }
4041publicstatic String getGlobalMessage(String key) {
42 String msg = null;
43if (globalMessages != null) {
44if (key != null && key.length() > 0)
45 msg = globalMessages.getString(key);
46 }
47if (msg != null && msg.length() > 0)
48return msg;
4950return key;
51 }
52 }