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 [OneStartPortletRegistryServiceImpl.java]

nameclass, %method, %block, %line, %
OneStartPortletRegistryServiceImpl.java100% (1/1)22%  (2/9)6%   (7/127)9%   (3/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OneStartPortletRegistryServiceImpl100% (1/1)22%  (2/9)6%   (7/127)9%   (3/35)
addPortletApplication (String): void 0%   (0/1)0%   (0/5)0%   (0/1)
destroy (): void 0%   (0/1)0%   (0/1)0%   (0/1)
getAdminService (): AdminService 0%   (0/1)0%   (0/3)0%   (0/1)
getPortlet (String): PortletWindowConfig 0%   (0/1)0%   (0/32)0%   (0/11)
getPortletApplication (String): PortletApplicationConfig 0%   (0/1)0%   (0/6)0%   (0/1)
getPortletApplications (): Set 0%   (0/1)0%   (0/7)0%   (0/1)
init (ServletContext): void 0%   (0/1)0%   (0/66)0%   (0/16)
OneStartPortletRegistryServiceImpl (): void 100% (1/1)100% (3/3)100% (1/1)
setAdminService (AdminService): void 100% (1/1)100% (4/4)100% (2/2)

1package org.apache.pluto.driver.services.impl.resource;
2 
3import java.util.HashMap;
4import java.util.HashSet;
5import java.util.Iterator;
6import java.util.Map;
7import java.util.Set;
8 
9import javax.servlet.ServletContext;
10 
11import org.apache.pluto.driver.config.DriverConfigurationException;
12import org.apache.pluto.driver.services.portal.PortletApplicationConfig;
13import org.apache.pluto.driver.services.portal.PortletRegistryService;
14import org.apache.pluto.driver.services.portal.PortletWindowConfig;
15import org.apache.pluto.driver.services.portal.admin.DriverAdministrationException;
16import org.apache.pluto.driver.services.portal.admin.PortletRegistryAdminService;
17 
18import edu.iu.uis.sit.portal.portlet.admin.domain.PortalConfig;
19import edu.iu.uis.sit.portal.portlet.admin.domain.PortletApplication;
20import edu.iu.uis.sit.portal.portlet.admin.domain.PortletConfig;
21import edu.iu.uis.sit.portal.portlet.admin.services.AdminService;
22 
23public class OneStartPortletRegistryServiceImpl implements PortletRegistryService, PortletRegistryAdminService {
24   
25    private PortalConfig portalConfig;
26    
27    private ServletContext servletContext;
28 
29    private Map portletApplications;
30 
31    private AdminService adminService;
32 
33    public void init(ServletContext servletContext) throws DriverConfigurationException {
34        portletApplications = new HashMap();
35        portalConfig = getAdminService().getPortalConfig();
36        for (Iterator iter = portalConfig.getPortletApplications().iterator(); iter.hasNext();) {
37            PortletApplication application = (PortletApplication) iter.next();
38            PortletApplicationConfig config = new PortletApplicationConfig();
39            config.setContextPath(application.getContextPath());
40            for (Iterator iterator = application.getPortletConfigs().iterator(); iterator.hasNext();) {
41                PortletConfig portletConfig = (PortletConfig) iterator.next();
42                PortletWindowConfig portletWindowConfig = new PortletWindowConfig();
43                portletWindowConfig.setContextPath(application.getContextPath());
44                portletWindowConfig.setPortletName(portletConfig.getPortletName());
45                config.addPortlet(portletWindowConfig);
46            }
47            portletApplications.put(application.getContextPath(), config);
48        }
49    }
50 
51    public void destroy() throws DriverConfigurationException {}
52 
53 
54    public Set getPortletApplications() {
55        return new HashSet(portletApplications.values());
56    }
57 
58    public PortletApplicationConfig getPortletApplication(String id) {
59        return (PortletApplicationConfig)portletApplications.get(id);
60    }
61 
62    public PortletWindowConfig getPortlet(String id) {
63        if (id == null) {
64            return null;
65        }
66        
67        String context = PortletWindowConfig.parseContextPath(id);
68        String portlet = PortletWindowConfig.parsePortletName(id);
69        String portletId = PortletWindowConfig.parsePortletInstanceId(id);
70        
71        PortletApplicationConfig app = (PortletApplicationConfig) portletApplications.get(context);
72        if (app == null) {
73            return null;
74        }
75        
76        PortletWindowConfig config = app.getPortlet(portlet);
77        config.setPortletId(portletId);
78        return config;
79    }
80 
81    public AdminService getAdminService() {
82        return adminService;
83    }
84 
85    public void setAdminService(AdminService adminService) {
86        this.adminService = adminService;
87    }
88 
89    public void addPortletApplication(String portletContext) throws DriverAdministrationException {
90        throw new RuntimeException("OH CRAP!  I pitty the fool that gets this exception!");
91    }
92 
93}

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