KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > util > AMXUtil


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * AMXUtil.java
26  *
27  * Created on April 13, 2005, 11:43 AM
28  */

29
30 package com.sun.enterprise.tools.admingui.util;
31
32 import java.util.*;
33
34 import javax.management.remote.JMXConnector JavaDoc;
35
36 import com.sun.appserv.management.DomainRoot;
37 import com.sun.appserv.management.base.QueryMgr;
38 import com.sun.appserv.management.base.UploadDownloadMgr;
39 import com.sun.appserv.management.config.DomainConfig;
40 import com.sun.appserv.management.client.ProxyFactory;
41 import com.sun.appserv.management.j2ee.J2EEDomain;
42 import com.sun.appserv.management.monitor.MonitoringRoot;
43
44 public class AMXUtil {
45
46     private static ProxyFactory amxProxyFactory = null;
47     private static DomainRoot domainRoot = null;
48     private static DomainConfig domainConfig = null;
49     private static J2EEDomain j2eeDomain = null;
50     private static MonitoringRoot monitoringRoot = null;
51     private static QueryMgr queryMgr = null;
52     private static UploadDownloadMgr uploadDownloadMgr = null;
53
54     private AMXUtil() {} //dummy constructor, all static methods.
55

56     public static DomainConfig getDomainConfig() {
57         return domainConfig == null ? getDomainRoot().getDomainConfig() : domainConfig;
58     }
59     
60     public static J2EEDomain getJ2EEDomain() {
61         return j2eeDomain == null ? getDomainRoot().getJ2EEDomain() : j2eeDomain;
62     }
63     
64     public static MonitoringRoot getMonitoringRoot() {
65         return monitoringRoot == null ? getDomainRoot().getMonitoringRoot() : monitoringRoot;
66     }
67    
68     public static DomainRoot getDomainRoot() {
69         return domainRoot == null ? getAMXProxyFactory().getDomainRoot() : domainRoot;
70     }
71     
72     public static QueryMgr getQueryMgr() {
73         return queryMgr == null ? getDomainRoot().getQueryMgr() : queryMgr;
74     }
75     
76     public static UploadDownloadMgr getUploadDownloadMgr() {
77         return uploadDownloadMgr == null ? getDomainRoot().getUploadDownloadMgr() : uploadDownloadMgr;
78     }
79    
80     public static ProxyFactory getAMXProxyFactory() {
81         return amxProxyFactory == null ?
82         ProxyFactory.getInstance(MBeanUtil.getMBeanServer()) : amxProxyFactory;
83     }
84
85 }
86
Popular Tags