01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2007 Bull S.A.S.
04: * Contact: jonas-team@ow2.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19: *
20: * --------------------------------------------------------------------------
21: * $Id: CmiComponent.java 2164 2007-12-11 21:34:34Z loris $
22: * --------------------------------------------------------------------------
23: */package org.ow2.easybeans.component.cmi;
24:
25: import org.ow2.easybeans.component.api.EZBComponent;
26: import org.ow2.easybeans.component.api.EZBComponentException;
27: import org.ow2.easybeans.server.ServerConfig;
28: import org.ow2.util.log.Log;
29: import org.ow2.util.log.LogFactory;
30:
31: /**
32: * Component providing a support of CMI.
33: * @author WEI Zhouyue & ZHU Ning
34: */
35: public class CmiComponent implements EZBComponent {
36:
37: /**
38: * Logger.
39: */
40: private Log logger = LogFactory.getLog(CmiComponent.class);
41:
42: /**
43: * Configuration of the embedded instance.
44: */
45: private ServerConfig config;
46:
47: /**
48: * Init method.<br/>
49: * This method is called before the start method.
50: * @throws EZBComponentException if the initialization has failed.
51: */
52: public void init() throws EZBComponentException {
53: // Do nothing
54: }
55:
56: /**
57: * Start method.<br/>
58: * This method is called after the init method.
59: * @throws EZBComponentException if the start has failed.
60: */
61: public void start() throws EZBComponentException {
62: // Add the callback
63: config.addExtensionFactory(new CmiConfigurationExtension());
64: logger.debug("The CMI configuration extension has been added.");
65: }
66:
67: /**
68: * Stop method.<br/>
69: * This method is called when component needs to be stopped.
70: * @throws EZBComponentException if the stop is failing.
71: */
72: public void stop() throws EZBComponentException {
73: // Do nothing
74: }
75:
76: /**
77: * Return the configuration of the embedded instance.
78: * @return the configuration of the embedded instance
79: */
80: public ServerConfig getServerConfig() {
81: return config;
82: }
83:
84: /**
85: * Set the configuration of the embedded instance.
86: * @param config the configuration of the embedded instance
87: */
88: public void setServerConfig(final ServerConfig config) {
89: this.config = config;
90: }
91:
92: }
|