KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > monitor > CmsMemoryMonitorConfiguration


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/monitor/CmsMemoryMonitorConfiguration.java,v $
3  * Date : $Date: 2005/06/23 11:11:38 $
4  * Version: $Revision: 1.6 $
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.monitor;
33
34 import java.util.ArrayList JavaDoc;
35 import java.util.Collections JavaDoc;
36 import java.util.List JavaDoc;
37
38 /**
39  * Memory Monitor configuration class.<p>
40  *
41  * @author Armen Markarian
42  *
43  * @version $Revision: 1.6 $
44  *
45  * @since 6.0.0
46  */

47 public class CmsMemoryMonitorConfiguration {
48
49     /** The interval to use for sending emails. */
50     private int m_emailInterval;
51
52     /** Receivers for status emails. */
53     private List JavaDoc m_emailReceiver;
54
55     /** Sender for status emails. */
56     private String JavaDoc m_emailSender;
57
58     /** The interval to use for the logging. */
59     private int m_logInterval;
60
61     /** Memory limit that triggers a warning. */
62     private int m_maxUsagePercent;
63
64     /** The interval to use for warnings if status is disabled. */
65     private int m_warningInterval;
66
67     /**
68      * Constructor with default values.<p>
69      */

70     public CmsMemoryMonitorConfiguration() {
71
72         m_emailReceiver = new ArrayList JavaDoc();
73     }
74
75     /**
76      * Sets the emailReceiver.<p>
77      *
78      * @param emailReceiver the emailReceiver to set
79      */

80     public void addEmailReceiver(String JavaDoc emailReceiver) {
81
82         m_emailReceiver.add(emailReceiver);
83     }
84
85     /**
86      * Returns the intervalEmail.<p>
87      *
88      * @return the intervalEmail
89      */

90     public int getEmailInterval() {
91
92         return m_emailInterval;
93     }
94
95     /**
96      * Returns a List of receiver.<p>
97      *
98      * @return a List of receiver
99      */

100     public List JavaDoc getEmailReceiver() {
101
102         Collections.sort(m_emailReceiver);
103         return m_emailReceiver;
104     }
105
106     /**
107      * Returns the emailSender.<p>
108      *
109      * @return the emailSender
110      */

111     public String JavaDoc getEmailSender() {
112
113         return m_emailSender;
114     }
115
116     /**
117      * Returns the intervalLog.<p>
118      *
119      * @return the intervalLog
120      */

121     public int getLogInterval() {
122
123         return m_logInterval;
124     }
125
126     /**
127      * Returns the maxUsagePercent.<p>
128      *
129      * @return the maxUsagePercent
130      */

131     public int getMaxUsagePercent() {
132
133         return m_maxUsagePercent;
134     }
135
136     /**
137      * Returns the intervalWarning.<p>
138      *
139      * @return the intervalWarning
140      */

141     public int getWarningInterval() {
142
143         return m_warningInterval;
144     }
145
146     /**
147      * Initializes the configuration with the required parameters.<p>
148      *
149      * @param maxUsagePercent the max usage percent value
150      * @param logInterval the interval to log
151      * @param emailInterval the interval to send email
152      * @param warningInterval the interval to warn
153      */

154     public void initialize(String JavaDoc maxUsagePercent, String JavaDoc logInterval, String JavaDoc emailInterval, String JavaDoc warningInterval) {
155
156         m_maxUsagePercent = Integer.parseInt(maxUsagePercent);
157         m_logInterval = Integer.parseInt(logInterval);
158         m_emailInterval = Integer.parseInt(emailInterval);
159         m_warningInterval = Integer.parseInt(warningInterval);
160     }
161
162     /**
163      * Sets the emailSender.<p>
164      *
165      * @param emailSender the emailSender to set
166      */

167     public void setEmailSender(String JavaDoc emailSender) {
168
169         m_emailSender = emailSender;
170     }
171 }
172
Popular Tags