KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > container > management > JContainer3Identifier


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@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: JContainer3Identifier.java 988 2006-07-31 11:12:59Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.container.management;
27
28 import org.objectweb.easybeans.api.EZBContainer;
29 import org.objectweb.easybeans.api.EZBServer;
30 import org.objectweb.easybeans.jmx.MBeansException;
31 import org.objectweb.easybeans.jmx.MBeansHelper;
32 import org.objectweb.easybeans.jsr77.JSR77ManagementIdentifier;
33
34 /**
35  * Generates an ObjectName for an EZBContainer MBean.
36  *
37  * @author Guillaume Sauthier
38  */

39 public class JContainer3Identifier extends
40         JSR77ManagementIdentifier<EZBContainer> {
41
42     /**
43      * JMX MBean Type.
44      */

45     private static final String JavaDoc TYPE = "EJBModule";
46
47     /**
48      * {@inheritDoc}
49      */

50     public String JavaDoc getAdditionnalProperties(final EZBContainer instance) {
51         StringBuilder JavaDoc sb = new StringBuilder JavaDoc();
52         // J2EEServer=?
53
EZBServer server = instance.getConfiguration().getEZBServer();
54         String JavaDoc parent = null;
55         try {
56             parent = MBeansHelper.getInstance().getObjectName(server);
57             sb.append(getParentNameProperty(parent));
58
59             // TODO Add inherited properties ...
60
} catch (MBeansException e) {
61             getLogger().warn("Cannot retrieve parent ObjectName for ''{0}''", sb);
62         }
63
64         return sb.toString();
65     }
66
67     /**
68      * {@inheritDoc}
69      */

70     public String JavaDoc getNamePropertyValue(final EZBContainer instance) {
71         return instance.getName().replace(":", "|");
72     }
73
74     /**
75      * {@inheritDoc}
76      */

77     public String JavaDoc getTypeValue() {
78         return TYPE;
79     }
80
81 }
82
Popular Tags