KickJava   Java API By Example, From Geeks To Geeks.

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


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  */

26
27 package com.sun.enterprise.management.config;
28
29 import java.util.Map JavaDoc;
30
31 import javax.management.ObjectName JavaDoc;
32
33 import com.sun.appserv.management.base.XTypes;
34
35 import com.sun.enterprise.management.config.AMXConfigImplBase;
36 import com.sun.enterprise.management.support.Delegate;
37 import com.sun.appserv.management.config.LBConfig;
38 import com.sun.appserv.management.base.Util;
39
40
41 /**
42     Configuration for the <lb-config> element.
43 */

44 public final class LBConfigImpl extends AMXConfigImplBase
45         implements ConfigFactoryCallback {
46     
47     public LBConfigImpl(final Delegate delegate) {
48         super(delegate);
49     }
50         
51     public Map JavaDoc<String JavaDoc,ObjectName JavaDoc> getClusterRefConfigObjectNameMap() {
52         return(getContaineeObjectNameMap(XTypes.CLUSTER_REF_CONFIG));
53     }
54
55     public Map JavaDoc<String JavaDoc,ObjectName JavaDoc> getServerRefConfigObjectNameMap() {
56         return(getContaineeObjectNameMap(XTypes.SERVER_REF_CONFIG));
57     }
58
59     private ClusterRefConfigFactory getClusterRefConfigFactory() {
60         return new ClusterRefConfigFactory(this);
61     }
62
63     public ObjectName JavaDoc createClusterRefConfig(String JavaDoc referencedClusterName,
64         String JavaDoc lbPolicy, String JavaDoc lbPolicyModule) {
65
66         return getClusterRefConfigFactory().create(referencedClusterName,
67         lbPolicy, lbPolicyModule);
68     }
69
70     public void removeClusterRefConfig( final String JavaDoc name) {
71         final Map JavaDoc<String JavaDoc,ObjectName JavaDoc> items = getClusterRefConfigObjectNameMap();
72         getClusterRefConfigFactory().remove(Util.getObjectName(items, name));
73     }
74
75     private ServerRefConfigFactory getServerRefConfigFactory() {
76         return new ServerRefConfigFactory(this);
77     }
78
79     public ObjectName JavaDoc createServerRefConfig(final String JavaDoc referencedServerName,
80         final Map JavaDoc<String JavaDoc,String JavaDoc> optional) {
81
82         return getServerRefConfigFactory().create(referencedServerName, optional);
83     }
84
85     public ObjectName JavaDoc createServerRefConfig(final String JavaDoc referencedServerName,
86         final String JavaDoc disableTimeoutInMinutes, final boolean lbEnabled,
87         final boolean enabled) {
88
89         return getServerRefConfigFactory().create(referencedServerName,
90         disableTimeoutInMinutes, lbEnabled, enabled);
91     }
92
93     public void removeServerRefConfig( final String JavaDoc name) {
94         final Map JavaDoc<String JavaDoc,ObjectName JavaDoc> items = getServerRefConfigObjectNameMap();
95         getServerRefConfigFactory().remove(Util.getObjectName(items, name));
96     }
97 }
Popular Tags