KickJava   Java API By Example, From Geeks To Geeks.

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


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.config;
24
25 import java.util.Map JavaDoc;
26 import java.util.Properties JavaDoc;
27
28 import javax.management.ObjectName JavaDoc;
29 import javax.management.AttributeList JavaDoc;
30
31 import com.sun.appserv.management.base.XTypes;
32 import com.sun.appserv.management.base.AMX;
33 import static com.sun.appserv.management.config.ManagementRulesConfig.*;
34
35 import com.sun.enterprise.management.support.oldconfig.OldManagementRules;
36
37
38 /**
39  */

40 public final class ManagementRuleConfigFactory extends ConfigFactory
41 {
42         public
43     ManagementRuleConfigFactory( final ConfigFactoryCallback callbacks )
44     {
45         super( callbacks );
46     }
47     
48         private OldManagementRules
49     getOldManagementRules()
50     {
51         return getOldConfigProxies().getOldManagementRules( getConfigName() );
52     }
53
54         public ObjectName JavaDoc
55     create(
56         String JavaDoc ruleName,
57         String JavaDoc eventType,
58         String JavaDoc actionMBeanName,
59         Map JavaDoc<String JavaDoc,String JavaDoc> optional
60     )
61     {
62         final String JavaDoc ruleDescription = getString( optional, RULE_DESCRIPTION_KEY );
63         final Boolean JavaDoc ruleEnabled = getBoolean( optional, RULE_ENABLED_KEY, Boolean.FALSE );
64         final String JavaDoc eventLevel = getString( optional, EVENT_LEVEL_KEY );
65         final String JavaDoc eventDescription = getString( optional, EVENT_DESCRIPTION_KEY );
66         final Boolean JavaDoc eventLogging = getBoolean( optional, EVENT_LOG_ENABLED_KEY, Boolean.FALSE );
67         final Properties JavaDoc eventProperties = (Properties JavaDoc)getValue( optional, EVENT_PROPERTIES_KEY );
68         
69         final ObjectName JavaDoc oldObjectName = getOldManagementRules().createManagementRule(
70                 ruleName,
71                 ruleEnabled,
72                 ruleDescription,
73                 eventType,
74                 eventLevel,
75                 eventLogging,
76                 eventDescription,
77                 eventProperties,
78                 actionMBeanName );
79         
80         return finish( oldObjectName, null );
81     };
82
83         protected void
84     removeByName( final String JavaDoc name )
85     {
86         getOldManagementRules().removeManagementRuleByName( name );
87     }
88 }
89
90
91
92
93
Popular Tags