1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.monitoring.jmx;
16  
17  import com.liferay.portal.kernel.util.ArrayUtil;
18  import com.liferay.portal.monitoring.MonitoringException;
19  import com.liferay.portal.monitoring.statistics.portlet.PortletSummaryStatistics;
20  import com.liferay.portal.monitoring.statistics.portlet.ServerStatistics;
21  
22  import java.util.Set;
23  
24  /**
25   * <a href="PortletManager.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Michael C. Han
28   * @author Brian Wing Shun Chan
29   */
30  public class PortletManager implements PortletManagerMBean {
31  
32      public long getAverageTime() throws MonitoringException {
33          return _portletSummaryStatistics.getAverageTime();
34      }
35  
36      public long getAverageTimeByCompany(long companyId)
37          throws MonitoringException {
38  
39          return _portletSummaryStatistics.getAverageTimeByCompany(companyId);
40      }
41  
42      public long getAverageTimeByCompany(String webId)
43          throws MonitoringException {
44  
45          return _portletSummaryStatistics.getAverageTimeByCompany(webId);
46      }
47  
48      public long getAverageTimeByPortlet(String portletId)
49          throws MonitoringException {
50  
51          return _portletSummaryStatistics.getAverageTimeByPortlet(portletId);
52      }
53  
54      public long getAverageTimeByPortlet(String portletId, long companyId)
55          throws MonitoringException {
56  
57          return _portletSummaryStatistics.getAverageTimeByPortlet(
58              portletId, companyId);
59      }
60  
61      public long getAverageTimeByPortlet(String portletId, String webId)
62          throws MonitoringException {
63  
64          return _portletSummaryStatistics.getAverageTimeByPortlet(
65              portletId, webId);
66      }
67  
68      public long[] getCompanyIds() {
69          Set<Long> companyIds = _serverStatistics.getCompanyIds();
70  
71          return ArrayUtil.toArray(
72              companyIds.toArray(new Long[companyIds.size()]));
73      }
74  
75      public long getErrorCount() throws MonitoringException {
76          return _portletSummaryStatistics.getErrorCount();
77      }
78  
79      public long getErrorCountByCompany(long companyId)
80          throws MonitoringException {
81  
82          return _portletSummaryStatistics.getErrorCountByCompany(companyId);
83      }
84  
85      public long getErrorCountByCompany(String webId)
86          throws MonitoringException {
87  
88          return _portletSummaryStatistics.getErrorCountByCompany(webId);
89      }
90  
91      public long getErrorCountByPortlet(String portletId)
92          throws MonitoringException {
93  
94          return _portletSummaryStatistics.getErrorCountByPortlet(portletId);
95      }
96  
97      public long getErrorCountByPortlet(String portletId, long companyId)
98          throws MonitoringException {
99  
100         return _portletSummaryStatistics.getErrorCountByPortlet(
101             portletId, companyId);
102     }
103 
104     public long getErrorCountByPortlet(String portletId, String webId)
105         throws MonitoringException {
106 
107         return _portletSummaryStatistics.getErrorCountByPortlet(
108             portletId, webId);
109     }
110 
111     public long getMaxTime() throws MonitoringException {
112         return _portletSummaryStatistics.getMaxTime();
113     }
114 
115     public long getMaxTimeByCompany(long companyId) throws MonitoringException {
116         return _portletSummaryStatistics.getMaxTimeByCompany(companyId);
117     }
118 
119     public long getMaxTimeByCompany(String webId) throws MonitoringException {
120         return _portletSummaryStatistics.getMaxTimeByCompany(webId);
121     }
122 
123     public long getMaxTimeByPortlet(String portletId)
124         throws MonitoringException {
125 
126         return _portletSummaryStatistics.getMaxTimeByPortlet(portletId);
127     }
128 
129     public long getMaxTimeByPortlet(String portletId, long companyId)
130         throws MonitoringException {
131 
132         return _portletSummaryStatistics.getMaxTimeByPortlet(
133             portletId, companyId);
134     }
135 
136     public long getMaxTimeByPortlet(String portletId, String webId)
137         throws MonitoringException {
138 
139         return _portletSummaryStatistics.getMaxTimeByPortlet(portletId, webId);
140     }
141 
142     public long getMinTime() throws MonitoringException {
143         return _portletSummaryStatistics.getMinTime();
144     }
145 
146     public long getMinTimeByCompany(long companyId) throws MonitoringException {
147         return _portletSummaryStatistics.getMinTimeByCompany(companyId);
148     }
149 
150     public long getMinTimeByCompany(String webId) throws MonitoringException {
151         return _portletSummaryStatistics.getMinTimeByCompany(webId);
152     }
153 
154     public long getMinTimeByPortlet(String portletId)
155         throws MonitoringException {
156 
157         return _portletSummaryStatistics.getMinTimeByPortlet(portletId);
158     }
159 
160     public long getMinTimeByPortlet(String portletId, long companyId)
161         throws MonitoringException {
162 
163         return _portletSummaryStatistics.getMinTimeByPortlet(
164             portletId, companyId);
165     }
166 
167     public long getMinTimeByPortlet(String portletId, String webId)
168         throws MonitoringException {
169 
170         return _portletSummaryStatistics.getMinTimeByPortlet(portletId, webId);
171     }
172 
173     public String[] getPortletIds() {
174         Set<String> portletIds = _serverStatistics.getPortletIds();
175 
176         return portletIds.toArray(new String[portletIds.size()]);
177     }
178 
179     public long getRequestCount() throws MonitoringException {
180         return _portletSummaryStatistics.getRequestCount();
181     }
182 
183     public long getRequestCountByCompany(long companyId)
184         throws MonitoringException {
185 
186         return _portletSummaryStatistics.getRequestCountByCompany(companyId);
187     }
188 
189     public long getRequestCountByCompany(String webId)
190         throws MonitoringException {
191 
192         return _portletSummaryStatistics.getRequestCountByCompany(webId);
193     }
194 
195     public long getRequestCountByPortlet(String portletId)
196         throws MonitoringException {
197 
198         return _portletSummaryStatistics.getRequestCountByPortlet(portletId);
199     }
200 
201     public long getRequestCountByPortlet(String portletId, long companyId)
202         throws MonitoringException {
203 
204         return _portletSummaryStatistics.getRequestCountByPortlet(
205             portletId, companyId);
206     }
207 
208     public long getRequestCountByPortlet(String portletId, String webId)
209         throws MonitoringException {
210 
211         return _portletSummaryStatistics.getRequestCountByPortlet(
212             portletId, webId);
213     }
214 
215     public long getSuccessCount() throws MonitoringException {
216         return _portletSummaryStatistics.getSuccessCount();
217     }
218 
219     public long getSuccessCountByCompany(long companyId)
220         throws MonitoringException {
221 
222         return _portletSummaryStatistics.getSuccessCountByCompany(companyId);
223     }
224 
225     public long getSuccessCountByCompany(String webId)
226         throws MonitoringException {
227 
228         return _portletSummaryStatistics.getSuccessCountByCompany(webId);
229     }
230 
231     public long getSuccessCountByPortlet(String portletId)
232         throws MonitoringException {
233 
234         return _portletSummaryStatistics.getSuccessCountByPortlet(portletId);
235     }
236 
237     public long getSuccessCountByPortlet(String portletId, long companyId)
238         throws MonitoringException {
239 
240         return _portletSummaryStatistics.getSuccessCountByPortlet(
241             portletId, companyId);
242     }
243 
244     public long getSuccessCountByPortlet(String portletId, String webId)
245         throws MonitoringException {
246 
247         return _portletSummaryStatistics.getSuccessCountByPortlet(
248             portletId, webId);
249     }
250 
251     public long getTimeoutCount() throws MonitoringException {
252         return _portletSummaryStatistics.getTimeoutCount();
253     }
254 
255     public long getTimeoutCountByCompany(long companyId)
256         throws MonitoringException {
257 
258         return _portletSummaryStatistics.getTimeoutCountByCompany(companyId);
259     }
260 
261     public long getTimeoutCountByCompany(String webId)
262         throws MonitoringException {
263 
264         return _portletSummaryStatistics.getTimeoutCountByCompany(webId);
265     }
266 
267     public long getTimeoutCountByPortlet(String portletId)
268         throws MonitoringException {
269 
270         return _portletSummaryStatistics.getTimeoutCountByPortlet(portletId);
271     }
272 
273     public long getTimeoutCountByPortlet(String portletId, long companyId)
274         throws MonitoringException {
275 
276         return _portletSummaryStatistics.getTimeoutCountByPortlet(
277             portletId, companyId);
278     }
279 
280     public long getTimeoutCountByPortlet(String portletId, String webId)
281         throws MonitoringException {
282 
283         return _portletSummaryStatistics.getTimeoutCountByPortlet(
284             portletId, webId);
285     }
286 
287     public String[] getWebIds() {
288         Set<String> webIds = _serverStatistics.getWebIds();
289 
290         return webIds.toArray(new String[webIds.size()]);
291     }
292 
293     public void reset() {
294         _serverStatistics.reset();
295     }
296 
297     public void reset(long companyId) {
298         _serverStatistics.reset(companyId);
299     }
300 
301     public void reset(String webId) {
302         _serverStatistics.reset(webId);
303     }
304 
305     public void setPortletSummaryStatistics(
306         PortletSummaryStatistics portletSummaryStatistics) {
307 
308         _portletSummaryStatistics = portletSummaryStatistics;
309     }
310 
311     public void setServerStatistics(ServerStatistics serverStatistics) {
312         _serverStatistics = serverStatistics;
313     }
314 
315     private PortletSummaryStatistics _portletSummaryStatistics;
316     private ServerStatistics _serverStatistics;
317 
318 }