KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > offline > OfflineLoader


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 package com.sun.enterprise.management.offline;
26
27 import java.util.logging.Logger JavaDoc;
28 import java.io.File JavaDoc;
29
30 import javax.management.MBeanServer JavaDoc;
31
32 import com.sun.enterprise.management.support.MBeanImplBase;
33 import com.sun.enterprise.management.support.BootUtil;
34
35
36
37 /**
38     Implements loading of all MBean API MBeans.
39  */

40 public final class OfflineLoader extends MBeanImplBase
41     implements OfflineLoaderMBean
42 {
43     
44     private final File JavaDoc mDomainXML;
45     final MBeanServer JavaDoc mServer;
46     final ConfigDelegateFactory mDelegateFactory;
47     private final AMXLoader mAMXLoader;
48     
49         public
50     OfflineLoader(
51         final MBeanServer JavaDoc server,
52         final File JavaDoc domainXML )
53     {
54         mServer = server;
55         mDomainXML = domainXML;
56         
57         final boolean offline = true;
58         BootUtil.init( offline );
59         
60         try
61         {
62             mDelegateFactory = ConfigDelegateFactory.getInstance( mDomainXML );
63             mAMXLoader = new AMXLoader( mServer, mDelegateFactory );
64         }
65         catch( Exception JavaDoc e )
66         {
67             e.printStackTrace();
68             throw new RuntimeException JavaDoc( e );
69         }
70         
71         
72         start();
73     }
74
75     
76         protected String JavaDoc
77     getDebugID( )
78     {
79         return( "OfflineLoader" );
80     }
81     
82         protected void
83     sdebug( Object JavaDoc o )
84     {
85         debug( o );
86         System.out.println( "" + o );
87     }
88     
89         public String JavaDoc
90     getAMXJMXDomainName()
91     {
92         return( BootUtil.getInstance().getAMXJMXDomainName() );
93     }
94     
95         public String JavaDoc
96     getAdministrativeDomainName()
97     {
98         return( BootUtil.getInstance().getAppserverDomainName() );
99     }
100     
101     
102         protected Logger JavaDoc
103     createLogger()
104     {
105         return Logger.getLogger( this.getClass().getName() ) ;
106     }
107     
108         private void
109     start()
110     {
111         try
112         {
113             mAMXLoader.loadAll();
114         }
115         catch( Exception JavaDoc e )
116         {
117             e.printStackTrace();
118             throw new RuntimeException JavaDoc( e );
119         }
120         
121         BootUtil.getInstance().setAMXReady( true );
122     }
123 }
124
125
126
127
128
129
130
131
132
Popular Tags