KickJava   Java API By Example, From Geeks To Geeks.

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


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/tests/com/sun/enterprise/management/config/AuditModuleConfigTest.java,v 1.5 2006/03/09 20:30:52 llc Exp $
26  * $Revision: 1.5 $
27  * $Date: 2006/03/09 20:30:52 $
28  */

29 package com.sun.enterprise.management.config;
30
31 import java.util.Map JavaDoc;
32
33 import com.sun.appserv.management.base.Container;
34 import com.sun.appserv.management.base.XTypes;
35
36 import com.sun.appserv.management.config.AMXConfig;
37 import com.sun.appserv.management.config.AuditModuleConfig;
38 import com.sun.appserv.management.config.SecurityServiceConfig;
39
40
41 /**
42  */

43 public final class AuditModuleConfigTest extends ConfigMgrTestBase
44 {
45     static final String JavaDoc CLASSNAME = "com.sun.enterprise.security.Audit";
46     
47         public
48     AuditModuleConfigTest()
49     {
50         if ( checkNotOffline( "ensureDefaultInstance" ) )
51         {
52             ensureDefaultInstance( getConfigConfig().getSecurityServiceConfig() );
53         }
54     }
55     
56     
57         public static String JavaDoc
58     getDefaultInstanceName()
59     {
60         return getDefaultInstanceName( "AuditModuleConfig" );
61     }
62     
63     
64         public static AuditModuleConfig
65     ensureDefaultInstance( final SecurityServiceConfig securityServiceConfig )
66     {
67         AuditModuleConfig result =
68             securityServiceConfig.getAuditModuleConfigMap().get( getDefaultInstanceName() );
69         
70         if ( result == null )
71         {
72             result = createInstance( securityServiceConfig,
73                 getDefaultInstanceName(), CLASSNAME, false, null );
74         }
75         
76         return result;
77     }
78     
79         public static AuditModuleConfig
80     createInstance(
81         final SecurityServiceConfig securityServiceConfig,
82         final String JavaDoc name,
83         final String JavaDoc classname,
84         final boolean enabled,
85         final Map JavaDoc<String JavaDoc,String JavaDoc> optional )
86     {
87         return securityServiceConfig.createAuditModuleConfig(
88                 name, CLASSNAME, enabled, null );
89     }
90     
91     
92     
93         protected Container
94     getProgenyContainer()
95     {
96         return getConfigConfig().getSecurityServiceConfig();
97     }
98
99         protected String JavaDoc
100     getProgenyJ2EEType()
101     {
102         return XTypes.AUDIT_MODULE_CONFIG;
103     }
104
105
106         protected void
107     removeProgeny( final String JavaDoc name )
108     {
109         getConfigConfig().getSecurityServiceConfig().removeAuditModuleConfig( name );
110     }
111     
112         protected final AMXConfig
113     createProgeny( final String JavaDoc name, final Map JavaDoc<String JavaDoc,String JavaDoc> options )
114     {
115         return getConfigConfig().getSecurityServiceConfig().createAuditModuleConfig(name, CLASSNAME, false, options);
116     }
117 }
118
119
120
Popular Tags