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.monitoring.Level;
18  import com.liferay.portal.monitoring.MonitoringProcessor;
19  
20  import java.util.Set;
21  
22  /**
23   * <a href="MonitoringProcessorManager.java.html"><b><i>View Source</i></b></a>
24   *
25   * @author Michael C. Han
26   * @author Brian Wing Shun Chan
27   */
28  public class MonitoringProcessorManager
29      implements MonitoringProcessorManagerMBean {
30  
31      public String getLevel(String namespace) {
32          Level level = _monitoringProcessor.getLevel(
33              namespace);
34  
35          if (level == null) {
36              level = Level.OFF;
37          }
38  
39          return level.toString();
40      }
41  
42      public String[] getNamespaces() {
43          Set<String> namespaces = _monitoringProcessor.getNamespaces();
44  
45          return namespaces.toArray(new String[namespaces.size()]);
46      }
47  
48      public void setLevel(String namespace, String levelName) {
49          Level level = Level.valueOf(levelName);
50  
51          _monitoringProcessor.setLevel(namespace, level);
52      }
53  
54      public void setMonitoringProcessor(
55          MonitoringProcessor monitoringProcessor) {
56  
57          _monitoringProcessor = monitoringProcessor;
58      }
59  
60      private MonitoringProcessor _monitoringProcessor;
61  
62  }