EMMA Coverage Report (generated Fri Sep 15 10:32:43 EDT 2006)
[all classes][org.apache.pluto.driver.services.impl.resource]

COVERAGE SUMMARY FOR SOURCE FILE [ResourceConfig.java]

nameclass, %method, %block, %line, %
ResourceConfig.java0%   (0/1)0%   (0/20)0%   (0/156)0%   (0/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceConfig0%   (0/1)0%   (0/20)0%   (0/156)0%   (0/47)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
ResourceConfig (): void 0%   (0/1)0%   (0/18)0%   (0/5)
addPortletApp (PortletApplicationConfig): void 0%   (0/1)0%   (0/22)0%   (0/4)
addSupportedPortletMode (String): void 0%   (0/1)0%   (0/6)0%   (0/2)
addSupportedWindowState (String): void 0%   (0/1)0%   (0/6)0%   (0/2)
getContainerName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPortalName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPortalVersion (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getPortletApp (String): PortletApplicationConfig 0%   (0/1)0%   (0/6)0%   (0/1)
getPortletApplications (): Set 0%   (0/1)0%   (0/7)0%   (0/1)
getPortletWindowConfig (String): PortletWindowConfig 0%   (0/1)0%   (0/45)0%   (0/13)
getRenderConfig (): RenderConfig 0%   (0/1)0%   (0/3)0%   (0/1)
getSupportedPortletModes (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
getSupportedWindowStates (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
setContainerName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setPortalName (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setPortalVersion (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setRenderConfig (RenderConfig): void 0%   (0/1)0%   (0/4)0%   (0/2)
setSupportedPortletModes (Set): void 0%   (0/1)0%   (0/4)0%   (0/2)
setSupportedWindowStates (Set): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/*
2 * Copyright 2004 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 at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * 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 and
14 * limitations under the License.
15 */
16package org.apache.pluto.driver.services.impl.resource;
17 
18import java.util.HashSet;
19import java.util.Map;
20import java.util.Set;
21 
22import org.apache.commons.logging.Log;
23import org.apache.commons.logging.LogFactory;
24import org.apache.pluto.driver.services.portal.PortletApplicationConfig;
25import org.apache.pluto.driver.services.portal.PortletWindowConfig;
26import org.apache.pluto.driver.services.portal.RenderConfig;
27 
28/**
29 * Encapsulation of the Pluto Driver ResourceConfig Info.
30 *
31 * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
32 * @version 1.0
33 * @since Sep 23, 2004
34 */
35public class ResourceConfig {
36 
37    /** Internal Logger. */
38    private static final Log LOG =
39        LogFactory.getLog(ResourceConfig.class);
40 
41    /** The name of the portal. */
42    private String portalName;
43 
44    /** The Version of the Portal. */
45    private String portalVersion;
46 
47    /** The name of the container wrapped by this portal. */
48    private String containerName;
49 
50    /** The portlet modes we will support. */
51    private Set supportedPortletModes;
52 
53    /** The window states we will support. */
54    private Set supportedWindowStates;
55 
56    /** The portlet applications registered with us. */
57    private Map portletApplications;
58 
59    /** Encapsulation of render configuration data. */
60    private RenderConfig renderConfig;
61 
62    /**
63     * Default Constructor.
64     */
65    public ResourceConfig() {
66        this.supportedWindowStates = new HashSet();
67        this.supportedPortletModes = new HashSet();
68        this.portletApplications = new java.util.HashMap();
69    }
70 
71    /**
72     * Standard Getter.
73     * @return the name of the portal.
74     */
75    public String getPortalName() {
76        return portalName;
77    }
78 
79    /**
80     * Standard Getter.
81     * @param portalName the name of the portal.
82     */
83    public void setPortalName(String portalName) {
84        this.portalName = portalName;
85    }
86 
87    /**
88     * Standard Getter.
89     * @return the portal version.
90     */
91    public String getPortalVersion() {
92        return portalVersion;
93    }
94 
95    /**
96     * Standard Setter.
97     * @param portalVersion the portal version.
98     */
99    public void setPortalVersion(String portalVersion) {
100        this.portalVersion = portalVersion;
101    }
102 
103    /**
104     * Standard Getter.
105     * @return the name of the container.
106     */
107    public String getContainerName() {
108        return containerName;
109    }
110 
111    /**
112     * Standard Setter.
113     * @param containerName the name of the container.
114     */
115    public void setContainerName(String containerName) {
116        this.containerName = containerName;
117    }
118 
119    /**
120     * Standard Getter.
121     * @return the names of the supported portlet modes.
122     */
123    public Set getSupportedPortletModes() {
124        return supportedPortletModes;
125    }
126 
127    /**
128     * Standard Setter.
129     * @param supportedPortletModes the names of the supported portlet modes.
130     */
131    public void setSupportedPortletModes(Set supportedPortletModes) {
132        this.supportedPortletModes = supportedPortletModes;
133    }
134 
135    /**
136     * Add the named supported portlet mode to the list of supported modes.
137     * @param mode a supported mode.
138     */
139    public void addSupportedPortletMode(String mode) {
140        supportedPortletModes.add(mode);
141    }
142 
143    /**
144     * Standard Getter.
145     * @return the names of the supported window states.
146     */
147    public Set getSupportedWindowStates() {
148        return supportedWindowStates;
149    }
150 
151    /**
152     * Standard Setter.
153     * @param supportedWindowStates the names of the supported window states.
154     */
155    public void setSupportedWindowStates(Set supportedWindowStates) {
156        this.supportedWindowStates = supportedWindowStates;
157    }
158 
159    /**
160     * Add the named supported window state to the list of supported states.
161     * @param state the name of the supported state.
162     */
163    public void addSupportedWindowState(String state) {
164        this.supportedWindowStates.add(state);
165    }
166 
167    /**
168     * Standard Getter.
169     * @return the configuration data of all configured portlet applications.
170     */
171    public Set getPortletApplications() {
172        return new HashSet(portletApplications.values());
173    }
174 
175    /**
176     * Add a porltet applicaiton conofiguration to this list of portlet apps.
177     * @param app portlet application coniguration data.
178     */
179    public void addPortletApp(PortletApplicationConfig app) {
180        if (LOG.isDebugEnabled()) {
181            LOG.debug(
182                " - - Adding PortletApp ResourceConfig for: " +
183                app.getContextPath());
184        }
185        portletApplications.put(app.getContextPath(), app);
186    }
187 
188    /**
189     * Retrieve the portlet application with the given id.
190     * @param id the id of the portlet application.
191     * @return the portlet application configuration data.
192     */
193    public PortletApplicationConfig getPortletApp(String id) {
194        return (PortletApplicationConfig) portletApplications.get(id);
195    }
196 
197    /**
198     * Retrieve the window configuration associated with the given id.
199     * @param id the id of the portlet window.
200     * @return the portlet window configuration data.
201     */
202    public PortletWindowConfig getPortletWindowConfig(String id) {
203        if (id == null) {
204            return null;
205        }
206        
207        // IU_MOD--START
208        String context = PortletWindowConfig.parseContextPath(id);
209        String portlet = PortletWindowConfig.parsePortletName(id);
210        String portletId = PortletWindowConfig.parsePortletInstanceId(id);
211        
212        PortletApplicationConfig app = getPortletApp(context);
213        if (app == null) {
214            if (LOG.isErrorEnabled()) {
215                LOG.error("Portlet Application '" + context + "' not found.");
216            }
217            return null;
218        }
219        
220        PortletWindowConfig config = app.getPortlet(portlet);
221        config.setPortletId(portletId);
222        return config;
223        // IU_MOD--END
224    }
225 
226    /**
227     * Standard Getter.
228     * @return the render configuration.
229     */
230    public RenderConfig getRenderConfig() {
231        return renderConfig;
232    }
233 
234    /**
235     * Standard Setter.
236     * @param renderConfig the render configuration.
237     */
238    public void setRenderConfig(RenderConfig renderConfig) {
239        this.renderConfig = renderConfig;
240    }
241 
242    // IU_MOD--START
243    // Removed a bunch of methods
244}
245 

[all classes][org.apache.pluto.driver.services.impl.resource]
EMMA 2.0.5312 (C) Vladimir Roubtsov