KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > configbeans > BaseConfigBean


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  * EEBaseConfigMBean.java
25  *
26  * Created on September 18, 2003, 11:49 AM
27  */

28
29 package com.sun.enterprise.admin.configbeans;
30
31 import com.sun.enterprise.admin.config.BaseConfigMBean;
32 import com.sun.enterprise.config.ConfigException;
33 import com.sun.enterprise.config.ConfigContext;
34 import com.sun.enterprise.server.ApplicationServer;
35 import com.sun.enterprise.server.ServerContextImpl;
36
37 import com.sun.enterprise.admin.AdminContext;
38 import com.sun.enterprise.admin.server.core.AdminService;
39
40 import javax.management.MBeanException JavaDoc;
41
42 /**
43  *
44  * @author kebbs
45  */

46 public class BaseConfigBean {
47        
48     public static final boolean OVERWRITE = BaseConfigMBean.OVERWRITE;
49     
50     private ConfigContext _configContext;
51     
52     public BaseConfigBean(ConfigContext configContext)
53     {
54         _configContext = configContext;
55     }
56     
57     //FIXTHIS: This needs to be refactored out since it used in a number of places when
58
//we make the decision whether this is the correct approach.
59
/**
60      * Persist config changes to disk. Clear all config changes (so that no notification will be
61      * fired) by the ConfigInterceptor. Overlay the runtime config context with the modified
62      * admin context.
63      */

64     public static void flushAll(ConfigContext ctx) throws ConfigException
65     {
66         ctx.flush(OVERWRITE);
67         ctx.resetConfigChangeList();
68         //((ServerContextImpl)ApplicationServer.getServerContext()).setConfigContext(ctx);
69
}
70     
71     //FIXTHIS: This needs to be refactored out since it used in a number of places when
72
//we make the decision whether this is the correct approach.
73
protected void flushAll() throws ConfigException
74     {
75         flushAll(getConfigContext());
76     }
77     
78     //We must subclass this method, because the base case seems to return a null config context if
79
//the mbean does not have a corresponding xpath (or something). The properties MBean seems
80
//to have this problem.
81
protected ConfigContext getConfigContext()
82     {
83         return _configContext;
84     }
85 }
86
Popular Tags