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;
05:
06: import com.tc.management.beans.L2MBeanNames;
07:
08: import javax.management.ObjectName;
09:
10: public class ServerHelper extends BaseHelper {
11: private static ServerHelper m_helper = new ServerHelper();
12:
13: public static ServerHelper getHelper() {
14: return m_helper;
15: }
16:
17: public ObjectName getServerInfoMBean(ConnectionContext cc)
18: throws Exception {
19: return cc.queryName(L2MBeanNames.TC_SERVER_INFO
20: .getCanonicalName());
21: }
22:
23: public boolean canShutdown(ConnectionContext cc) throws Exception {
24: ObjectName infoMBean = getServerInfoMBean(cc);
25: return infoMBean != null
26: && cc.getBooleanAttribute(infoMBean, "Shutdownable");
27: }
28:
29: public boolean isActive(ConnectionContext cc) throws Exception {
30: ObjectName infoMBean = getServerInfoMBean(cc);
31: return infoMBean != null
32: && cc.getBooleanAttribute(infoMBean, "Active");
33: }
34:
35: public boolean isStarted(ConnectionContext cc) throws Exception {
36: ObjectName infoMBean = getServerInfoMBean(cc);
37: return infoMBean != null
38: && cc.getBooleanAttribute(infoMBean, "Started");
39: }
40:
41: public boolean isPassiveUninitialized(ConnectionContext cc)
42: throws Exception {
43: ObjectName infoMBean = getServerInfoMBean(cc);
44: return infoMBean != null
45: && cc.getBooleanAttribute(infoMBean,
46: "PassiveUninitialized");
47: }
48:
49: public boolean isPassiveStandby(ConnectionContext cc)
50: throws Exception {
51: ObjectName infoMBean = getServerInfoMBean(cc);
52: return infoMBean != null
53: && cc.getBooleanAttribute(infoMBean, "PassiveStandby");
54: }
55: }
|