KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > support > NonDASLoader


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 package com.sun.enterprise.management.support;
24
25 import java.util.logging.Level JavaDoc;
26
27 import javax.management.ObjectName JavaDoc;
28
29 import com.sun.appserv.management.base.Util;
30 import com.sun.appserv.management.base.XTypes;
31
32 import com.sun.appserv.management.util.misc.ExceptionUtil;
33 import com.sun.appserv.management.util.jmx.JMXUtil;
34
35
36 import com.sun.enterprise.management.monitor.CallFlowMonitorImpl;
37
38 /**
39     Implements loading of all MBean API MBeans in non-DAS instances.
40  */

41 public final class NonDASLoader extends LoaderBase
42     implements NonDASLoaderMBean
43 {
44         public
45     NonDASLoader()
46     {
47         debug( "NonDASLoader" );
48     }
49     
50     /**
51         @Override
52      */

53         protected void
54     startHook()
55     {
56         debug( "startHook" );
57     }
58     
59     /**
60         @Override
61      */

62         protected Object JavaDoc
63     createDomainRoot()
64     {
65         debug( "createDomainRoot" );
66         return null;
67     }
68     
69     
70     /**
71         @Override
72      */

73         public boolean
74     isDAS()
75     {
76         return false;
77     }
78     
79         private void
80     loadCallFlowMonitor()
81     {
82         try
83         {
84             final CallFlowMonitorImpl callFlow = new CallFlowMonitorImpl();
85             
86             final String JavaDoc serverName = BootUtil.getInstance().getServerName();
87             String JavaDoc props = Util.makeRequiredProps( XTypes.CALL_FLOW_MONITOR, serverName );
88             props = Util.concatenateProps( props,
89                         Util.makeProp( XTypes.SERVER_ROOT_MONITOR, serverName ) );
90             
91             final ObjectName JavaDoc proposedName = Util.newObjectName(
92                                 BootUtil.getInstance().getAMXJMXDomainName(), props );
93                                 
94             final ObjectName JavaDoc objectName =
95                 getMBeanServer().registerMBean( callFlow, proposedName ).getObjectName();
96             debug( "Loaded CallFlowMonitor as " + JMXUtil.toString( objectName ) );
97             
98         }
99         catch( Exception JavaDoc e )
100         {
101             final Throwable JavaDoc rootCause = ExceptionUtil.getRootCause(e);
102             final String JavaDoc msg = "Exception creating/loading CallFlowMonitor: " +
103                  rootCause + ", msg=" + rootCause.getMessage();
104             debug( msg );
105             getMBeanLogger().log( Level.WARNING, msg, rootCause );
106         }
107     }
108     
109         private void
110     loadSpecialtyMBeans()
111     {
112         debug( "loadSpecialtyMBeans" );
113         loadCallFlowMonitor();
114     }
115     
116     /**
117         @Override
118      */

119         public void
120     adminServiceReady()
121     {
122         debug( "adminServiceReady" );
123         loadSpecialtyMBeans();
124     }
125     
126 }
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Popular Tags