01: /*
02: * Created on 21-Mar-2003
03: */
04: package net.sf.jportlet.service;
05:
06: import org.apache.commons.logging.Log;
07: import org.apache.commons.logging.LogFactory;
08:
09: /**
10: * Base class of all {@link net.sf.jportlet.service.PortletService}
11: *
12: * @author <a href="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
13: */
14: public abstract class PortletServiceAdapter implements PortletService {
15: //~ Instance fields --------------------------------------------------------
16:
17: protected Log _log = LogFactory.getLog(getClass().getName());
18: protected PortletServiceConfig _serviceConfig;
19: protected PortletServiceContext _serviceContext;
20:
21: //~ Methods ----------------------------------------------------------------
22:
23: /**
24: * @see net.sf.jportlet.service.PortletService#destroy()
25: */
26: public void destroy() {
27: if (_log.isDebugEnabled()) {
28: _log.debug("Destroying");
29: }
30: }
31:
32: /**
33: * @see net.sf.jportlet.service.PortletService#init(net.sf.jportlet.service.PortletServiceConfig)
34: */
35: public void init(PortletServiceConfig config)
36: throws PortletServiceException {
37: if (_log.isDebugEnabled()) {
38: _log.debug("Initializing");
39: }
40:
41: _serviceConfig = config;
42: _serviceContext = config.getServiceContext();
43: }
44:
45: public String getInitParameter(String name) {
46: return getInitParameter(name, null);
47: }
48:
49: public String getInitParameter(String name, String defaultValue) {
50: String value = _serviceConfig.getInitParameter(name);
51: if (value == null) {
52: value = defaultValue;
53: }
54:
55: if (_log.isDebugEnabled()) {
56: _log.debug(name + "=" + value);
57: }
58:
59: return value;
60: }
61:
62: /**
63: * @see net.sf.jportlet.service.PortletService#getServiceConfig()
64: */
65: public PortletServiceConfig getServiceConfig() {
66: return _serviceConfig;
67: }
68: }
|