001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: J2EEServerMBean.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.jsr77;
025:
026: import java.util.Map;
027:
028: import javax.management.MBeanException;
029: import javax.management.RuntimeOperationsException;
030:
031: import org.ow2.easybeans.api.EZBContainer;
032: import org.ow2.easybeans.api.EZBServer;
033: import org.ow2.easybeans.jmx.MBeansException;
034: import org.ow2.easybeans.jmx.MBeansHelper;
035: import org.ow2.easybeans.server.Version;
036:
037: /**
038: * J2EEServer MBean for JSR 77.
039: * @author Guillaume Sauthier
040: */
041: public class J2EEServerMBean extends J2EEManagedObjectMBean<EZBServer> {
042:
043: /**
044: * @throws MBeanException if creation fails
045: * @throws RuntimeOperationsException if creation fails
046: */
047: public J2EEServerMBean() throws MBeanException,
048: RuntimeOperationsException {
049: super ();
050: }
051:
052: /**
053: * @return Returns the ObjectNames of the deployed objects.
054: */
055: public String[] getDeployedObjects() {
056: Map<String, EZBContainer> containers = getManagedComponent()
057: .getContainers();
058: int size = containers.size();
059: String[] deployedObjects = new String[size];
060:
061: int index = 0;
062: for (EZBContainer container : containers.values()) {
063:
064: try {
065: deployedObjects[index] = MBeansHelper.getInstance()
066: .getObjectName(container);
067: } catch (MBeansException e) {
068: deployedObjects[index] = "";
069: }
070:
071: index++;
072: }
073:
074: return deployedObjects;
075: }
076:
077: /**
078: * non-sens in EasyBeans.
079: * @return Returns the ObjectName of the deployed Resources.
080: */
081: public String[] getResources() {
082: // TODO to be implemented
083: throw new UnsupportedOperationException("Not implemented yet !");
084: }
085:
086: /**
087: * @return Returns the ObjectNames of the Java VMs.
088: */
089: public String[] getJavaVMs() {
090: // TODO to be implemented
091: throw new UnsupportedOperationException("Not implemented yet !");
092: }
093:
094: /**
095: * @return Returns the Server Vendor name.
096: */
097: public String getServerVendor() {
098: return "OW2";
099: }
100:
101: /**
102: * @return Returns the Server version.
103: */
104: public String getServerVersion() {
105: return Version.getVersion();
106: }
107:
108: }
|