01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.sessions;
05:
06: import com.tc.admin.ConnectionContext;
07: import com.tc.management.beans.L1MBeanNames;
08: import com.tc.management.beans.MBeanNames;
09:
10: import javax.management.ObjectName;
11:
12: public class SessionsHelper {
13: private static SessionsHelper m_helper = new SessionsHelper();
14: private String m_sessionProductPattern;
15: private ObjectName m_sessionProductQuery;
16: private String m_sessionsMonitorPattern;
17: private ObjectName m_sessionsMonitorQuery;
18:
19: private SessionsHelper() {
20: try {
21: m_sessionProductPattern = L1MBeanNames.SESSION_PRODUCT_PUBLIC
22: .getCanonicalName()
23: + ",*";
24: m_sessionProductQuery = new ObjectName(
25: m_sessionProductPattern);
26: m_sessionsMonitorPattern = MBeanNames.SESSION_INTERNAL
27: .getCanonicalName()
28: + ",*";
29: m_sessionsMonitorQuery = new ObjectName(
30: m_sessionsMonitorPattern);
31: } catch (Exception e) {
32: e.printStackTrace();
33: }
34: }
35:
36: public static SessionsHelper getHelper() {
37: return m_helper;
38: }
39:
40: public boolean isSessionsProductMBean(ObjectName name) {
41: return m_sessionProductQuery.apply(name);
42: }
43:
44: public ObjectName[] getSessionsProductMBeans(ConnectionContext cc) {
45: try {
46: return cc.queryNames(m_sessionProductPattern);
47: } catch (Exception e) {/**/
48: }
49:
50: return null;
51: }
52:
53: public boolean isSessionMonitorMBean(ObjectName name) {
54: return m_sessionsMonitorQuery.apply(name);
55: }
56:
57: public ObjectName[] getSessionMonitorMBeans(ConnectionContext cc) {
58: try {
59: return cc.queryNames(m_sessionsMonitorPattern);
60: } catch (Exception e) {/**/
61: }
62:
63: return null;
64: }
65: }
|