001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.pluto.driver.config.impl;
018:
019: import java.util.Collection;
020:
021: import javax.servlet.ServletContext;
022:
023: import org.apache.pluto.driver.config.DriverConfiguration;
024: import org.apache.pluto.driver.services.portal.PageConfig;
025: import org.apache.pluto.driver.services.portal.PropertyConfigService;
026: import org.apache.pluto.driver.services.portal.RenderConfigService;
027: import org.apache.pluto.driver.services.portal.SupportedModesService;
028: import org.apache.pluto.driver.services.portal.SupportedWindowStateService;
029: import org.apache.pluto.driver.url.PortalURLParser;
030: import org.apache.pluto.spi.PortalCallbackService;
031: import org.apache.pluto.spi.optional.PortletPreferencesService;
032:
033: /**
034: * Encapsulation of the Pluto Driver ResourceConfig.
035: *
036: * @version 1.0
037: * @since Sep 23, 2004
038: */
039: public class DriverConfigurationImpl implements DriverConfiguration {
040:
041: private PortalURLParser portalUrlParser;
042: private PropertyConfigService propertyService;
043: private RenderConfigService renderService;
044: private SupportedModesService supportedModesService;
045: private SupportedWindowStateService supportedWindowStateService;
046:
047: // Container Services
048: private PortalCallbackService portalCallbackService;
049: private PortletPreferencesService portletPreferencesService;
050:
051: public DriverConfigurationImpl(PortalURLParser portalUrlParser,
052: PropertyConfigService propertyService,
053: RenderConfigService renderService,
054: SupportedModesService supportedModesService,
055: SupportedWindowStateService supportedWindowStateService,
056: PortalCallbackService portalCallback) {
057:
058: this .portalUrlParser = portalUrlParser;
059: this .propertyService = propertyService;
060: this .renderService = renderService;
061: this .portalCallbackService = portalCallback;
062: this .supportedModesService = supportedModesService;
063: this .supportedWindowStateService = supportedWindowStateService;
064: }
065:
066: /**
067: * Standard Getter.
068: * @return the name of the portal.
069: */
070: public String getPortalName() {
071: return propertyService.getPortalName();
072: }
073:
074: /**
075: * Standard Getter.
076: * @return the portal version.
077: */
078: public String getPortalVersion() {
079: return propertyService.getPortalVersion();
080: }
081:
082: /**
083: * Standard Getter.
084: * @return the name of the container.
085: */
086: public String getContainerName() {
087: return propertyService.getContainerName();
088: }
089:
090: /**
091: * Standard Getter.
092: * @return the names of the supported portlet modes.
093: */
094: public Collection getSupportedPortletModes() {
095: return propertyService.getSupportedPortletModes();
096: }
097:
098: /**
099: * Standard Getter.
100: * @return the names of the supported window states.
101: */
102: public Collection getSupportedWindowStates() {
103: return propertyService.getSupportedWindowStates();
104: }
105:
106: /**
107: * Standard Getter.
108: * @return the render configuration.
109: */
110: public Collection getPages() {
111: return renderService.getPages();
112: }
113:
114: public PageConfig getPageConfig(String pageId) {
115: return renderService.getPage(pageId);
116: }
117:
118: public boolean isPortletModeSupportedByPortal(String mode) {
119: return supportedModesService
120: .isPortletModeSupportedByPortal(mode);
121: }
122:
123: public boolean isPortletModeSupportedByPortlet(String portletId,
124: String mode) {
125: return supportedModesService.isPortletModeSupportedByPortlet(
126: portletId, mode);
127: }
128:
129: public boolean isPortletModeSupported(String portletId, String mode) {
130: return supportedModesService.isPortletModeSupported(portletId,
131: mode);
132: }
133:
134: public void init(ServletContext context) {
135: this .propertyService.init(context);
136: this .renderService.init(context);
137: this .supportedModesService.init(context);
138: this .supportedWindowStateService.init(context);
139: }
140:
141: public void destroy() {
142: if (propertyService != null)
143: propertyService.destroy();
144:
145: if (renderService != null)
146: renderService.destroy();
147:
148: if (supportedModesService != null)
149: supportedModesService.destroy();
150:
151: if (supportedWindowStateService != null)
152: supportedWindowStateService.destroy();
153: }
154:
155: //
156: // Portal Driver Services
157: //
158:
159: public PortalURLParser getPortalUrlParser() {
160: return portalUrlParser;
161: }
162:
163: public void setPortalUrlParser(PortalURLParser portalUrlParser) {
164: this .portalUrlParser = portalUrlParser;
165: }
166:
167: //
168: // Container Services
169: //
170: public PortalCallbackService getPortalCallbackService() {
171: return portalCallbackService;
172: }
173:
174: public void setPortalCallbackService(
175: PortalCallbackService portalCallbackService) {
176: this .portalCallbackService = portalCallbackService;
177: }
178:
179: public PortletPreferencesService getPortletPreferencesService() {
180: return portletPreferencesService;
181: }
182:
183: public void setPortletPreferencesService(
184: PortletPreferencesService portletPreferencesService) {
185: this .portletPreferencesService = portletPreferencesService;
186: }
187:
188: public boolean isWindowStateSupported(String portletId,
189: String windowState) {
190: return supportedWindowStateService.isWindowStateSupported(
191: portletId, windowState);
192: }
193:
194: public boolean isWindowStateSupportedByPortal(String windowState) {
195: return supportedWindowStateService
196: .isWindowStateSupportedByPortal(windowState);
197: }
198:
199: public boolean isWindowStateSupportedByPortlet(String portletId,
200: String windowState) {
201: return supportedWindowStateService
202: .isWindowStateSupportedByPortlet(portletId, windowState);
203: }
204:
205: public RenderConfigService getRenderConfigService() {
206: return renderService;
207: }
208: }
|