1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 import java.util.Properties ; 27 28 import javax.management.ObjectName ; 29 import javax.management.AttributeList ; 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 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 55 create( 56 String ruleName, 57 String eventType, 58 String actionMBeanName, 59 Map <String ,String > optional 60 ) 61 { 62 final String ruleDescription = getString( optional, RULE_DESCRIPTION_KEY ); 63 final Boolean ruleEnabled = getBoolean( optional, RULE_ENABLED_KEY, Boolean.FALSE ); 64 final String eventLevel = getString( optional, EVENT_LEVEL_KEY ); 65 final String eventDescription = getString( optional, EVENT_DESCRIPTION_KEY ); 66 final Boolean eventLogging = getBoolean( optional, EVENT_LOG_ENABLED_KEY, Boolean.FALSE ); 67 final Properties eventProperties = (Properties )getValue( optional, EVENT_PROPERTIES_KEY ); 68 69 final ObjectName 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 name ) 85 { 86 getOldManagementRules().removeManagementRuleByName( name ); 87 } 88 } 89 90 91 92 93 | Popular Tags |