View Javadoc

1   /***
2    * Copyright 2009 Martin Vysny.
3    *
4    * This file is part of WebVM.
5    *
6    * WebVM is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * WebVM is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with WebVM.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  package sk.baka.webvm.config;
20  
21  import java.io.Serializable;
22  
23  /***
24   * The configuration bean.
25   * @author Martin Vysny
26   */
27  public final class Config implements Serializable {
28  
29      private static final long serialVersionUID = 1L;
30  
31      /***
32       * Creates new config file with default settings.
33       */
34      public Config() {
35          super();
36      }
37  
38      /***
39       * Clones given config.
40       * @param other the config object to clone.
41       */
42      public Config(final Config other) {
43          super();
44          Binder.copy(other, this);
45      }
46      /***
47       * The problems settings group.
48       */
49      public static final int GROUP_PROBLEMS = 1;
50      /***
51       * The mail settings group.
52       */
53      public static final int GROUP_MAIL = 2;
54      /***
55       * The jabber settings group.
56       */
57      public static final int GROUP_JABBER = 3;
58      /***
59       * Triggers a problem when there is less than minFreeDiskSpaceMb of free space on some drive
60       */
61      @Bind(key = "minFreeDiskSpaceMb", min = 0, group = GROUP_PROBLEMS)
62      public int minFreeDiskSpaceMb = 100;
63      /***
64       * Triggers a problem when GC uses over gcCpuTreshold% or more of CPU continuously for gcCpuTresholdSamples seconds.
65       */
66      @Bind(key = "gcCpuTreshold", min = 0, group = GROUP_PROBLEMS)
67      public int gcCpuTreshold = 50;
68      /***
69       * Triggers a problem when GC uses over gcCpuTreshold% or more of CPU continuously for gcCpuTresholdSamples seconds.
70       */
71      @Bind(key = "gcCpuTresholdSamples", min = 1, group = GROUP_PROBLEMS)
72      public int gcCpuTresholdSamples = 3;
73      /***
74       * If the memory usage after GC goes above this value the {@link #CLASS_GC_MEMORY_CLEANUP} problem is reported.
75       */
76      @Bind(key = "memAfterGcUsageTreshold", min = 0, max = 100, group = GROUP_PROBLEMS)
77      public int memAfterGcUsageTreshold = 85;
78      /***
79       * If the memory usage goes above this value the pool name is reported in the {@link #CLASS_MEMORY_STATUS} report. This never triggers a problem.
80       */
81      @Bind(key = "memUsageTreshold", min = 0, max = 100, group = GROUP_PROBLEMS)
82      public int memUsageTreshold = 90;
83      /***
84       * Triggered when the host virtual memory usage goes above this value.
85       */
86      @Bind(key = "hostMemUsageTreshold", min = 0, max = 100, group = GROUP_PROBLEMS)
87      public int hostVirtMem = 90;
88      /***
89       * The SMTP server host/port. If this is commented then no mails are sent.
90       */
91      @Bind(key = "mail.smtp.host", required = false, group = GROUP_MAIL)
92      public String mailSmtpHost;
93      /***
94       * SMTP server port, defaults to 25 (465 for SSL)
95       */
96      @Bind(key = "mail.smtp.port", min = -1, max = 65535, group = GROUP_MAIL)
97      public int mailSmtpPort = -1;
98      /***
99       * The "from" address
100      */
101     @Bind(key = "mail.from", required = false, group = GROUP_MAIL)
102     public String mailFrom;
103     /***
104      * Receivers, split by a comma
105      */
106     @Bind(key = "mail.to", required = false, group = GROUP_MAIL)
107     public String mailTo;
108     /***
109      * The connection encryption.
110      */
111     @Bind(key = "mail.smtp.encryption", required = false, group = GROUP_MAIL)
112     public EncryptionEnum mailSmtpEncryption = EncryptionEnum.NONE;
113     /***
114      * Optional SMTP authentication.
115      */
116     @Bind(key = "mail.smtp.username", required = false, group = GROUP_MAIL)
117     public String mailSmtpUsername;
118     /***
119      * Optional SMTP authentification.
120      */
121     @Bind(key = "mail.smtp.password", password = true, required = false, group = GROUP_MAIL)
122     public String mailSmtpPassword;
123     /***
124      * Jabber server.
125      */
126     @Bind(key = "jabber.server", required = false, group = GROUP_JABBER)
127     public String jabberServer;
128     /***
129      * Jabber user name.
130      */
131     @Bind(key = "jabber.username", required = false, group = GROUP_JABBER)
132     public String jabberUsername;
133     /***
134      * Jabber password.
135      */
136     @Bind(key = "jabber.password", required = false, password = true, group = GROUP_JABBER)
137     public String jabberPassword;
138     /***
139      * Jabber recipients, split by a comma
140      */
141     @Bind(key = "jabber.recipients", required = false, group = GROUP_JABBER)
142     public String jabberRecipients;
143 }