KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmfClientComponents > gui > VisualIpRoutingEntry


1 package ist.coach.coachEmfClientComponents.gui;
2
3 import javax.swing.ImageIcon JavaDoc;
4
5 import intt.itu.itut_x780.ManagedObjectValueType;
6 import ist.coach.coachEmsMib.IpRoutingEntryValueType;
7 import ist.coach.coachEmfClientComponents.InvokeSetData;
8
9 import ist.coach.coachEmfCommon.Utils;
10 public class VisualIpRoutingEntry
11 extends MOTreeObject {
12
13     static String JavaDoc[] subordinate_names = new String JavaDoc[0];
14
15     static boolean canRefresh = false;
16     static String JavaDoc object_type = "IpRoutingEntry";
17     static String JavaDoc emsClassName = "ist.coach.coachEmsMib.IpRoutingEntry_F";
18
19     static String JavaDoc DISPLAY_TYPE = "IP Routing Entry";
20
21     //
22
// create arguments
23
//
24
static String JavaDoc[] create_arg_name = new String JavaDoc[0];
25     static String JavaDoc[] create_arg_editor = new String JavaDoc[0];
26     static String JavaDoc[] create_arg_renderer = new String JavaDoc[0];
27     //
28
// get/set arguments
29
//
30

31     static String JavaDoc[] attributes_name = { //ManagedObject
32
"Name",
33                                         "Element Type",
34                                         "Creation Source",
35                                         "Delete Policy",
36                                             //IpRoutingEntry
37
"Destination IP Address",
38                                         "Logical Interface Index",
39                                         "Primary Routing Metric",
40                                         "Alternate Routing Metric",
41                                         "Alternate Routing Metric",
42                                         "Alternate Routing Metric",
43                                         "IP Address of Next Hop",
44                                         "Type of Route",
45                                         "Routing Protocol",
46                                         "Seconds since Last Update",
47                                         "Subnet Mask",
48                                         "Alternate Routing Metric",
49                                         "MIB Object Identifier"
50
51                     };
52
53      static boolean[] attributes_readonly = {
54                           //ManagedObject
55
false,
56                     false,
57                     false,
58                     false,
59                           //IpRoutingEntry
60
false,
61                     false,
62                     false,
63                     false,
64                     false,
65                     false,
66                     false,
67                     false,
68                     false,
69                     false,
70                     false,
71                     false,
72                     false
73
74     };
75
76     public VisualIpRoutingEntry(String JavaDoc key) {
77         super(key);
78         leafIcon = new ImageIcon JavaDoc(VisualIpRoutingEntry.class.getResource(
79                 "images/iproutingentry_icon.gif"));
80         nodeIcon = new ImageIcon JavaDoc(VisualIpRoutingEntry.class.getResource(
81                 "images/iproutingentry_icon.gif"));
82          toolTipText = new String JavaDoc(DISPLAY_TYPE);
83     }
84
85     public Object JavaDoc[] translate_values(ManagedObjectValueType original_value_type) {
86
87         Object JavaDoc[] values = new Object JavaDoc[attributes_name.length];
88         for (int i = 0; i < values.length; i++)
89             values[i] = "unspecified";
90
91         if (original_value_type == null)
92             return values;
93
94         Object JavaDoc[] mo_values = super.translate_values(original_value_type);
95         int i = 0;
96         for (i = 0; i < mo_values.length; i++)
97             values[i] = mo_values[i];
98
99         IpRoutingEntryValueType value_type;
100         value_type = (IpRoutingEntryValueType) original_value_type;
101
102         if (value_type.ipRouteDest != null && value_type.ipRouteDest.length > 0)
103           values[i] = new String JavaDoc(value_type.ipRouteDest);
104         i++;
105
106         values[i++] = String.valueOf(value_type.ipRouteIfIndex);
107         values[i++] = String.valueOf(value_type.ipRouteMetric1);
108
109         if (value_type.ipRouteMetric2 > 0)
110           values[i] = String.valueOf(value_type.ipRouteMetric2);
111         i++;
112
113         if (value_type.ipRouteMetric3 > 0)
114           values[i] = String.valueOf(value_type.ipRouteMetric3);
115         i++;
116
117         if (value_type.ipRouteMetric4 > 0)
118           values[i] = String.valueOf(value_type.ipRouteMetric4);
119         i++;
120
121         if (value_type.ipRouteNextHop != null && value_type.ipRouteNextHop.length > 0)
122           values[i] = new String JavaDoc(value_type.ipRouteNextHop);
123         i++;
124
125         //values[i++] = String.valueOf(value_type.ipRouteType);
126
switch(value_type.ipRouteType) {
127         case 1:
128             values[i] = new String JavaDoc("Other (neither direct/indirect/invalid)");
129             break;
130         case 2:
131             values[i] = new String JavaDoc("Invalidated Route");
132             break;
133         case 3:
134             values[i] = new String JavaDoc("Route to directly connected sub-network");
135             break;
136         case 4:
137             values[i] = new String JavaDoc("Route to a non-local host/network/sub-network");
138             break;
139         default:
140             break;
141         }
142         i++;
143
144         //values[i++] = String.valueOf(value_type.ipRouteProto);
145
switch(value_type.ipRouteProto) {
146         case 1:
147             values[i] = new String JavaDoc("Other (neither local/setted by management/routing protocol)");
148             break;
149         case 2:
150             values[i] = new String JavaDoc("Local (manually configured)");
151             break;
152         case 3:
153             values[i] = new String JavaDoc("Set via management protocol");
154             break;
155         case 4:
156             values[i] = new String JavaDoc("ICMP obtained");
157             break;
158         case 5:
159             values[i] = new String JavaDoc("EGP gateway routing protocol");
160             break;
161         case 6:
162             values[i] = new String JavaDoc("GGP gateway routing protocol");
163             break;
164         case 7:
165             values[i] = new String JavaDoc("HELLO gateway routing protocol");
166             break;
167         case 8:
168             values[i] = new String JavaDoc("RIP gateway routing protocol");
169             break;
170         case 9:
171             values[i] = new String JavaDoc("IS-IS gateway routing protocol");
172             break;
173         case 10:
174             values[i] = new String JavaDoc("ES-IS ateway routing protocol");
175             break;
176         case 11:
177             values[i] = new String JavaDoc("CISCO IGRP gateway routing protocol");
178             break;
179         case 12:
180             values[i] = new String JavaDoc("BbnSpfIGP gateway routing protocol");
181             break;
182         case 13:
183             values[i] = new String JavaDoc("OSPF gateway routing protocol");
184             break;
185         case 14:
186             values[i] = new String JavaDoc("BGP gateway routing protocol");
187             break;
188         default:
189             break;
190         }
191         i++;
192         if (value_type.ipRouteAge > 0)
193           values[i] = String.valueOf(value_type.ipRouteAge);
194         i++;
195
196         if (value_type.ipRouteMask != null && value_type.ipRouteMask.length > 0)
197           values[i] = new String JavaDoc(value_type.ipRouteMask);
198         i++;
199
200         if (value_type.ipRouteMetric5 > 0)
201           values[i] = String.valueOf(value_type.ipRouteMetric5);
202         i++;
203         if (value_type.ipRouteInfo != null && value_type.ipRouteInfo.length() > 0)
204           values[i] = value_type.ipRouteInfo;
205         i++;
206
207 /**
208         switch(value_type.ipAdEntBcastAddr) {
209         case 1:
210             values[i++] = new String("Internet standard all-ones");
211             break;
212         default:
213             values[i++] = String.valueOf(value_type.ipAdEntBcastAddr);
214             break;
215         }
216
217   ****/

218
219         return values;
220     }
221
222     java.util.Vector JavaDoc translate_updates(java.util.Hashtable JavaDoc values) {
223
224         return new java.util.Vector JavaDoc();
225     }
226 }
227
Popular Tags