1 4 package com.tc.admin.dso; 5 6 import com.tc.admin.BaseHelper; 7 import com.tc.admin.ConnectionContext; 8 import com.tc.management.beans.L2MBeanNames; 9 import com.tc.object.ObjectID; 10 import com.tc.objectserver.api.GCStats; 11 import com.tc.objectserver.mgmt.ManagedObjectFacade; 12 13 import java.net.URL ; 14 15 import javax.management.ObjectName ; 16 import javax.swing.Icon ; 17 import javax.swing.ImageIcon ; 18 19 public class DSOHelper extends BaseHelper { 20 private static DSOHelper m_helper = new DSOHelper(); 21 private Icon m_dsoIcon; 22 23 public static DSOHelper getHelper() { 24 return m_helper; 25 } 26 27 public Icon getDSOIcon() { 28 if (m_dsoIcon == null) { 29 URL url = getClass().getResource(ICONS_PATH + "search_menu.gif"); 30 31 if (url != null) { 32 m_dsoIcon = new ImageIcon (url); 33 } 34 } 35 36 return m_dsoIcon; 37 } 38 39 public ObjectName getDSOMBean(ConnectionContext cc) { 40 try { 41 return cc.queryName(L2MBeanNames.DSO.getCanonicalName()); 42 } catch (Exception e) { 43 } 44 45 return null; 46 } 47 48 public ManagedObjectFacade lookupFacade(ConnectionContext cc, ObjectID objectID, int batchSize) throws Exception { 49 ObjectName bean = getDSOMBean(cc); 50 String op = "lookupFacade"; 51 Object [] args = new Object [] { objectID, new Integer (batchSize) }; 52 String [] types = new String [] { "com.tc.object.ObjectID", "int" }; 53 54 return (ManagedObjectFacade) cc.invoke(bean, op, args, types); 55 } 56 57 public GCStats[] getGCStats(ConnectionContext cc) throws Exception { 58 ObjectName bean = getDSOMBean(cc); 59 String attr = "GarbageCollectorStats"; 60 61 return (GCStats[]) cc.getAttribute(bean, attr); 62 } 63 } 64 | Popular Tags |