1 package ist.coach.coachEmfClientComponents.gui; 2 3 import ist.coach.coachEmsMib.IpNodeValueType; 4 import intt.itu.itut_x780.ManagedObjectValueType; 5 import java.util.Vector ; 6 import java.util.Hashtable ; 7 import ist.coach.coachEmfClientComponents.InvokeSetData; 8 import ist.coach.coachEmfCommon.Utils; 9 import javax.swing.JPopupMenu ; 10 11 import javax.swing.ImageIcon ; 12 13 public class VisualIpNode 14 extends VisualManagedElement { 15 16 static String [] subordinate_names = new String [0]; 19 static boolean canRefresh = true; 20 21 static String object_type = "IpNode"; 22 static String emsClassName = "ist.coach.coachEmsMib.IpNode_F"; 23 24 static String DISPLAY_TYPE = "IpNode"; 25 static String [] create_arg_name = {"Name", 29 "Domain Name", 30 "Host Name", 31 "IP Address", 32 "SNMP Version", 33 "User Label", 34 "Product Vendor", 35 "Product Version", 36 "Location", 37 "SNMP Port", 38 "System Name", 39 "Contact Person"}; 40 static String [] create_arg_editor = { "", "", "", "", "", "", "" }; 41 static String [] create_arg_renderer = { "", "", "", "", "", "", "" }; 42 static String [] attributes_name = {"Name", 46 "Element Type", 47 "Creation Source", 48 "Delete Policy", 49 "Administrative State", 51 "Operational State", 52 "Usage State", 53 "User Label", 54 "Product Vendor", 55 "Product Version", 56 "Location", 57 "Domain Name", 59 "Host Name", 60 "IP Address", 61 "SNMP Version", 62 "SNMP Port", 63 "Number of Interfaces", 64 "System Description", 65 "SystemOID", 66 "SNMP Agent Up Time", 67 "System Services", 68 "System Name", 69 "Contact Person", 70 }; 71 static boolean[] attributes_readonly = {false, 72 false, 73 false, 74 false, 75 true, 77 false, 78 false, 79 true, 80 true, 81 true, 82 true, 83 false, 85 false, 86 false, 87 false, 88 false, 89 false, 90 false, 91 false, 92 false, 93 false, 94 true, 95 true }; 96 97 98 static int SYSNAME_POS = 21; 102 static int CONTACT_POS = 22; 103 104 105 public VisualIpNode(String key) { 106 107 super(key); 108 leafIcon = new ImageIcon ( 109 VisualIpNode.class.getResource("images/ipnode_icon.gif")); 110 111 nodeIcon = new ImageIcon ( 112 VisualIpNode.class.getResource("images/ipnode_icon.gif")); 113 114 } 115 116 public Object [] translate_values( ManagedObjectValueType original_value_type) { 117 118 if (original_value_type == null) 119 return new Object [0]; 120 121 Object [] mo_values = super.translate_values(original_value_type); 122 Object [] values = new Object [attributes_name.length]; 123 124 int i = 0; 127 for (i = 0 ; i < mo_values.length; i++) { 128 values[i] = mo_values[i]; 129 } 131 132 for (int k = i; k < values.length; k++) 133 values[k] = "unspecified"; 134 135 IpNodeValueType value_type = (IpNodeValueType) original_value_type; 136 137 String domainName = value_type.domainName; 138 if (domainName != null && domainName.length() > 0) 139 values[i] = new String (domainName); 140 i++; 141 142 String hostname = value_type.hostname; 143 if (hostname != null && hostname.length() > 0) 144 values[i] = new String (hostname); 145 i++; 146 147 if (value_type.managementIPAddress.length > 0) 148 values[i] = new String (value_type.managementIPAddress); 149 i++; 150 151 values[i] = String.valueOf(value_type.supportedSnmpVersions); 152 i++; 153 154 values[i] = String.valueOf(value_type.snmpPort); 155 i++; 156 values[i] = String.valueOf(value_type.ifNumber); 157 i++; 158 159 String sysDescr = value_type.sysDescr; 160 if (sysDescr != null && sysDescr.length() > 0) 161 values[i] = new String (sysDescr); 162 i++; 163 164 String sysObjectID = value_type.sysObjectID; 165 if (sysObjectID != null && sysDescr.length() > 0) 166 values[i] = new String (sysObjectID); 167 i++; 168 169 values[i] = String.valueOf(value_type.sysUpTime); 170 i++; 171 172 values[i] = SysServicesParser.parseSysServices(value_type.sysServices); 174 i++; 175 176 String sysName = value_type.sysName; 177 if (sysName != null && sysName.length() > 0) 178 values[i] = new String (sysName); 179 i++; 180 181 String sysContact = value_type.sysContact; 182 if (sysContact != null && sysContact.length() > 0) 183 values[i] = new String (sysContact); 184 i++; 185 186 return values; 187 } 188 189 public Vector translate_updates(Hashtable values) { 190 191 System.err.println("Translate has been called on VisualIpNode!"); 192 Vector updates = super.translate_updates(values); 193 org.omg.CosNaming.NameComponent [] objectName = Utils.string2name(key); 194 195 if (values.containsKey(attributes_name[SYSNAME_POS])) { 196 197 String attr_value = (String ) values.get(attributes_name[SYSNAME_POS]); 198 Object [] arg_val = {objectName, attr_value}; 199 InvokeSetData data_set = new InvokeSetData(emsClassName, 200 "sysNameSet", 201 arg_val 202 ); 203 updates.add(data_set); 204 } 205 206 if (values.containsKey(attributes_name[CONTACT_POS])) { 207 208 String attr_value = (String ) values.get(attributes_name[CONTACT_POS]); 209 Object [] arg_val = {objectName, attr_value}; 210 InvokeSetData data_set = new InvokeSetData(emsClassName, 211 "sysContactSet", 212 arg_val 213 ); 214 updates.add(data_set); 215 } 216 return updates; 217 } 218 219 } 220 | Popular Tags |