KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > jsr77 > J2EEServerMBean


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: J2EEServerMBean.java 958 2006-07-27 08:59:01Z sauthieg $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.jsr77;
27
28 import java.util.Map JavaDoc;
29
30 import javax.management.MBeanException JavaDoc;
31 import javax.management.RuntimeOperationsException JavaDoc;
32
33 import org.objectweb.easybeans.api.EZBContainer;
34 import org.objectweb.easybeans.api.EZBServer;
35 import org.objectweb.easybeans.jmx.MBeansException;
36 import org.objectweb.easybeans.jmx.MBeansHelper;
37
38 /**
39  * J2EEServer MBean for JSR 77.
40  * @author Guillaume Sauthier
41  */

42 public class J2EEServerMBean extends J2EEManagedObjectMBean<EZBServer> {
43
44     /**
45      * @throws MBeanException if creation fails
46      * @throws RuntimeOperationsException if creation fails
47      */

48     public J2EEServerMBean() throws MBeanException JavaDoc, RuntimeOperationsException JavaDoc {
49         super();
50     }
51
52     /**
53      * @return Returns the ObjectNames of the deployed objects.
54      */

55     public String JavaDoc[] getDeployedObjects() {
56         Map JavaDoc<String JavaDoc, EZBContainer> containers = getManagedComponent().getContainers();
57         int size = containers.size();
58         String JavaDoc[] deployedObjects = new String JavaDoc[size];
59
60         int index = 0;
61         for(EZBContainer container : containers.values()) {
62
63             try {
64                 deployedObjects[index] = MBeansHelper.getInstance().getObjectName(container);
65             } catch (MBeansException e) {
66                 deployedObjects[index] = "";
67             }
68
69             index++;
70         }
71
72         return deployedObjects;
73     }
74
75     /**
76      * non-sens in EasyBeans.
77      * @return Returns the ObjectName of the deployed Resources.
78      */

79     public String JavaDoc[] getResources() {
80         // TODO to be implemented
81
throw new UnsupportedOperationException JavaDoc("Not implemented yet !");
82     }
83
84     /**
85      * @return Returns the ObjectNames of the Java VMs.
86      */

87     public String JavaDoc[] getJavaVMs() {
88         // TODO to be implemented
89
throw new UnsupportedOperationException JavaDoc("Not implemented yet !");
90     }
91
92     /**
93      * @return Returns the Server Vendor name.
94      */

95     public String JavaDoc getServerVendor() {
96         return "Objectweb";
97     }
98
99     /**
100      * @return Returns the Server version.
101      */

102     public String JavaDoc getServerVersion() {
103         return "Preview";
104     }
105
106 }
107
Popular Tags