001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Scott Ferguson
028: */
029:
030: package com.caucho.management.j2ee;
031:
032: import com.caucho.Version;
033: import com.caucho.loader.EnvironmentLocal;
034: import com.caucho.server.cluster.Server;
035:
036: /**
037: * Management interface for a J2EE server.
038: * The J2EEServer corresponds to one instance of the product.
039: */
040: public class J2EEServer extends J2EEManagedObject {
041: private static EnvironmentLocal<J2EEServer> _j2eeServerLocal = new EnvironmentLocal<J2EEServer>(
042: "caucho.jmx.j2ee.J2EEServer");
043:
044: private final Server _server;
045:
046: static J2EEServer getLocal() {
047: return _j2eeServerLocal.get();
048: }
049:
050: public J2EEServer(Server server) {
051: _server = server;
052:
053: _j2eeServerLocal.set(this );
054: }
055:
056: protected String getName() {
057: return _server.getServerId();
058: }
059:
060: protected boolean isJ2EEServer() {
061: return false;
062: }
063:
064: protected boolean isJ2EEApplication() {
065: return false;
066: }
067:
068: /**
069: * Returns the ObjectNames of the
070: * {@link J2EEApplication}, {@link AppClientModule},
071: * {@link ResourceAdapterModule}, {@link EJBModule}, and
072: * {@link WebModule}
073: * management beans for this server.
074: */
075: public String[] getDeployedObjects() {
076: return queryObjectNamesSet(new String[][] {
077: { "j2eeType", "J2EEApplication" },
078: { "j2eeType", "AppClientModule" },
079: { "j2eeType", "ResourceAdapterModule" },
080: { "j2eeType", "EJBModule" },
081: { "j2eeType", "WebModule" } });
082: }
083:
084: /**
085: * Returns the ObjectNames of the
086: * {@link JCAResource}, {@link JavaMailResource},
087: * {@link JDBCResource}, {@link JMSResource},
088: * {@link JNDIResource}, {@link JTAResource},
089: * {@link RMI_IIOPResource}, {and @link URLResource},
090: * management beans for this server.
091: */
092: public String[] getResources() {
093: return queryObjectNamesSet(new String[][] {
094: { "j2eeType", "JCAResource" },
095: { "j2eeType", "JavaMailResource" },
096: { "j2eeType", "JDBCResource" },
097: { "j2eeType", "JMSResource" },
098: { "j2eeType", "JNDIResource" },
099: { "j2eeType", "JTAResource" },
100: { "j2eeType", "RMI_IIOPResource" },
101: { "j2eeType", "URLResource" }, });
102: }
103:
104: /**
105: * Returns the ObjectNames of the {@link JVM}
106: * management beans for each virtual machine on which
107: * this J2EEServer has running threads.
108: */
109: public String[] getJavaVMs() {
110: return queryObjectNames("j2eeType", "JVM");
111: }
112:
113: /**
114: * Returns the server vendor
115: */
116: public String getServerVendor() {
117: return "Caucho Technology, Inc.";
118: }
119:
120: /**
121: * Returns the server version
122: */
123: public String getServerVersion() {
124: return Version.FULL_VERSION;
125: }
126:
127: }
|