1 | package org.apache.pluto.driver.services.impl.resource; |
2 | |
3 | import java.io.InputStream; |
4 | import java.util.List; |
5 | import java.util.Set; |
6 | |
7 | import javax.servlet.ServletContext; |
8 | |
9 | import org.apache.pluto.driver.config.DriverConfigurationException; |
10 | import org.apache.pluto.driver.services.portal.PageConfig; |
11 | import org.apache.pluto.driver.services.portal.PortletApplicationConfig; |
12 | import org.apache.pluto.driver.services.portal.PortletWindowConfig; |
13 | import org.apache.pluto.driver.services.portal.RenderConfigService; |
14 | import org.apache.pluto.driver.services.portal.admin.RenderConfigAdminService; |
15 | |
16 | public class OneStartRenderConfigServiceImpl implements RenderConfigService, RenderConfigAdminService { |
17 | |
18 | |
19 | private ResourceConfig config; |
20 | |
21 | // |
22 | // Lifecycle Methods |
23 | // |
24 | /** |
25 | * Initialization Lifecycle Method |
26 | * @param ctx |
27 | */ |
28 | public void init(ServletContext ctx) { |
29 | try { |
30 | InputStream in = ctx.getResourceAsStream(OneStartResourceConfigReader.CONFIG_FILE); |
31 | config = OneStartResourceConfigReader.getFactory().parse(in); |
32 | } |
33 | catch(Exception e) { |
34 | throw new DriverConfigurationException(e); |
35 | } |
36 | } |
37 | |
38 | /** |
39 | * Shutdown the ResourceService. |
40 | */ |
41 | public void destroy() { |
42 | config = null; |
43 | } |
44 | |
45 | // |
46 | // public String getPortalName() { |
47 | // return config.getPortalName(); |
48 | // } |
49 | // |
50 | // public String getPortalVersion() { |
51 | // return config.getPortalVersion(); |
52 | // } |
53 | // |
54 | // public String getContainerName() { |
55 | // return config.getContainerName(); |
56 | // } |
57 | // |
58 | // public Set getSupportedPortletModes() { |
59 | // return config.getSupportedPortletModes(); |
60 | // } |
61 | // |
62 | // public Set getSupportedWindowStates() { |
63 | // return config.getSupportedWindowStates(); |
64 | // } |
65 | // |
66 | // public Set getPortletApplications() { |
67 | // return config.getPortletApplications(); |
68 | // } |
69 | // |
70 | // public PortletApplicationConfig getPortletApplication(String id) { |
71 | // return config.getPortletApp(id); |
72 | // } |
73 | // |
74 | // public PortletWindowConfig getPortletWindowConfig(String id) { |
75 | // return config.getPortletWindowConfig(id); |
76 | // } |
77 | // |
78 | // public PortletWindowConfig getPortlet(String id) { |
79 | // return config.getPortletWindowConfig(id); |
80 | // } |
81 | |
82 | public List getPages() { |
83 | return config.getRenderConfig().getPages(); |
84 | } |
85 | |
86 | public PageConfig getDefaultPage() { |
87 | return config.getRenderConfig().getPageConfig(null); |
88 | } |
89 | |
90 | public PageConfig getPage(String id) { |
91 | return config.getRenderConfig().getPageConfig(id); |
92 | } |
93 | |
94 | public void addPage(PageConfig pageConfig) { |
95 | config.getRenderConfig().addPage(pageConfig); |
96 | } |
97 | |
98 | } |