KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > management > j2ee > J2EEServer


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.management.j2ee;
31
32 import com.caucho.Version;
33 import com.caucho.loader.EnvironmentLocal;
34 import com.caucho.server.cluster.Server;
35
36 /**
37  * Management interface for a J2EE server.
38  * The J2EEServer corresponds to one instance of the product.
39  */

40 public class J2EEServer extends J2EEManagedObject {
41   private static EnvironmentLocal<J2EEServer> _j2eeServerLocal
42     = new EnvironmentLocal<J2EEServer>("caucho.jmx.j2ee.J2EEServer");
43
44   private final Server _server;
45
46   static J2EEServer getLocal()
47   {
48     return _j2eeServerLocal.get();
49   }
50
51   public J2EEServer(Server server)
52   {
53     _server = server;
54
55     _j2eeServerLocal.set(this);
56   }
57
58   protected String JavaDoc getName()
59   {
60     return _server.getServerId();
61   }
62
63   protected boolean isJ2EEServer()
64   {
65     return false;
66   }
67
68   protected boolean isJ2EEApplication()
69   {
70     return false;
71   }
72
73   /**
74    * Returns the ObjectNames of the
75    * {@link J2EEApplication}, {@link AppClientModule},
76    * {@link ResourceAdapterModule}, {@link EJBModule}, and
77    * {@link WebModule}
78    * management beans for this server.
79    */

80   public String JavaDoc []getDeployedObjects()
81   {
82     return queryObjectNamesSet(
83       new String JavaDoc[][] {
84         { "j2eeType", "J2EEApplication"},
85         { "j2eeType", "AppClientModule"},
86         { "j2eeType", "ResourceAdapterModule"},
87         { "j2eeType", "EJBModule"},
88         { "j2eeType", "WebModule"}
89       });
90   }
91
92   /**
93    * Returns the ObjectNames of the
94    * {@link JCAResource}, {@link JavaMailResource},
95    * {@link JDBCResource}, {@link JMSResource},
96    * {@link JNDIResource}, {@link JTAResource},
97    * {@link RMI_IIOPResource}, {and @link URLResource},
98    * management beans for this server.
99    */

100   public String JavaDoc []getResources()
101   {
102     return queryObjectNamesSet(
103       new String JavaDoc[][] {
104         { "j2eeType", "JCAResource" },
105         { "j2eeType", "JavaMailResource" },
106         { "j2eeType", "JDBCResource" },
107         { "j2eeType", "JMSResource" },
108         { "j2eeType", "JNDIResource" },
109         { "j2eeType", "JTAResource" },
110         { "j2eeType", "RMI_IIOPResource" },
111         { "j2eeType", "URLResource" },
112       });
113   }
114
115   /**
116    * Returns the ObjectNames of the {@link JVM}
117    * management beans for each virtual machine on which
118    * this J2EEServer has running threads.
119    */

120   public String JavaDoc []getJavaVMs()
121   {
122     return queryObjectNames("j2eeType", "JVM");
123   }
124
125   /**
126    * Returns the server vendor
127    */

128   public String JavaDoc getServerVendor()
129   {
130     return "Caucho Technology, Inc.";
131   }
132
133   /**
134    * Returns the server version
135    */

136   public String JavaDoc getServerVersion()
137   {
138     return Version.FULL_VERSION;
139   }
140
141 }
142
Popular Tags