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.SystemException;
18  import com.liferay.portal.kernel.util.MethodKey;
19  import com.liferay.portal.monitoring.statistics.service.ServerStatistics;
20  import com.liferay.portal.monitoring.statistics.service.ServiceMonitorAdvice;
21  
22  import java.util.Set;
23  
24  /**
25   * <a href="ServiceManager.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Michael C. Han
28   */
29  public class ServiceManager implements ServiceManagerMBean {
30  
31      public void addMonitoredClass(String className) {
32          _serviceMonitorAdvice.addMonitoredClass(className);
33      }
34  
35      public void addMonitoredMethod(
36              String className, String methodName, String[] parameterTypes)
37          throws SystemException {
38  
39          _serviceMonitorAdvice.addMonitoredMethod(
40              className, methodName, parameterTypes);
41      }
42  
43      public long getErrorCount(
44              String className, String methodName, String[] parameterTypes)
45          throws SystemException {
46  
47          return _serverStatistics.getErrorCount(
48              className, methodName, parameterTypes);
49      }
50  
51      public long getMaxTime(
52              String className, String methodName, String[] parameterTypes)
53          throws SystemException {
54  
55          return _serverStatistics.getMaxTime(
56              className, methodName, parameterTypes);
57      }
58  
59      public long getMinTime(
60              String className, String methodName, String[] parameterTypes)
61          throws SystemException {
62  
63          return _serverStatistics.getMinTime(
64              className, methodName, parameterTypes);
65      }
66  
67      public Set<String> getMonitoredClasses() {
68          return _serviceMonitorAdvice.getMonitoredClasses();
69      }
70  
71      public Set<MethodKey> getMonitoredMethods() {
72          return _serviceMonitorAdvice.getMonitoredMethods();
73      }
74  
75      public long getRequestCount(
76              String className, String methodName, String[] parameterTypes)
77          throws SystemException {
78  
79          return _serverStatistics.getRequestCount(
80              className, methodName, parameterTypes);
81      }
82  
83      public boolean isActive() {
84          return _serviceMonitorAdvice.isActive();
85      }
86  
87      public boolean isPermissiveMode() {
88          return _serviceMonitorAdvice.isPermissiveMode();
89      }
90  
91      public void setActive(boolean active) {
92          _serviceMonitorAdvice.setActive(active);
93      }
94  
95      public void setPermissiveMode(boolean permissiveMode) {
96          _serviceMonitorAdvice.setPermissiveMode(permissiveMode);
97      }
98  
99      public void setServerStatistics(ServerStatistics serverStatistics) {
100         _serverStatistics = serverStatistics;
101     }
102 
103     public void setServiceMonitorAdvice(
104         ServiceMonitorAdvice serviceMonitorAdvice) {
105 
106         _serviceMonitorAdvice = serviceMonitorAdvice;
107     }
108 
109     private ServerStatistics _serverStatistics;
110     private ServiceMonitorAdvice _serviceMonitorAdvice;
111 
112 }