01: /*
02: * Created on Mar 8, 2003
03: */
04: package net.sf.jportlet.impl;
05:
06: import java.util.Enumeration;
07:
08: import javax.servlet.ServletConfig;
09: import javax.servlet.ServletContext;
10:
11: import net.sf.jportlet.portlet.Client;
12: import net.sf.jportlet.portlet.Portlet.Mode;
13: import net.sf.jportlet.portlet.PortletConfig;
14: import net.sf.jportlet.portlet.PortletContext;
15: import net.sf.jportlet.portlet.application.PortletApplication;
16: import net.sf.jportlet.portlet.application.PortletProxy;
17: import net.sf.jportlet.portlet.descriptor.PortletDescriptor;
18:
19: /**
20: * Implementation of {@link net.sf.jportlet.portlet.PortletConfig}
21: *
22: * @author <a href="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
23: */
24: public class PortletConfigImpl implements PortletConfig {
25: //~ Instance fields --------------------------------------------------------
26:
27: private PortletDescriptor _descriptor;
28: private PortletContext _portletContext;
29: private ServletConfig _servletConfig;
30:
31: //~ Constructors -----------------------------------------------------------
32:
33: public PortletConfigImpl(PortletProxy proxy,
34: ServletConfig servletConfig, PortletApplication application) {
35: _descriptor = proxy.getDescriptor();
36: _servletConfig = servletConfig;
37: _portletContext = new PortletContextImpl(proxy, application,
38: servletConfig.getServletContext());
39: }
40:
41: //~ Methods ----------------------------------------------------------------
42:
43: /**
44: * @see javax.servlet.ServletConfig#getInitParameter(java.lang.String)
45: */
46: public String getInitParameter(String name) {
47: return _descriptor.getInitParameter(name);
48: }
49:
50: /**
51: * @see javax.servlet.ServletConfig#getInitParameterNames()
52: */
53: public Enumeration getInitParameterNames() {
54: return _descriptor.getInitParameterNames();
55: }
56:
57: /**
58: * @see net.sf.jportlet.portlet.PortletConfig#getPortletContext()
59: */
60: public PortletContext getPortletContext() {
61: return _portletContext;
62: }
63:
64: /**
65: * @see net.sf.jportlet.portlet.PortletConfig#getPortletName()
66: */
67: public String getPortletName() {
68: return _descriptor.getName();
69: }
70:
71: /**
72: * @see javax.servlet.ServletConfig#getServletContext()
73: */
74: public ServletContext getServletContext() {
75: return _servletConfig.getServletContext();
76: }
77:
78: /**
79: * @see javax.servlet.ServletConfig#getServletName()
80: */
81: public String getServletName() {
82: return _servletConfig.getServletName();
83: }
84:
85: /**
86: * @see net.sf.jportlet.portlet.PortletConfig#supports(net.sf.jportlet.portlet.Portlet.Mode, net.sf.jportlet.portlet.Client)
87: */
88: public boolean supports(Mode mode, Client client) {
89: return _descriptor.supports(mode, client.getMarkup());
90: }
91: }
|