01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.console.i18n;
17:
18: import java.util.Enumeration;
19: import java.util.ResourceBundle;
20:
21: import org.apache.commons.logging.Log;
22: import org.apache.commons.logging.LogFactory;
23: import org.apache.geronimo.console.util.PortletManager;
24:
25: /**
26: * This class provide the common functions for its subclasses.
27: */
28: public class ConsoleResourceSupport extends ResourceBundle {
29: private static final Log log = LogFactory
30: .getLog(ConsoleResourceSupport.class);
31: private static final String BASENAME = "portletinfo";
32:
33: @Override
34: public Enumeration<String> getKeys() {
35: //TODO should we return the keys?
36: return null;
37: }
38:
39: @Override
40: protected Object handleGetObject(String key) {
41: try {
42: ConsoleResourceRegistry resourceRegistry = (ConsoleResourceRegistry) PortletManager
43: .getKernel()
44: .getGBean(ConsoleResourceRegistry.class);
45: String value = resourceRegistry.handleGetObject(BASENAME,
46: getLocale(), key);
47: return value == null ? key : value;
48: } catch (Exception e) {
49: log
50: .error(
51: "Cannot get the console resource registery service",
52: e);
53: }
54: return null;
55: }
56:
57: }
|