KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > event > pluggable > PERestartEventHelper


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.admin.event.pluggable;
24
25 import com.sun.logging.LogDomains;
26 import java.util.Set JavaDoc;
27 import java.util.HashSet JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.ArrayList JavaDoc;
30 import java.util.logging.Level JavaDoc;
31 import java.util.logging.Logger JavaDoc;
32
33 import com.sun.enterprise.admin.event.RRPersistenceHelper;
34 import com.sun.enterprise.config.ConfigContext;
35 import com.sun.enterprise.server.ApplicationServer;
36 import com.sun.enterprise.server.ServerContext;
37 import com.sun.enterprise.admin.server.core.AdminService;
38 import com.sun.enterprise.admin.event.ElementChangeHelper;
39
40
41 //i18n import
42
import com.sun.enterprise.util.i18n.StringManager;
43
44 /**
45  * Restart event Helper - class providing support for informing
46  * server(s) to set its(their) restart required state to true or false.
47  *
48  * @author: Satish Viswanatham
49  */

50 public class PERestartEventHelper implements RestartEventHelper{
51
52     // i18n StringManager
53
private static Logger JavaDoc _logger = null;
54     
55     public PERestartEventHelper() {
56     }
57
58     /**
59      * Given a config change list, this method figures out if that list contains
60      * any non dynamic recofigurable changes. If there is any change which can
61      * not be applied dynamically, if sets the restart status on the appropriate
62      * target servers.
63      *
64      * @param ctx Config context of DAS
65      * @param list config change list
66      */

67     public void setRestartRequiredForTarget(ConfigContext ctx,
68             ArrayList JavaDoc configChangeList ) {
69    
70         try {
71             AdminService admServ = AdminService.getAdminService();
72
73             if ((admServ != null) && (admServ.isDas())) {
74                 Set JavaDoc nonDynSet = ElementChangeHelper.
75                     getXPathesForDynamicallyNotReconfigurableElements(
76                     configChangeList);
77
78                 Set JavaDoc targetSet = new HashSet JavaDoc();
79                 Iterator JavaDoc iter = nonDynSet.iterator();
80
81                 if (iter.hasNext()) {
82                     RRPersistenceHelper rrHelper = new RRPersistenceHelper();
83                     rrHelper.setRestartRequired(true);
84                 }
85             }
86         } catch (Throwable JavaDoc t) {
87             getLogger().log(Level.INFO, "event.exception_during_restart_reset",
88                         t);
89         }
90
91     }
92
93     private static Logger JavaDoc getLogger() {
94         if (_logger == null) {
95             _logger = Logger.getLogger(LogDomains.ADMIN_LOGGER);
96         }
97         return _logger;
98     }
99
100 }
101
Popular Tags