View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe.model;
12  
13  import psiprobe.UtilsBase;
14  
15  /**
16   * POJO representing a datasource.
17   */
18  public class DataSourceInfo {
19  
20    /** The jdbc url. */
21    private String jdbcUrl;
22  
23    /** The busy connections. */
24    private int busyConnections;
25  
26    /** The established connections. */
27    private int establishedConnections;
28  
29    /** The max connections. */
30    private int maxConnections;
31  
32    /** The resettable. */
33    private boolean resettable;
34  
35    /** The username. */
36    private String username;
37  
38    /** The type. */
39    private String type;
40  
41    /**
42     * Gets the jdbc url.
43     *
44     * @return the jdbc url
45     */
46    public String getJdbcUrl() {
47      return jdbcUrl;
48    }
49  
50    /**
51     * Sets the jdbc url.
52     *
53     * @param jdbcUrl the new jdbc url
54     */
55    public void setJdbcUrl(String jdbcUrl) {
56      this.jdbcUrl = jdbcUrl;
57    }
58  
59    /**
60     * Gets the busy connections.
61     *
62     * @return the busy connections
63     */
64    public int getBusyConnections() {
65      return busyConnections;
66    }
67  
68    /**
69     * Sets the busy connections.
70     *
71     * @param busyConnections the new busy connections
72     */
73    public void setBusyConnections(int busyConnections) {
74      this.busyConnections = busyConnections;
75    }
76  
77    /**
78     * Gets the established connections.
79     *
80     * @return the established connections
81     */
82    public int getEstablishedConnections() {
83      return establishedConnections;
84    }
85  
86    /**
87     * Sets the established connections.
88     *
89     * @param establishedConnections the new established connections
90     */
91    public void setEstablishedConnections(int establishedConnections) {
92      this.establishedConnections = establishedConnections;
93    }
94  
95    /**
96     * Gets the max connections.
97     *
98     * @return the max connections
99     */
100   public int getMaxConnections() {
101     return maxConnections;
102   }
103 
104   /**
105    * Sets the max connections.
106    *
107    * @param maxConnections the new max connections
108    */
109   public void setMaxConnections(int maxConnections) {
110     this.maxConnections = maxConnections;
111   }
112 
113   /**
114    * Checks if is resettable.
115    *
116    * @return true, if is resettable
117    */
118   public boolean isResettable() {
119     return resettable;
120   }
121 
122   /**
123    * Sets the resettable.
124    *
125    * @param resettable the new resettable
126    */
127   public void setResettable(boolean resettable) {
128     this.resettable = resettable;
129   }
130 
131   /**
132    * Gets the username.
133    *
134    * @return the username
135    */
136   public String getUsername() {
137     return username;
138   }
139 
140   /**
141    * Sets the username.
142    *
143    * @param username the new username
144    */
145   public void setUsername(String username) {
146     this.username = username;
147   }
148 
149   /**
150    * Gets the type.
151    *
152    * @return the type
153    */
154   public String getType() {
155     return type;
156   }
157 
158   /**
159    * Sets the type.
160    *
161    * @param type the new type
162    */
163   public void setType(String type) {
164     this.type = type;
165   }
166 
167   /**
168    * Gets the busy score.
169    *
170    * @return the busy score
171    */
172   public int getBusyScore() {
173     return UtilsBase.calcPoolUsageScore(getMaxConnections(), getBusyConnections());
174   }
175 
176   /**
177    * Gets the established score.
178    *
179    * @return the established score
180    */
181   public int getEstablishedScore() {
182     return UtilsBase.calcPoolUsageScore(getMaxConnections(), getEstablishedConnections());
183   }
184 
185 }