KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > event > WebConfigChangeEventListener


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  * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
26  *
27  * Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc.,
28  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
29  * All rights reserved.
30  */

31 package com.sun.enterprise.admin.event;
32
33 import com.sun.enterprise.config.serverbeans.ServerTags;
34 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
35
36 /**
37  * Listener for config changes handled by web core. Web core handles changes
38  * to http-service and web-container elements of server.xml without restart.
39  * This class allows Java notification framework to determine that all such
40  * changes are handled dynamically.
41  */

42 public class WebConfigChangeEventListener implements ConfigChangeEventListener {
43
44     /**
45      * Useful constant to denote one or more match in a regular expression
46      */

47     private static final String JavaDoc ONE_OR_MORE = ServerXPathHelper.REGEX_ONE_PLUS;
48
49     /**
50      * Regular expression for server.xml xpaths dynamically handled by web core
51      * -- <code>/{1,}server/{1,}(http-service|web-container).*</code>
52      */

53     public static final String JavaDoc CATEGORY_REGEX =
54             ServerXPathHelper.REGEX_XPATH_CONFIG
55             + ServerXPathHelper.XPATH_SEPARATOR + ONE_OR_MORE
56             + "(" + ServerTags.HTTP_SERVICE + "|" + ServerTags.WEB_CONTAINER
57             + ").*";
58
59     /**
60      * Config change category handled by this listener.
61      */

62     private ConfigChangeCategory category = new ConfigChangeCategory("webcore",
63             CATEGORY_REGEX);
64
65     /**
66      * Handle config changes. If init.conf or obj.conf has changed for the
67      * instance then set the status of "Restart Required".
68      */

69     public void configChanged(ConfigChangeEvent configChangeEvent)
70             throws AdminEventListenerException {
71         if (configChangeEvent.isInitOrObjConfChanged()) {
72             AdminEventMulticaster.notifyFailure(configChangeEvent,
73                     AdminEventResult.RESTART_NEEDED);
74         }
75     }
76
77     /**
78      * Get category handled by this listener. Used while registering the
79      * event listener.
80      */

81     public ConfigChangeCategory getConfigChangeCategory() {
82         return category;
83     }
84 }
85
Popular Tags