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.core;
018:
019: import org.apache.pluto.OptionalContainerServices;
020: import org.apache.pluto.spi.optional.PortletPreferencesService;
021: import org.apache.pluto.spi.optional.PortletEnvironmentService;
022: import org.apache.pluto.spi.optional.PortletInvokerService;
023: import org.apache.pluto.spi.optional.PortletRegistryService;
024: import org.apache.pluto.spi.optional.PortletInfoService;
025: import org.apache.pluto.spi.optional.PortalAdministrationService;
026: import org.apache.pluto.spi.optional.UserInfoService;
027:
028: /**
029: * Default Optional Container Services implementation.
030: *
031: * @version 1.0
032: * @since Sep 18, 2004
033: */
034: public class DefaultOptionalContainerServices implements
035: OptionalContainerServices {
036:
037: private PortletPreferencesService portletPreferencesService;
038: private PortletRegistryService portletRegistryService;
039: private PortletInvokerService portletInvokerService;
040: private PortletEnvironmentService portletEnvironmentService;
041: private PortletInfoService portletInfoService;
042: private PortalAdministrationService portalAdministrationService;
043: private UserInfoService userInfoService;
044:
045: /**
046: * Constructs an instance using the default portlet preferences service
047: * implementation.
048: */
049: public DefaultOptionalContainerServices() {
050: portletPreferencesService = new DefaultPortletPreferencesService();
051: portletRegistryService = PortletContextManager.getManager();
052: portletInvokerService = new DefaultPortletInvokerService();
053: portletEnvironmentService = new DefaultPortletEnvironmentService();
054: portletInfoService = new DefaultPortletInfoService();
055: portalAdministrationService = new DefaultPortalAdministrationService();
056: userInfoService = new DefaultUserInfoService();
057: }
058:
059: /**
060: * Constructs an instance using specified optional container services
061: * implementation. If the portlet preferences service is provided, it will
062: * be used. Otherwise, the default portlet preferences service will be used.
063: * @param root the root optional container services implementation.
064: */
065: public DefaultOptionalContainerServices(
066: OptionalContainerServices root) {
067: this ();
068: if (root.getPortletPreferencesService() != null) {
069: portletPreferencesService = root
070: .getPortletPreferencesService();
071: }
072:
073: if (root.getPortletRegistryService() != null) {
074: portletRegistryService = root.getPortletRegistryService();
075: }
076:
077: if (root.getPortletEnvironmentService() != null) {
078: portletEnvironmentService = root
079: .getPortletEnvironmentService();
080: }
081:
082: if (root.getPortletInvokerService() != null) {
083: portletInvokerService = root.getPortletInvokerService();
084: }
085:
086: if (root.getPortletEnvironmentService() != null) {
087: portletEnvironmentService = root
088: .getPortletEnvironmentService();
089: }
090:
091: if (root.getPortletInfoService() != null) {
092: portletInfoService = root.getPortletInfoService();
093: }
094:
095: if (root.getPortalAdministrationService() != null) {
096: portalAdministrationService = root
097: .getPortalAdministrationService();
098: }
099:
100: if (root.getUserInfoService() != null) {
101: userInfoService = root.getUserInfoService();
102: }
103:
104: }
105:
106: // OptionalContainerServices Impl ------------------------------------------
107:
108: public PortletPreferencesService getPortletPreferencesService() {
109: return portletPreferencesService;
110: }
111:
112: public PortletRegistryService getPortletRegistryService() {
113: return portletRegistryService;
114: }
115:
116: public PortletEnvironmentService getPortletEnvironmentService() {
117: return portletEnvironmentService;
118: }
119:
120: public PortletInvokerService getPortletInvokerService() {
121: return portletInvokerService;
122: }
123:
124: public PortletInfoService getPortletInfoService() {
125: return portletInfoService;
126: }
127:
128: public PortalAdministrationService getPortalAdministrationService() {
129: return portalAdministrationService;
130: }
131:
132: public UserInfoService getUserInfoService() {
133: return userInfoService;
134: }
135:
136: }
|