KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > ClusterConfigImpl


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  * $Header: /cvs/glassfish/admin/mbeanapi-impl/src/java/com/sun/enterprise/management/config/ClusterConfigImpl.java,v 1.13 2006/03/17 03:34:15 llc Exp $
26  * $Revision: 1.13 $
27  * $Date: 2006/03/17 03:34:15 $
28  */

29
30
31 package com.sun.enterprise.management.config;
32
33 import java.util.Set JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.HashMap JavaDoc;
36 import java.util.Iterator JavaDoc;
37 import java.util.Collections JavaDoc;
38
39 import javax.management.ObjectName JavaDoc;
40 import com.sun.enterprise.management.config.AMXConfigImplBase;
41 import com.sun.enterprise.management.support.Delegate;
42     
43 import com.sun.appserv.management.config.ClusterConfig;
44 import com.sun.appserv.management.base.XTypes;
45 import com.sun.appserv.management.base.Util;
46
47 import com.sun.enterprise.management.support.AMXAttributeNameMapper;
48
49 /**
50     Configuration for the <cluster> element.
51  */

52 public final class ClusterConfigImpl extends AMXConfigImplBase
53     // implements ClusterConfig
54
implements ConfigFactoryCallback
55 {
56         public
57     ClusterConfigImpl( final Delegate delegate )
58     {
59         super( delegate );
60     }
61     
62         private ClusterConfig
63     self()
64     {
65         return (ClusterConfig)getSelf();
66     }
67     
68         protected void
69     addCustomMappings( final AMXAttributeNameMapper mapper )
70     {
71         super.addCustomMappings( mapper );
72         mapper.matchName( "ReferencedConfigName", "config-ref" );
73     }
74     
75     
76                 
77         public Map JavaDoc<String JavaDoc,ObjectName JavaDoc>
78     getClusteredServerConfigObjectNameMap()
79     {
80         final Map JavaDoc<String JavaDoc,ObjectName JavaDoc> serverRefConfigMap =
81             Util.toObjectNames( self().getServerRefConfigMap() );
82         if ( serverRefConfigMap.isEmpty() )
83         {
84             return new HashMap JavaDoc<String JavaDoc,ObjectName JavaDoc>();
85         }
86         
87         final Set JavaDoc<ObjectName JavaDoc> allClusteredServerConfigObjectNames =
88             getQueryMgr().queryJ2EETypeObjectNameSet( XTypes.CLUSTERED_SERVER_CONFIG );
89         final Map JavaDoc<String JavaDoc,ObjectName JavaDoc> objectNameMap =
90             Util.createObjectNameMap( allClusteredServerConfigObjectNames );
91
92         final Map JavaDoc<String JavaDoc,ObjectName JavaDoc> clusteredServerConfigObjectNameMap =
93             new HashMap JavaDoc<String JavaDoc,ObjectName JavaDoc>( allClusteredServerConfigObjectNames.size() );
94
95         for( final String JavaDoc key : serverRefConfigMap.keySet() )
96         {
97             clusteredServerConfigObjectNameMap.put( key, objectNameMap.get( key ) );
98         }
99         return clusteredServerConfigObjectNameMap;
100     }
101     
102     
103 }
104
105
106
107
Popular Tags