KickJava   Java API By Example, From Geeks To Geeks.

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


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/LoadBalancerConfigFactory.java,v 1.5 2006/03/09 20:30:39 llc Exp $
26  * $Revision: 1.5 $
27  * $Date: 2006/03/09 20:30:39 $
28  */

29 package com.sun.enterprise.management.config;
30
31 import java.util.Set JavaDoc;
32 import java.util.HashSet JavaDoc;
33 import java.util.Iterator JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.HashMap JavaDoc;
36 import java.util.Properties JavaDoc;
37 import java.util.Collections JavaDoc;
38
39 import javax.management.AttributeList JavaDoc;
40 import javax.management.ObjectName JavaDoc;
41
42 import com.sun.appserv.management.util.misc.GSetUtil;
43 import com.sun.appserv.management.config.LoadBalancerConfigKeys;
44
45 final class LoadBalancerConfigFactory extends ConfigFactory {
46
47     public LoadBalancerConfigFactory(final ConfigFactoryCallback callbacks) {
48         super(callbacks);
49     }
50
51     private final Set JavaDoc<String JavaDoc> LEGAL_OPTIONAL_KEYS =
52         GSetUtil.newUnmodifiableStringSet(
53             LoadBalancerConfigKeys.NAME,
54             LoadBalancerConfigKeys.LB_CONFIG_NAME,
55             LoadBalancerConfigKeys.AUTO_APPLY_ENABLED );
56
57     protected Set JavaDoc<String JavaDoc> getLegalOptionalCreateKeys() {
58         return LEGAL_OPTIONAL_KEYS;
59     }
60
61     public ObjectName JavaDoc create(String JavaDoc name, String JavaDoc lbConfigName,
62         boolean autoApplyEnabled, Map JavaDoc<String JavaDoc,String JavaDoc> optional) {
63         final String JavaDoc[] required =
64             new String JavaDoc[] {"lb-config-name", lbConfigName, "auto-apply-enabled", "" + autoApplyEnabled };
65         final Map JavaDoc<String JavaDoc,String JavaDoc> params = initParams(name, required, optional);
66         final ObjectName JavaDoc amxName = createNamedChild(name, params);
67         return amxName;
68     }
69
70     protected ObjectName JavaDoc createOldChildConfig(final AttributeList JavaDoc translatedAttrs) {
71         return getOldConfigProxies().getOldLoadBalancers().createLoadBalancer(translatedAttrs);
72     }
73     
74     public void removeByName(String JavaDoc name) {
75         getOldConfigProxies().getOldLoadBalancers().removeLoadBalancerByName(name);
76     }
77 }
78
79
80
81
82
83
Popular Tags