KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > ServerHelper


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin;
5
6 import com.tc.management.beans.L2MBeanNames;
7
8 import javax.management.ObjectName JavaDoc;
9
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 JavaDoc getServerInfoMBean(ConnectionContext cc) throws Exception JavaDoc {
18     return cc.queryName(L2MBeanNames.TC_SERVER_INFO.getCanonicalName());
19   }
20
21   public boolean isActive(ConnectionContext cc) throws Exception JavaDoc {
22     ObjectName JavaDoc infoMBean = getServerInfoMBean(cc);
23
24     return infoMBean != null && cc.getBooleanAttribute(infoMBean, "Active");
25   }
26
27   public boolean isStarted(ConnectionContext cc) throws Exception JavaDoc {
28     ObjectName JavaDoc infoMBean = getServerInfoMBean(cc);
29
30     return infoMBean != null && cc.getBooleanAttribute(infoMBean, "Started");
31   }
32 }
33
Popular Tags