1
22
23 package com.liferay.portal.monitoring.jmx;
24
25 import com.liferay.portal.kernel.util.ArrayUtil;
26 import com.liferay.portal.monitoring.MonitoringException;
27 import com.liferay.portal.monitoring.statistics.SummaryStatistics;
28 import com.liferay.portal.monitoring.statistics.portal.ServerStatistics;
29
30 import java.util.Set;
31
32
39 public class PortalManager implements PortalManagerMBean {
40
41 public PortalManager(
42 ServerStatistics serverStatistics,
43 SummaryStatistics summaryStatistics) {
44
45 _serverStatistics = serverStatistics;
46 _summaryStatistics = summaryStatistics;
47 }
48
49 public long getAverageTime() throws MonitoringException {
50 return _summaryStatistics.getAverageTime();
51 }
52
53 public long getAverageTimeByCompany(long companyId)
54 throws MonitoringException {
55
56 return _summaryStatistics.getAverageTimeByCompany(companyId);
57 }
58
59 public long getAverageTimeByCompany(String webId)
60 throws MonitoringException {
61
62 return _summaryStatistics.getAverageTimeByCompany(webId);
63 }
64
65 public long[] getCompanyIds() {
66 Set<Long> companyIds = _serverStatistics.getCompanyIds();
67
68 return ArrayUtil.toArray(
69 companyIds.toArray(new Long[companyIds.size()]));
70 }
71
72 public long getErrorCount() throws MonitoringException {
73 return _summaryStatistics.getErrorCount();
74 }
75
76 public long getErrorCountByCompany(long companyId)
77 throws MonitoringException {
78
79 return _summaryStatistics.getErrorCountByCompany(companyId);
80 }
81
82 public long getErrorCountByCompany(String webId)
83 throws MonitoringException {
84
85 return _summaryStatistics.getErrorCountByCompany(webId);
86 }
87
88 public long getMaxTime() throws MonitoringException {
89 return _summaryStatistics.getMaxTime();
90 }
91
92 public long getMaxTimeByCompany(long companyId) throws MonitoringException {
93 return _summaryStatistics.getMaxTimeByCompany(companyId);
94 }
95
96 public long getMaxTimeByCompany(String webId) throws MonitoringException {
97 return _summaryStatistics.getMaxTimeByCompany(webId);
98 }
99
100 public long getMinTime() throws MonitoringException {
101 return _summaryStatistics.getMinTime();
102 }
103
104 public long getMinTimeByCompany(long companyId) throws MonitoringException {
105 return _summaryStatistics.getMinTimeByCompany(companyId);
106 }
107
108 public long getMinTimeByCompany(String webId) throws MonitoringException {
109 return _summaryStatistics.getMinTimeByCompany(webId);
110 }
111
112 public long getRequestCount() throws MonitoringException {
113 return _summaryStatistics.getRequestCount();
114 }
115
116 public long getRequestCountByCompany(long companyId)
117 throws MonitoringException {
118
119 return _summaryStatistics.getRequestCountByCompany(companyId);
120 }
121
122 public long getRequestCountByCompany(String webId)
123 throws MonitoringException {
124
125 return _summaryStatistics.getRequestCountByCompany(webId);
126 }
127
128 public long getStartTime(long companyId) throws MonitoringException {
129 return _serverStatistics.getCompanyStatistics(companyId).getStartTime();
130 }
131
132 public long getStartTime(String webId) throws MonitoringException {
133 return _serverStatistics.getCompanyStatistics(webId).getStartTime();
134 }
135
136 public long getSuccessCount() throws MonitoringException {
137 return _summaryStatistics.getSuccessCount();
138 }
139
140 public long getSuccessCountByCompany(long companyId)
141 throws MonitoringException {
142
143 return _summaryStatistics.getSuccessCountByCompany(companyId);
144 }
145
146 public long getSuccessCountByCompany(String webId)
147 throws MonitoringException {
148
149 return _summaryStatistics.getSuccessCountByCompany(webId);
150 }
151
152 public long getTimeoutCount() throws MonitoringException {
153 return _summaryStatistics.getTimeoutCount();
154 }
155
156 public long getTimeoutCountByCompany(long companyId)
157 throws MonitoringException {
158
159 return _summaryStatistics.getTimeoutCountByCompany(companyId);
160 }
161
162 public long getTimeoutCountByCompany(String webId)
163 throws MonitoringException {
164
165 return _summaryStatistics.getTimeoutCountByCompany(webId);
166 }
167
168 public long getUptime(long companyId) throws MonitoringException {
169 return _serverStatistics.getCompanyStatistics(companyId).getUptime();
170 }
171
172 public long getUptime(String webId) throws MonitoringException {
173 return _serverStatistics.getCompanyStatistics(webId).getUptime();
174 }
175
176 public String[] getWebIds() {
177 Set<String> webIds = _serverStatistics.getWebIds();
178
179 return webIds.toArray(new String[webIds.size()]);
180 }
181
182 public void reset() {
183 _serverStatistics.reset();
184 }
185
186 public void reset(long companyId) {
187 _serverStatistics.reset(companyId);
188 }
189
190 public void reset(String webId) {
191 _serverStatistics.reset(webId);
192 }
193
194 private ServerStatistics _serverStatistics;
195 private SummaryStatistics _summaryStatistics;
196
197 }