1 4 package com.tc.admin.dso; 5 6 import com.tc.admin.BaseHelper; 7 import com.tc.admin.ConnectionContext; 8 9 import java.io.IOException ; 10 import java.net.URL ; 11 12 import javax.management.AttributeNotFoundException ; 13 import javax.management.InstanceNotFoundException ; 14 import javax.management.MBeanException ; 15 import javax.management.ObjectName ; 16 import javax.management.ReflectionException ; 17 import javax.swing.Icon ; 18 import javax.swing.ImageIcon ; 19 20 public class ClientsHelper extends BaseHelper { 21 private static ClientsHelper m_helper = new ClientsHelper(); 22 private Icon m_clientsIcon; 23 private Icon m_clientIcon; 24 25 public static ClientsHelper getHelper() { 26 return m_helper; 27 } 28 29 public Icon getClientsIcon() { 30 if(m_clientsIcon == null) { 31 URL url = getClass().getResource(ICONS_PATH+"hierarchicalLayout.gif"); 32 m_clientsIcon = new ImageIcon (url); 33 } 34 35 return m_clientsIcon; 36 } 37 38 public Icon getClientIcon() { 39 if(m_clientIcon == null) { 40 URL url = getClass().getResource(ICONS_PATH+"genericvariable_obj.gif"); 41 m_clientIcon = new ImageIcon (url); 42 } 43 44 return m_clientIcon; 45 } 46 47 public DSOClient[] getClients(ConnectionContext cc) 48 throws MBeanException , 49 AttributeNotFoundException , 50 InstanceNotFoundException , 51 ReflectionException , 52 IOException 53 { 54 ObjectName [] clientNames = getClientNames(cc); 55 int count = (clientNames != null) ? clientNames.length : 0; 56 DSOClient[] result = new DSOClient[count]; 57 58 for(int i = 0; i < count; i++) { 59 result[i] = new DSOClient(cc, clientNames[i]); 60 } 61 62 return result; 63 } 64 65 public ObjectName [] getClientNames(ConnectionContext cc) 66 throws MBeanException , 67 AttributeNotFoundException , 68 InstanceNotFoundException , 69 ReflectionException , 70 IOException 71 { 72 ObjectName dso = DSOHelper.getHelper().getDSOMBean(cc); 73 return (ObjectName [])cc.getAttribute(dso, "Clients"); 74 } 75 } 76 | Popular Tags |