EjbItem.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * Initial developer(s): Michel-Ange ANTON
00022  * --------------------------------------------------------------------------
00023  * $Id: EjbItem.java,v 1.8 2004/03/08 15:24:52 danesa Exp $
00024  * --------------------------------------------------------------------------
00025  */
00026 
00027 package org.objectweb.jonas.webapp.jonasadmin.service.ejb;
00028 
00029 import javax.management.ObjectName;
00030 
00031 import org.objectweb.jonas.jmx.JonasManagementRepr;
00032 import org.objectweb.jonas.webapp.jonasadmin.common.NameItem;
00033 
00034 public class EjbItem implements NameItem {
00035 
00036 // --------------------------------------------------------- Public Constants
00037 
00038     //public final static String EJB_BMP_STRING = "Bmp";
00039     //public final static String EJB_CMP_STRING = "Cmp";
00040     public final static String EJB_ENT_STRING = "Ent";
00041     public final static String EJB_SBF_STRING = "Sbf";
00042     public final static String EJB_SBL_STRING = "Sbl";
00043     public final static String EJB_MDB_STRING = "Mdb";
00044 
00045 // --------------------------------------------------------- Properties Variables
00046 
00047     private String type = null; // J2eeType
00048     private String filename = null;
00049     private String name = null;
00050     private String typeString = null;// this is used to construct action names
00051     //private String typeStringResource = null;
00052     private String objectName = null;
00053 
00054 // --------------------------------------------------------- Constructors
00055 
00056     public EjbItem() {
00057         type = null;
00058         filename = null;
00059         name = null;
00060         objectName = null;
00061     }
00062     public EjbItem(ObjectName p_On) 
00063         throws Exception {
00064         setName(p_On.getKeyProperty("name"));
00065         setType(p_On.getKeyProperty("j2eeType"));
00066         String fname = (String) JonasManagementRepr.getAttribute(p_On, "fileName");
00067         setFilename(fname);
00068         setObjectName(p_On.toString());
00069     }
00070 
00071 // --------------------------------------------------------- Properties Methods
00072 
00073     public String getType() {
00074         return type;
00075     }
00076 
00077     public void setType(String type) {
00078         this.type = type;
00079         if (type.equals("StatelessSessionBean")) {
00080             typeString = EJB_SBL_STRING;  
00081         } else if (type.equals("StatefulSessionBean")) {
00082             typeString = EJB_SBF_STRING;
00083         } else if (type.equals("EntityBean")) {
00084             typeString = EJB_ENT_STRING;
00085         } else if (type.equals("MessageDrivenBean")) {
00086             typeString = EJB_MDB_STRING;
00087         } else {
00088             typeString = "?";
00089         }
00090     }
00091 
00092     public String getName() {
00093         return name;
00094     }
00095 
00096     public void setName(String name) {
00097         this.name = name;
00098     }
00099 
00100     public String getObjectName() {
00101         return objectName;
00102     }
00103 
00104     public void setObjectName(String objectName) {
00105         this.objectName = objectName;
00106     }
00107 
00108     public String getFilename() {
00109         return filename;
00110     }
00111 
00112     public void setFilename(String filename) {
00113         this.filename = filename;
00114     }
00115 
00116     public String getTypeString() {
00117         return typeString;
00118     }
00119 }

Generated on Tue Feb 15 15:05:32 2005 for JOnAS by  doxygen 1.3.9.1