KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > ManualChangeManager


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 package com.sun.enterprise.admin.server.core;
25
26 import java.util.logging.Level JavaDoc;
27 import java.util.logging.Logger JavaDoc;
28
29 import com.sun.enterprise.admin.common.constant.AdminConstants;
30
31 import java.util.Hashtable JavaDoc;
32
33 /**
34     This class holds results for all instances in this admin server.
35     The APIs in this class mirror ones in InstanceEnvironment.
36     InstanceEnvironment actually checks timestamps, etc whereas this file
37     gets it from cache and is significantly faster.
38     @author Sridatta
39     @version 1.1
40 */

41
42 public final class ManualChangeManager {
43     /**
44      * Logger for admin service
45      */

46     static Logger JavaDoc logger = Logger.getLogger(AdminConstants.kLoggerName);
47     
48     private static Hashtable JavaDoc result = new Hashtable JavaDoc();
49             
50     public static boolean hasHotChanged(String JavaDoc instance) {
51          ManualChangeStatus mcs = (ManualChangeStatus)result.get(instance);
52         if(mcs == null) return false; // not calculated yet. so return false
53

54         return mcs.isChanged();
55     }
56
57     private static boolean hasHotInitChanged(String JavaDoc instanceName) {
58         ManualChangeStatus mcs = getManualChangeStatus(instanceName);
59         if(mcs == null) return false;
60         return mcs.isInitFileChanged();
61     }
62     
63     private static boolean hasHotRealmsKeyChanged(String JavaDoc instanceName) {
64          ManualChangeStatus mcs = getManualChangeStatus(instanceName);
65         if(mcs == null) return false;
66         return mcs.isRealmsKeyFileChanged();
67     }
68
69     private static boolean hasHotObjectChanged(String JavaDoc instanceName) {
70         ManualChangeStatus mcs = getManualChangeStatus(instanceName);
71         if(mcs == null) return false;
72         return mcs.isObjectFileChanged();
73     }
74     
75     public static boolean hasHotXmlChanged(String JavaDoc instanceName) {
76        ManualChangeStatus mcs = getManualChangeStatus(instanceName);
77         if(mcs == null) return false;
78         return mcs.isServerXmlFileChanged();
79     }
80     
81     private static boolean hasHotMimeChanged(String JavaDoc instanceName) {
82         ManualChangeStatus mcs = getManualChangeStatus(instanceName);
83         if(mcs == null) return false;
84         return mcs.isMimeFileChanged();
85     }
86     
87     private static boolean hasHotVirtualServerConfFilesChanged(String JavaDoc instanceName) {
88         ManualChangeStatus mcs = getManualChangeStatus(instanceName);
89         if(mcs == null) return false;
90         return mcs.isVirtualServerConfFilesChanged();
91     }
92
93     public static ManualChangeStatus getManualChangeStatus(String JavaDoc instance) {
94         return (ManualChangeStatus) result.get(instance);
95     }
96     
97     public static void removeManualChangeStatus(String JavaDoc instance) {
98         result.remove(instance);
99     }
100     
101     public static void removeServerXmlManualChangeStatus(String JavaDoc instance) {
102         ManualChangeStatus m = getManualChangeStatus(instance);
103         if(m != null) {
104             m.setServerXmlFileChanged(false);
105         }
106     }
107     
108     public static void addManualChangeStatus(String JavaDoc instance, ManualChangeStatus mcs) {
109         result.put(instance, mcs);
110     }
111 }
112
Popular Tags