01: /**
02: * EasyBeans
03: * Copyright (C) 2006 Bull S.A.S.
04: * Contact: easybeans@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 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: JContainer3MBean.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.container.management;
25:
26: import java.net.URL;
27:
28: import javax.management.MBeanException;
29:
30: import org.ow2.easybeans.api.EZBContainerException;
31: import org.ow2.easybeans.jsr77.EJBModuleMBean;
32: import org.ow2.util.ee.deploy.api.archive.ArchiveException;
33:
34: /**
35: * MBean for {@link org.ow2.easybeans.container.JContainer3}.
36: * @author Guillaume Sauthier
37: */
38: public class JContainer3MBean extends EJBModuleMBean {
39:
40: /**
41: * Default ModelMBean constructor.
42: * @throws MBeanException if ModelMBean creation fails.
43: */
44: public JContainer3MBean() throws MBeanException {
45: super ();
46: }
47:
48: /**
49: * Start this container.
50: */
51: public void start() {
52: try {
53: getManagedComponent().start();
54: } catch (EZBContainerException ece) {
55: getLogger().error("Cannot start the EJB Container", ece);
56: throw new RuntimeException(ece);
57: }
58: }
59:
60: /**
61: * Gets the URL of the archive of this container.
62: * @return the URL of the archive of this container.
63: */
64: public URL getUrl() {
65: try {
66: return getManagedComponent().getArchive().getURL();
67: } catch (ArchiveException e) {
68: getLogger().error("Cannot get URL on the archive", e);
69: throw new RuntimeException(e);
70: }
71: }
72:
73: /**
74: * Stop this container.
75: */
76: public void stop() {
77: getManagedComponent().stop();
78: }
79:
80: }
|