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: EJBModuleMBean.java 1970 2007-10-16 11:49:25Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.ow2.easybeans.jsr77;
25:
26: import javax.management.MBeanException;
27:
28: import org.ow2.easybeans.api.Factory;
29: import org.ow2.easybeans.container.JContainer3;
30: import org.ow2.easybeans.jmx.MBeansException;
31: import org.ow2.easybeans.jmx.MBeansHelper;
32:
33: /**
34: * EJBModule JSR77 MBean for {@link org.ow2.easybeans.container.JContainer3}.
35: * @author Guillaume Sauthier
36: */
37: public class EJBModuleMBean extends J2EEModuleMBean<JContainer3> {
38:
39: /**
40: * Default ModelMBean constructor.
41: * @throws MBeanException if ModelMBean creation fails.
42: */
43: public EJBModuleMBean() throws MBeanException {
44: super ();
45: }
46:
47: /**
48: * @return Returns the ObjectNames of the EJB deployed.
49: */
50: public String[] getEjbs() {
51:
52: int size = getManagedComponent().getFactories().size();
53: String[] ejbs = new String[size];
54: int index = 0;
55: for (Factory<?, ?> f : getManagedComponent().getFactories()) {
56: try {
57: ejbs[index] = MBeansHelper.getInstance().getObjectName(
58: f);
59: } catch (MBeansException e) {
60: ejbs[index] = "";
61: }
62:
63: index++;
64: }
65: return ejbs;
66: }
67:
68: }
|