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: * Initial developer(s): Michel-Ange ANTON
022: * --------------------------------------------------------------------------
023: * $Id: EjbItem.java 9680 2006-10-06 12:08:33Z danesa $
024: * --------------------------------------------------------------------------
025: */
026:
027: package org.objectweb.jonas.webapp.jonasadmin.service.ejb;
028:
029: import javax.management.ObjectName;
030:
031: import org.objectweb.jonas.jmx.JonasManagementRepr;
032: import org.objectweb.jonas.webapp.jonasadmin.common.NameItem;
033:
034: public class EjbItem implements NameItem {
035:
036: // --------------------------------------------------------- Public Constants
037:
038: //public final static String EJB_BMP_STRING = "Bmp";
039: //public final static String EJB_CMP_STRING = "Cmp";
040: public final static String EJB_ENT_STRING = "Ent";
041: public final static String EJB_SBF_STRING = "Sbf";
042: public final static String EJB_SBL_STRING = "Sbl";
043: public final static String EJB_MDB_STRING = "Mdb";
044:
045: // --------------------------------------------------------- Properties Variables
046:
047: private String type = null; // J2eeType
048: private String filename = null;
049: private String name = null;
050: private String typeString = null;// this is used to construct action names
051: //private String typeStringResource = null;
052: private String objectName = null;
053:
054: // --------------------------------------------------------- Constructors
055:
056: public EjbItem() {
057: type = null;
058: filename = null;
059: name = null;
060: objectName = null;
061: }
062:
063: public EjbItem(ObjectName p_On, String serverName) throws Exception {
064: setName(p_On.getKeyProperty("name"));
065: setType(p_On.getKeyProperty("j2eeType"));
066: String fname = (String) JonasManagementRepr.getAttribute(p_On,
067: "fileName", serverName);
068: setFilename(fname);
069: setObjectName(p_On.toString());
070: }
071:
072: // --------------------------------------------------------- Properties Methods
073:
074: public String getType() {
075: return type;
076: }
077:
078: public void setType(String type) {
079: this .type = type;
080: if (type.equals("StatelessSessionBean")) {
081: typeString = EJB_SBL_STRING;
082: } else if (type.equals("StatefulSessionBean")) {
083: typeString = EJB_SBF_STRING;
084: } else if (type.equals("EntityBean")) {
085: typeString = EJB_ENT_STRING;
086: } else if (type.equals("MessageDrivenBean")) {
087: typeString = EJB_MDB_STRING;
088: } else {
089: typeString = "?";
090: }
091: }
092:
093: public String getName() {
094: return name;
095: }
096:
097: public void setName(String name) {
098: this .name = name;
099: }
100:
101: public String getObjectName() {
102: return objectName;
103: }
104:
105: public void setObjectName(String objectName) {
106: this .objectName = objectName;
107: }
108:
109: public String getFilename() {
110: return filename;
111: }
112:
113: public void setFilename(String filename) {
114: this .filename = filename;
115: }
116:
117: public String getTypeString() {
118: return typeString;
119: }
120: }
|