001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: EJBModule.java 8140 2006-03-20 13:08:28Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.container;
025:
026: // JOnAS Management
027: import java.net.URL;
028: import java.util.ArrayList;
029:
030: import javax.management.ObjectName;
031:
032: import org.objectweb.jonas.jmx.J2eeObjectName;
033: import org.objectweb.jonas.management.j2eemanagement.J2EEModule;
034: import org.objectweb.jonas_ejb.container.JContainer;
035:
036: /**
037: * MBean class for EJBModule management
038: *
039: * @author Adriana Danes JSR 77 (J2EE Management Standard)
040: */
041: public class EJBModule extends J2EEModule {
042:
043: protected JContainer cont;
044:
045: // JSR 77
046: private ArrayList ejbs = new ArrayList();
047:
048: // private attributes
049: String containerName = null;
050: String fileName = null;
051: /**
052: * J2EEApplication MBean OBJECT_NAME in ear case
053: */
054: private String earON = null;
055: /**
056: * URL of the ear
057: */
058: private URL earURL = null;
059:
060: /**
061: * We are in ear case or not ?
062: */
063: private boolean inEarCase = false;
064:
065: public EJBModule(ObjectName objectName, JContainer cont,
066: String fileName, String containerName, String j2eeAppName,
067: URL earUrl) {
068: super (objectName.toString());
069: this .cont = cont;
070: this .fileName = fileName;
071: this .containerName = containerName;
072: if (j2eeAppName != null && earUrl != null) {
073: ObjectName j2eeAppOn = J2eeObjectName.J2EEApplication(
074: objectName.getDomain(), objectName
075: .getKeyProperty("J2EEServer"), j2eeAppName);
076: earON = j2eeAppOn.toString();
077: this .earURL = earUrl;
078: inEarCase = true;
079: }
080: }
081:
082: public String[] getEjbs() {
083: return ((String[]) ejbs.toArray(new String[ejbs.size()]));
084: }
085:
086: protected void addEjb(String ejbObjectName) {
087: ejbs.add(ejbObjectName);
088: }
089:
090: public int getCurrentNumberOfEJB() {
091: return ejbs.size();
092: }
093:
094: public int getCurrentNumberOfBMP() {
095: return cont.getEntityBMPNb();
096: }
097:
098: public int getCurrentNumberOfCMP() {
099: return cont.getEntityCMPNb();
100: }
101:
102: public int getCurrentNumberOfSBF() {
103: return cont.getStatefulSessionNb();
104: }
105:
106: public int getCurrentNumberOfSBL() {
107: return cont.getStatelessSessionNb();
108: }
109:
110: public int getCurrentNumberOfMDB() {
111: return cont.getMessageDrivenNb();
112: }
113:
114: public String getContainerName() {
115: return containerName;
116: }
117:
118: public String getFileName() {
119: return fileName;
120: }
121:
122: public String getEarON() {
123: return earON;
124: }
125:
126: public URL getEarURL() {
127: return earURL;
128: }
129:
130: public boolean isInEarCase() {
131: return inEarCase;
132: }
133:
134: }
|