KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > admingui > ConfigProperties


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  * ConfigProperties.java
26  *
27  * Created on January 13, 2004, 12:05 PM
28  */

29
30 package com.sun.enterprise.tools.admingui;
31
32 import java.util.Hashtable JavaDoc;
33 import java.util.ResourceBundle JavaDoc;
34 import java.lang.reflect.Method JavaDoc;
35
36 public class ConfigProperties extends Hashtable JavaDoc{
37     
38     public static ConfigProperties getInstance() {
39         return _instance;
40     }
41     
42     public void setViewXMLFileName(String JavaDoc viewXMLFile) {
43         put(VIEW_XML_FILE, viewXMLFile);
44     }
45     
46     public void setTreeXMLFileName(String JavaDoc treeXMLFile, String JavaDoc treeType) {
47         put(TREE_XML_FILE+treeType, treeXMLFile);
48     }
49     
50     public String JavaDoc getViewXMLFileName() {
51         return (String JavaDoc)(get(VIEW_XML_FILE));
52     }
53     
54     public String JavaDoc getTreeXMLFileName(String JavaDoc treeType) {
55         return (String JavaDoc)(get(TREE_XML_FILE+treeType));
56     }
57
58     public void setDefaultDisplayURLDir(String JavaDoc defaultDisplayURLDir) {
59         put(DEFAULT_DISPLAY_URL_DIR, defaultDisplayURLDir);
60     }
61     
62     public String JavaDoc getDefaultDisplayURLDir() {
63         return (String JavaDoc)(get(DEFAULT_DISPLAY_URL_DIR));
64     }
65     
66     public void setLoggerName(String JavaDoc loggerName) {
67         put(LOGGER_NAME, loggerName);
68     }
69     
70     public String JavaDoc getLoggerName() {
71         return (String JavaDoc)(get(LOGGER_NAME));
72     }
73     
74     public void setInitialRightPage(String JavaDoc page) {
75         put(INITIAL_RIGHT_PAGE, page);
76     }
77     
78     public String JavaDoc getInitialRightPage() {
79         return (String JavaDoc)(get(INITIAL_RIGHT_PAGE));
80     }
81     
82     public void setConsoleTitleKey(String JavaDoc consoleTitleKey) {
83         put(CONSOLE_TITLE_KEY, consoleTitleKey);
84     }
85     
86     public String JavaDoc getConsoleTitleKey() {
87         return (String JavaDoc)(get(CONSOLE_TITLE_KEY));
88     }
89     
90     public String JavaDoc getConsoleTitle() {
91         ResourceBundle JavaDoc bundle =
92             ResourceBundle.getBundle("com.sun.enterprise.tools.admingui.resources.Resources");
93         try {
94             return bundle.getString((String JavaDoc)get(CONSOLE_TITLE_KEY));
95         } catch (Exception JavaDoc ex) {
96             return (String JavaDoc)get(CONSOLE_TITLE_KEY);
97         }
98     }
99     
100     public void setTargetSupported(Boolean JavaDoc targetSupported) {
101         put(TARGET_SUPPORTED, targetSupported);
102     }
103     
104     public Boolean JavaDoc getTargetSupported() {
105         return (Boolean JavaDoc)(get(TARGET_SUPPORTED));
106     }
107     
108     public String JavaDoc getDefaultTarget() {
109         return (String JavaDoc)(get(DEFAULT_TARGET));
110     }
111     
112     public void setDefaultTarget(String JavaDoc defaultTarget) {
113         put(DEFAULT_TARGET, defaultTarget);
114     }
115     
116     static public boolean isHCIAdmin22() {
117     try {
118             Class JavaDoc clazz = Class.forName("com.sun.web.ui.common.CCSystem");
119         Method JavaDoc method = clazz.getMethod("getServerInterface", (Class JavaDoc[])null);
120             if (method == null)
121                 return false;
122     } catch (Exception JavaDoc e) {
123         return false;
124     }
125         return true;
126     }
127
128     private static ConfigProperties _instance = new ConfigProperties();
129     
130     private static final String JavaDoc VIEW_XML_FILE = "ViewXMLFile";
131     private static final String JavaDoc TREE_XML_FILE = "TreeXMLFile";
132     private static final String JavaDoc DEFAULT_DISPLAY_URL_DIR = "DefaultDisplayURLDir";
133     private static final String JavaDoc LOGGER_NAME = "LoggerName";
134     private static final String JavaDoc INITIAL_RIGHT_PAGE = "InitialRightPage";
135     private static final String JavaDoc TARGET_SUPPORTED = "Target";
136     private static final String JavaDoc CONSOLE_TITLE_KEY = "ConsoleTitleKey";
137     private static final String JavaDoc DEFAULT_TARGET = "DefaultTarget";
138     
139 }
140
Popular Tags