KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > clustering > NamedMBeanImpl


1 /**
2  *
3  * Copyright 2003-2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.clustering;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22
23 /**
24  * A base class containing fnality useful to Named MBeans of the
25  * Clustering module.
26  *
27  * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
28  */

29 public abstract class
30   NamedMBeanImpl
31   extends MBeanImpl
32 {
33   protected Log _log=LogFactory.getLog(NamedMBeanImpl.class);
34
35   /**
36    * Returns the MBean's name.
37    *
38    * @return a <code>String</code> value
39    */

40   public String JavaDoc getName() {return _objectName.getKeyProperty("name");}
41
42   //----------------------------------------
43
// GeronimoMBeanTarget
44
//----------------------------------------
45

46   public boolean
47     canStart()
48   {
49     if (!super.canStart()) return false;
50
51     if (_objectName.getKeyProperty("name")==null)
52     {
53       _log.warn("MBean name must contain a 'name' property");
54       return false;
55     }
56
57     return true;
58   }
59   /*
60   public static GeronimoMBeanInfo
61     getGeronimoMBeanInfo()
62   {
63     GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
64     // set target class in concrete subclasses...
65     mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name", true, false, "this Object's name"));
66     return mbeanInfo;
67   }
68   */

69 }
70
Popular Tags