KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.sun.appserv.management.base.Util;
26
27 import com.sun.appserv.management.config.ResourceConfig;
28 import com.sun.appserv.management.config.StandaloneServerConfig;
29
30 import com.sun.appserv.management.util.misc.ExceptionUtil;
31
32 import com.sun.enterprise.management.AMXTestBase;
33
34 /**
35  */

36 public abstract class ResourceConfigTestBase extends ConfigMgrTestBase
37 {
38         protected
39     ResourceConfigTestBase()
40     {
41         super();
42         
43         StandaloneServerConfigTest.ensureDefaultInstance( getDomainRoot() );
44     }
45     
46         protected void
47     addReference( final ResourceConfig rc )
48     {
49         final StandaloneServerConfig server =
50             StandaloneServerConfigTest.ensureDefaultInstance( getDomainRoot() );
51         assert server != null;
52         
53         if ( server.getResourceRefConfigMap().get( rc.getName() ) != null )
54         {
55             warning( "ResourceRefConfig already exists for: " + rc.getName() );
56         }
57         else
58         {
59             try
60             {
61                 server.createResourceRefConfig( rc.getName(), false );
62             }
63             catch( Exception JavaDoc e )
64             {
65                 final Throwable JavaDoc rootCause = ExceptionUtil.getRootCause( e );
66                 
67                 warning( "Couldn't add RefConfig to: " + Util.getObjectName( rc ) );
68             }
69         }
70         
71         assert server.getResourceRefConfigMap().get( rc.getName() ) != null;
72     }
73     
74
75 }
76
77
78
Popular Tags