KickJava   Java API By Example, From Geeks To Geeks.

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


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
27 import javax.management.ObjectName JavaDoc;
28 import javax.management.AttributeList JavaDoc;
29
30 import com.sun.appserv.management.base.XTypes;
31 import com.sun.appserv.management.base.AMX;
32 import com.sun.appserv.management.base.Util;
33
34 import com.sun.appserv.management.config.ManagementRuleConfig;
35 import com.sun.appserv.management.config.ActionConfig;
36
37 import com.sun.enterprise.management.support.oldconfig.OldManagementRules;
38
39
40 /**
41  */

42 public final class ActionConfigFactory extends ConfigFactory
43 {
44         public
45     ActionConfigFactory( final ConfigFactoryCallback callbacks )
46     {
47         super( callbacks );
48     }
49     
50         private OldManagementRules
51     getOldManagementRules()
52     {
53         return getOldConfigProxies().getOldManagementRules( getConfigName() );
54     }
55
56         public ObjectName JavaDoc
57     create( final String JavaDoc mbeanName )
58     {
59         final ManagementRuleConfig ruleConfig =
60             (ManagementRuleConfig)getFactoryContainer();
61         
62         final String JavaDoc ruleName = ruleConfig.getName();
63         
64         getOldManagementRules().addActionToManagementRule( ruleName, mbeanName );
65         
66         // wait till AMX version makes its appearance
67
ActionConfig actionConfig = null;
68         while ( (actionConfig = ruleConfig.getActionConfig()) == null )
69         {
70             sleepMillis( 10 );
71         }
72         
73         final ObjectName JavaDoc amxObjectName = Util.getObjectName( actionConfig );
74         getCallbacks().sendConfigCreatedNotification( amxObjectName );
75         
76         return amxObjectName;
77     }
78
79         protected void
80     internalRemove(final ObjectName JavaDoc objectName)
81     {
82         throw new RuntimeException JavaDoc( "not supported" );
83     }
84 }
85
86
87
88
89
Popular Tags