KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > management > j2eemanagement > J2EEManagedObject


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  * --------------------------------------------------------------------------
22  * $Id: J2EEManagedObject.java,v 1.11 2005/04/28 11:19:24 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.management.j2eemanagement;
27
28 import org.objectweb.jonas.management.ReconfigDispatcher;
29
30 /**
31  * This class implements the J2EEManagedObject type specified in JSR77
32  * @author Adriana Danes
33  */

34 public class J2EEManagedObject extends ReconfigDispatcher {
35
36     // ------------------------------------------------------------- Private
37
// Constants
38
// the following strings represent key properties within
39
// a J2EEManagedObject's objectName cf. JSR 77
40
/**
41      * Name constant
42      */

43     public static final String JavaDoc NAME = "name";
44
45     /**
46      * Constant for j2ee server
47      */

48     public static final String JavaDoc J2EE_TYPE_SERVER = "J2EEServer";
49
50     /**
51      * Constant for a j2ee application
52      */

53     public static final String JavaDoc J2EE_TYPE_APPLICATION = "J2EEApplication";
54
55     // ------------------------------------------------------------- Properties
56

57     /**
58      * The managed object name
59      */

60     private String JavaDoc objectName;
61
62     /**
63      * State management support for this managed object (start, stop, ...)
64      */

65     private boolean stateManageable;
66
67     /**
68      * Performance statistics support for this managed object.
69      */

70     private boolean statisticsProvider;
71
72     /**
73      * Event provider support for this managed object.
74      */

75     private boolean eventProvider;
76
77     // ------------------------------------------------------------- Contructors
78

79     /**
80      * MBean constructor
81      * @param objectName The complete name of the managed object
82      */

83     protected J2EEManagedObject(String JavaDoc objectName) {
84         this.objectName = objectName;
85         this.stateManageable = false;
86         this.statisticsProvider = false;
87         this.eventProvider = false;
88     }
89
90     /**
91      * MBean constructor
92      * @param objectName object name of the managed object
93      * @param stateManageable if true, this managed object implements J2EE State
94      * Management Model
95      * @param statisticsProvider if true, this managed object implements the
96      * J2EE StatisticProvide Model
97      * @param eventProvider if true, this managed object implements the J2EE
98      * EventProvider Model
99      */

100     protected J2EEManagedObject(String JavaDoc objectName, boolean stateManageable, boolean statisticsProvider,
101             boolean eventProvider) {
102         this.objectName = objectName;
103         this.stateManageable = stateManageable;
104         this.statisticsProvider = statisticsProvider;
105         this.eventProvider = eventProvider;
106     }
107
108     // ------------------------------------------------------------- Properties
109
// accessors
110

111     /**
112      * Return this MBean's name
113      * @return The name of the MBean (see OBJECT_NAME in the JSR77)
114      */

115     public String JavaDoc getObjectName() {
116         return objectName;
117     }
118
119     /**
120      * @return true if it is an event provider
121      */

122     public boolean isEventProvider() {
123         return eventProvider;
124     }
125
126     /**
127      * @return true if this managed object implements J2EE State Management
128      * Model
129      */

130     public boolean isStateManageable() {
131         return stateManageable;
132     }
133
134     /**
135      * @return true if this managed object implements the J2EE StatisticProvider
136      * Model
137      */

138     public boolean isStatisticsProvider() {
139         return statisticsProvider;
140     }
141
142 }
143
Popular Tags