KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > service > ejb > EjbItem


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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  * Initial developer(s): Michel-Ange ANTON
22  * --------------------------------------------------------------------------
23  * $Id: EjbItem.java,v 1.8 2004/03/08 15:24:52 danesa Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.webapp.jonasadmin.service.ejb;
28
29 import javax.management.ObjectName JavaDoc;
30
31 import org.objectweb.jonas.jmx.JonasManagementRepr;
32 import org.objectweb.jonas.webapp.jonasadmin.common.NameItem;
33
34 public class EjbItem implements NameItem {
35
36 // --------------------------------------------------------- Public Constants
37

38     //public final static String EJB_BMP_STRING = "Bmp";
39
//public final static String EJB_CMP_STRING = "Cmp";
40
public final static String JavaDoc EJB_ENT_STRING = "Ent";
41     public final static String JavaDoc EJB_SBF_STRING = "Sbf";
42     public final static String JavaDoc EJB_SBL_STRING = "Sbl";
43     public final static String JavaDoc EJB_MDB_STRING = "Mdb";
44
45 // --------------------------------------------------------- Properties Variables
46

47     private String JavaDoc type = null; // J2eeType
48
private String JavaDoc filename = null;
49     private String JavaDoc name = null;
50     private String JavaDoc typeString = null;// this is used to construct action names
51
//private String typeStringResource = null;
52
private String JavaDoc objectName = null;
53
54 // --------------------------------------------------------- Constructors
55

56     public EjbItem() {
57         type = null;
58         filename = null;
59         name = null;
60         objectName = null;
61     }
62     public EjbItem(ObjectName JavaDoc p_On)
63         throws Exception JavaDoc {
64         setName(p_On.getKeyProperty("name"));
65         setType(p_On.getKeyProperty("j2eeType"));
66         String JavaDoc fname = (String JavaDoc) JonasManagementRepr.getAttribute(p_On, "fileName");
67         setFilename(fname);
68         setObjectName(p_On.toString());
69     }
70
71 // --------------------------------------------------------- Properties Methods
72

73     public String JavaDoc getType() {
74         return type;
75     }
76
77     public void setType(String JavaDoc type) {
78         this.type = type;
79         if (type.equals("StatelessSessionBean")) {
80             typeString = EJB_SBL_STRING;
81         } else if (type.equals("StatefulSessionBean")) {
82             typeString = EJB_SBF_STRING;
83         } else if (type.equals("EntityBean")) {
84             typeString = EJB_ENT_STRING;
85         } else if (type.equals("MessageDrivenBean")) {
86             typeString = EJB_MDB_STRING;
87         } else {
88             typeString = "?";
89         }
90     }
91
92     public String JavaDoc getName() {
93         return name;
94     }
95
96     public void setName(String JavaDoc name) {
97         this.name = name;
98     }
99
100     public String JavaDoc getObjectName() {
101         return objectName;
102     }
103
104     public void setObjectName(String JavaDoc objectName) {
105         this.objectName = objectName;
106     }
107
108     public String JavaDoc getFilename() {
109         return filename;
110     }
111
112     public void setFilename(String JavaDoc filename) {
113         this.filename = filename;
114     }
115
116     public String JavaDoc getTypeString() {
117         return typeString;
118     }
119 }
120
Popular Tags