KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > setup > comptest > CmsSetupTestResult


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/setup/comptest/CmsSetupTestResult.java,v $
3  * Date : $Date: 2006/03/27 14:52:42 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.setup.comptest;
33
34
35
36 /**
37  * Contains info about the result of a setup test.<p>
38  *
39  * @author Thomas Weckert
40  *
41  * @version $Revision: 1.2 $
42  *
43  * @since 6.0.0
44  */

45 public class CmsSetupTestResult extends Object JavaDoc implements Cloneable JavaDoc {
46
47     /** Test passed flag. */
48     private boolean m_green;
49
50     /** A string offering some help in case a test failed.<p> */
51     private String JavaDoc m_help;
52
53     /** A info string for the test result.<p> */
54     private String JavaDoc m_info;
55
56     /** The clear text name of the test.<p> */
57     private String JavaDoc m_name;
58
59     /** Test failed flag. */
60     private boolean m_red;
61
62     /** A string describing the result of the test.<p> */
63     private String JavaDoc m_result;
64     
65     /** Test warning flag. */
66     private boolean m_yellow;
67
68     /**
69      * Creates a new setup test result.<p>
70      *
71      * @param test the test to keep track of
72      */

73     public CmsSetupTestResult(I_CmsSetupTest test) {
74
75         super();
76
77         setGreen();
78         setName(test.getName());
79         setInfo("");
80         setResult("");
81         setHelp("");
82     }
83
84     /**
85      * Returns the help string what to do if a test failed.<p>
86      * This string will be displayed in a help bubble.<p>
87      *
88      * @return the help string what to do if a test failed
89      */

90     public String JavaDoc getHelp() {
91
92         return m_help;
93     }
94
95     /**
96      * Returns the description of the test, e.g. "Test xy failed due to...".<p>
97      *
98      * @return the description of the test
99      */

100     public String JavaDoc getInfo() {
101
102         return m_info;
103     }
104
105     /**
106      * Returns the name of the test, e.g. "Operating system test".<p>
107      *
108      * @return the name of the test
109      */

110     public String JavaDoc getName() {
111
112         return m_name;
113     }
114
115     /**
116      * Returns the result of the test, e.g. "Detected Apache Tomcat/4.1.24...".<p>
117      *
118      * @return the result of the test
119      */

120     public String JavaDoc getResult() {
121
122         return m_result;
123     }
124
125     /**
126      * Returns true, if the conditions the test were fulfilled.<p>
127      *
128      * @return true, if the conditions the test were fulfilled
129      */

130     public boolean isGreen() {
131
132         return m_green;
133     }
134
135     /**
136      * Returns true if the test found a violated condition.
137      * It is assumed that it will be impossible to run OpenCms.<p>
138      *
139      * @return true if the test found a violated a condition
140      */

141     public boolean isRed() {
142
143         return m_red;
144     }
145
146     /**
147      * Returns true if the test found a questionable condition.
148      * It is possible that OpenCms will not run.<p>
149      *
150      * @return true if the test found a questionable condition
151      */

152     public boolean isYellow() {
153
154         return m_yellow;
155     }
156
157     /**
158      * Sets if the conditions in the test were fulfilled.<p>
159      */

160     protected void setGreen() {
161
162         m_green = true;
163         m_red = false;
164         m_yellow = false;
165     }
166
167     /**
168      * Sets the help string what to do if a test failed.<p>
169      * This string will be displayed in a help bubble.<p>
170      *
171      * @param help the help string what to do if a test failed
172      */

173     protected void setHelp(String JavaDoc help) {
174
175         m_help = help;
176     }
177
178     /**
179      * Sets the description of the test, e.g. "Test xy failed due to...".<p>
180      *
181      * @param info the description of the test
182      */

183     protected void setInfo(String JavaDoc info) {
184
185         m_info = info;
186     }
187
188     /**
189      * Sets the name of the test, e.g. "Operating system test".<p>
190      *
191      * @param name the name of the test
192      */

193     protected void setName(String JavaDoc name) {
194
195         m_name = name;
196     }
197
198     /**
199      * Sets if the test found a violated condition.<p>
200      */

201     protected void setRed() {
202
203         m_green = false;
204         m_red = true;
205         m_yellow = false;
206     }
207
208     /**
209      * Sets the result of the test, e.g. "Detected Apache Tomcat/4.1.24...".<p>
210      *
211      * @param result the result of the test
212      */

213     protected void setResult(String JavaDoc result) {
214
215         this.m_result = result;
216     }
217
218     /**
219      * Sets if the test found a questionable condition.<p>
220      */

221     protected void setYellow() {
222
223         m_green = false;
224         m_red = false;
225         m_yellow = true;
226     }
227
228 }
229
Popular Tags