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: */
17: package org.apache.pluto.driver.services.impl.resource;
18:
19: import java.io.InputStream;
20: import java.util.Set;
21:
22: import javax.servlet.ServletContext;
23:
24: import org.apache.commons.logging.Log;
25: import org.apache.commons.logging.LogFactory;
26: import org.apache.pluto.driver.config.DriverConfigurationException;
27: import org.apache.pluto.driver.services.portal.PropertyConfigService;
28:
29: /**
30: * Default implementation of all of the portal Services.
31: * Utilizes resource configuration from
32: * <code>pluto-portal-driver-config.xml</code>
33: *
34: * @since Aug 10, 2005
35: */
36: public class PropertyConfigServiceImpl implements PropertyConfigService {
37:
38: private static final Log LOG = LogFactory
39: .getLog(PropertyConfigServiceImpl.class);
40:
41: private ResourceConfig config;
42:
43: public PropertyConfigServiceImpl() {
44:
45: }
46:
47: /**
48: * Initialization Lifecycle Method
49: * @param ctx
50: */
51: public void init(ServletContext ctx) {
52: try {
53: InputStream in = ctx
54: .getResourceAsStream(ResourceConfigReader.CONFIG_FILE);
55: config = ResourceConfigReader.getFactory().parse(in);
56: } catch (Exception e) {
57: LOG.error("Unable to parse resource config "
58: + e.getMessage(), e);
59: throw new DriverConfigurationException(e);
60: }
61: }
62:
63: /**
64: * Shutdown the ResourceService.
65: */
66: public void destroy() {
67: config = null;
68: }
69:
70: public String getPortalName() {
71: return config.getPortalName();
72: }
73:
74: public String getPortalVersion() {
75: return config.getPortalVersion();
76: }
77:
78: public String getContainerName() {
79: return config.getContainerName();
80: }
81:
82: public Set getSupportedPortletModes() {
83: return config.getSupportedPortletModes();
84: }
85:
86: public Set getSupportedWindowStates() {
87: return config.getSupportedWindowStates();
88: }
89:
90: }
|