KickJava   Java API By Example, From Geeks To Geeks.

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


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

29 package com.sun.enterprise.management.config;
30
31 import java.util.Map JavaDoc;
32 import java.util.Properties JavaDoc;
33
34 import javax.management.ObjectName JavaDoc;
35
36 import javax.management.Attribute JavaDoc;
37 import javax.management.AttributeList JavaDoc;
38
39 import com.sun.appserv.management.base.XTypes;
40 import com.sun.appserv.management.base.Util;
41 import com.sun.appserv.management.util.jmx.JMXUtil;
42 import com.sun.appserv.management.config.PropertiesAccess;
43
44 import com.sun.enterprise.management.support.oldconfig.OldSecurityServiceMBean;
45
46 /**
47  */

48 public final class AuditModuleConfigFactory extends ConfigFactory
49 {
50     private static final String JavaDoc AUDIT_ON_PROPERTY_KEY =
51         PropertiesAccess.PROPERTY_PREFIX + "auditOn";
52         
53     private static final String JavaDoc CLASSNAME_KEY = "Classname";
54
55     private final OldSecurityServiceMBean mOldSecurityServiceMBean;
56     
57
58         public
59     AuditModuleConfigFactory( final ConfigFactoryCallback callbacks )
60     {
61         super( callbacks );
62         
63         mOldSecurityServiceMBean =
64             getOldConfigProxies().getOldSecurityServiceMBean( getConfigName() );
65     }
66     
67         public ObjectName JavaDoc
68     create( String JavaDoc name, String JavaDoc className, boolean auditOn,
69         Map JavaDoc<String JavaDoc,String JavaDoc> reservedForFutureUse )
70     {
71         final String JavaDoc[] requiredParams = {
72             CLASSNAME_KEY, className,
73             AUDIT_ON_PROPERTY_KEY, Boolean.toString(auditOn),
74         };
75
76         final Map JavaDoc<String JavaDoc,String JavaDoc> params = initParams( name, requiredParams, reservedForFutureUse );
77
78         final ObjectName JavaDoc amxName = createNamedChild( name, params );
79
80         return amxName;
81     }
82
83     
84         protected void
85     internalRemove( final ObjectName JavaDoc objectName )
86     {
87         final String JavaDoc name = Util.getName( objectName );
88         
89         mOldSecurityServiceMBean.removeAuditModuleByName(name);
90     }
91
92         protected ObjectName JavaDoc
93     createOldChildConfig( final AttributeList JavaDoc translatedAttrs )
94     {
95         return mOldSecurityServiceMBean.createAuditModule( translatedAttrs );
96     }
97 }
98
99
100
101
102
Popular Tags