KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmsMibComponents > LogicalInterfaceProviderMonolithicImpl


1 /*====================================================================
2 Tnis file was produced by the OpenCCM ir3_jimpl generator.
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 USA
18 Initial developer(s): Philippe Merle, Mathieu Vadet.
19 Contributor(s): Sylvain Leblanc_______________________.
20 ====================================================================*/

21
22 package ist.coach.coachEmsMibComponents;
23
24 import intt.itu.itut_x780.UIDType;
25 import intt.itu.itut_x780.CreateError;
26 import intt.itu.itut_x780.ApplicationError;
27 import intt.itu.itut_x780.AttributeValueChangeType;
28 import intt.itu.itut_x780.AttributeValueType;
29 import intt.itu.itut_x780.SourceIndicatorType;
30 import intt.itu.itut_x780.OperationalStateTypeHelper;
31 import intt.itu.itut_x780.OperationalStateType;
32
33 import ist.coach.coachEmfCommon.Utils;
34 import ist.coach.coachEmfCommon.StateChangedEventImpl;
35 import ist.coach.coachEmfCommon.StateChangedEventImpl;
36 import ist.coach.coachEmfCommon.ObjectCreationImpl;
37 import ist.coach.coachEmfCommon.ObjectDeletionImpl;
38 import ist.coach.coachEmfCommon.ExceptionMessages;
39 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
40 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
41 import ist.coach.coachEmfCommon.DataTypeImpl;
42 import ist.coach.coachEmfServices.SnmpAdapter.DataType;
43 import ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError;
44
45 import ist.coach.coachEmsMib.LogicalInterfaceValueType;
46 import ist.coach.coachEmsMib.LogicalInterface_F;
47 import ist.coach.coachEmsMibComponents.LogicalInterfaceProviderHelper;
48
49 import ist.coach.coachEmsCommon.LogicalInterfaceValueTypeImpl;
50
51 import org.omg.CosNaming.NameComponent JavaDoc;
52 import org.omg.CORBA.TCKind JavaDoc;
53
54 import org.opennms.protocols.snmp.SnmpSMI;
55
56 import java.util.Hashtable JavaDoc;
57
58 /**
59  ** Implementation skeleton class for the ::coachEmsMibComponents::LogicalInterfaceProvider component.
60  ** Business operations MUST be completed !!!
61  **/

62 public class LogicalInterfaceProviderMonolithicImpl
63        extends org.omg.CORBA.LocalObject JavaDoc
64        implements CCM_LogicalInterfaceProvider,
65                   ist.coach.coachEmsMibComponents.CCM_LogicalInterfaceMgmt,
66                   ist.coach.coachEmfServices.SnmpAdapter.CCM_TrapCallback,
67                   org.omg.Components.SessionComponent
68 {
69     // ==================================================================
70
//
71
// Internal State.
72
//
73
// ===================================================================
74
/**
75      ** Context reference.
76      **/

77     private CCM_LogicalInterfaceProvider_Context the_context_;
78
79     org.omg.CORBA.ORB JavaDoc orb = null;
80     private String JavaDoc _facade_name;
81
82     private Hashtable JavaDoc elements;
83     private int notifId = 1100;
84
85     public static final String JavaDoc IF_TABLE_OID = ".1.3.6.1.2.1.2.2";
86
87     private static final String JavaDoc IF_DESCR_OID = ".1.3.6.1.2.1.2.2.1.2";
88     private static final String JavaDoc IF_TYPE_OID = ".1.3.6.1.2.1.2.2.1.3";
89     private static final String JavaDoc IF_MTU_OID = ".1.3.6.1.2.1.2.2.1.4";
90     private static final String JavaDoc IF_SPEED_OID = ".1.3.6.1.2.1.2.2.1.5";
91     private static final String JavaDoc IF_PHYSADDR_OID = ".1.3.6.1.2.1.2.2.1.6";
92     private static final String JavaDoc IF_ADMINSTATUS_OID = ".1.3.6.1.2.1.2.2.1.7";
93     private static final String JavaDoc IF_OPERSTATUS_OID = ".1.3.6.1.2.1.2.2.1.8";
94     private static final String JavaDoc IF_LASTCHANGE_OID = ".1.3.6.1.2.1.2.2.1.9";
95     private static final String JavaDoc IF_INOCTETS_OID = ".1.3.6.1.2.1.2.2.1.10";
96     private static final String JavaDoc IF_INUCASTPKTS_OID = ".1.3.6.1.2.1.2.2.1.11";
97     private static final String JavaDoc IF_INNUCASTPKTS_OID = ".1.3.6.1.2.1.2.2.1.12";
98     private static final String JavaDoc IF_INDISCARDS_OID = ".1.3.6.1.2.1.2.2.1.13";
99     private static final String JavaDoc IF_INERRORS_OID = ".1.3.6.1.2.1.2.2.1.14";
100     private static final String JavaDoc IF_INUNKNOWNPROTOS_OID = ".1.3.6.1.2.1.2.2.1.15";
101     private static final String JavaDoc IF_OUTOCTETS_OID = ".1.3.6.1.2.1.2.2.1.16";
102     private static final String JavaDoc IF_OUTUCASTPKTS_OID = ".1.3.6.1.2.1.2.2.1.17";
103     private static final String JavaDoc IF_OUTNUCASTPKTS_OID = ".1.3.6.1.2.1.2.2.1.18";
104     private static final String JavaDoc IF_OUTDISCARDS_OID = ".1.3.6.1.2.1.2.2.1.19";
105     private static final String JavaDoc IF_OUTERRORS_OID = ".1.3.6.1.2.1.2.2.1.20";
106     private static final String JavaDoc IF_OUTQLEN_OID = ".1.3.6.1.2.1.2.2.1.21";
107     private static final String JavaDoc IF_SPECIFIC_OID = ".1.3.6.1.2.1.2.2.1.22";
108
109     private static final String JavaDoc TIME_OID = ".1.3.6.1.2.1.1.3.0";
110     private static final int COACH_LINK_UP = 2;
111     private static final int COACH_LINK_DOWN = 3;
112
113     private static final String JavaDoc IF_LAST_CHANGE_PACKAGE = "ifLastChangePackage";
114     private static final String JavaDoc IF_ADMIN_STATUS_PACKAGE = "ifAdminStatusPackage";
115     private static final String JavaDoc OPERATIONAL_STATE_PACKAGE = "operationalStatePackage";
116     private static final String JavaDoc NON_UCAST_PACKAGE = "ifNUcastPackage";
117     private static final String JavaDoc UNKNOWN_PROTOS_PACKAGE = "ifUnknownProtosPackage";
118
119     private static final String JavaDoc READ_COMMUNITY = "public";
120     private static final String JavaDoc WRITE_COMMUNITY = "private";
121     //private static final int SNMP_PORT = 161;
122

123     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
124     ist.coach.coachEmfServices.SnmpAdapter.SnmpTrapDaemon config = null;
125
126     // ==================================================================
127
//
128
// Constructor.
129
//
130
// ===================================================================
131
/**
132      ** The default constructor.
133      **/

134     public
135     LogicalInterfaceProviderMonolithicImpl()
136     {
137         the_context_ = null;
138
139         this.elements = new Hashtable JavaDoc();
140     }
141     // ==================================================================
142
//
143
// Internal methods.
144
//
145
// ===================================================================
146

147
148     // ==================================================================
149
//
150
// Public methods.
151
//
152
// ===================================================================
153
/**
154      ** To obtain the context.
155      **
156      ** @return The context that has been previously set by
157      ** the set_session_context operation.
158      **/

159     public CCM_LogicalInterfaceProvider_Context
160     getContext()
161     {
162         return the_context_;
163     }
164     // ==================================================================
165
//
166
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
167
//
168
// ==================================================================
169
//
170
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
171
//
172
/**
173      ** Completes the component configuration.
174      **
175      ** @throws org.omg.Components.InvalidConfiguration
176      ** Thrown if the configuration is invalid.
177      **/

178     public void
179     configuration_complete()
180     throws org.omg.Components.InvalidConfiguration
181     {
182         //
183
// DONE : implement !!!
184
//
185

186         if ((connector = the_context_.get_connection_connector()) == null)
187             throw new org.omg.Components.InvalidConfiguration();
188
189         if ((config = the_context_.get_connection_config()) == null)
190             throw new org.omg.Components.InvalidConfiguration();
191
192         orb = org.objectweb.ccm.CORBA.TheORB.getORB();
193         System.err.println("LogicalInterface configuration completed...");
194
195
196     }
197     // ==================================================================
198
//
199
// Methods for the OMG IDL Components::SessionComponent local interface.
200
//
201
// ==================================================================
202
//
203
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
204
//
205
/**
206      * Called by the container when the component session context will be fixed.
207      *
208      * @param context The session context.
209      *
210      * @throws org.omg.Components.CCMException
211      * Thrown if a system level error occured.
212      */

213     public void
214     set_session_context(org.omg.Components.SessionContext context)
215     throws org.omg.Components.CCMException
216     {
217         the_context_ = (CCM_LogicalInterfaceProvider_Context)context;
218     }
219     //
220
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
221
//
222
/**
223      *
224      * Called by the container when the component will be activated.
225      *
226      * @throws org.omg.Components.CCMException
227      * Thrown if a system level error occured.
228      */

229     public void
230     ccm_activate()
231     throws org.omg.Components.CCMException
232     {
233         //
234
// Unused by actual OpenCCM containers
235
//
236
}
237     //
238
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
239
//
240
/**
241      *
242      * Called by the container when the component will be passivated.
243      *
244      * @throws org.omg.Components.CCMException
245      * Thrown if a system level error occured.
246      */

247     public void
248     ccm_passivate()
249     throws org.omg.Components.CCMException
250     {
251         //
252
// Unused by actual OpenCCM containers
253
//
254
}
255     //
256
// IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
257
//
258
/**
259      *
260      * Called by the container when the component will be removed.
261      *
262      * @throws org.omg.Components.CCMException
263      * Thrown if a system level error occured.
264      */

265     public void
266     ccm_remove()
267     throws org.omg.Components.CCMException
268     {
269         //
270
// TO DO: implement !!!
271
//
272
}
273     // ==================================================================
274
//
275
// Public methods for the CCM_LogicalInterfaceProvider local interface.
276
//
277
// ==================================================================
278
//
279
// IDL:coach.ist/coachEmsMibComponents/CCM_LogicalInterfaceProvider/get_mgmt:1.0
280
//
281
/**
282      ** Implementation of the ::coachEmsMibComponents::CCM_LogicalInterfaceProvider::get_mgmt operation.
283      **/

284     public ist.coach.coachEmsMibComponents.CCM_LogicalInterfaceMgmt
285     get_mgmt()
286     {
287         return this;
288     }
289     //
290
// IDL:coach.ist/coachEmsMibComponents/CCM_LogicalInterfaceProvider/get_snmp_callback:1.0
291
//
292
/**
293      ** Implementation of the ::coachEmsMibComponents::CCM_LogicalInterfaceProvider::get_snmp_callback operation.
294      **/

295     public ist.coach.coachEmfServices.SnmpAdapter.CCM_TrapCallback
296     get_snmp_callback()
297     {
298         return this;
299     }
300     //
301
// IDL:coach.ist/itut_x780Components/CCM_NamedComponent_Executor/facade_name:1.0
302
//
303
/**
304      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as accessor operation.
305      **/

306     public java.lang.String JavaDoc
307     facade_name()
308     {
309         //
310
// DONE : implement
311
//
312
return _facade_name;
313     }
314
315     /**
316      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as mutator operation.
317      **/

318     public void
319     facade_name(java.lang.String JavaDoc val)
320     {
321         //
322
// DONE : implement
323
//
324

325         if (val != null)
326             _facade_name = new String JavaDoc(val);
327     }
328     //
329
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifIndexGet:1.0
330
//
331
/**
332      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifIndexGet operation.
333      **/

334     public int
335     ifIndexGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
336     {
337         //
338
// DONE : implement
339
//
340

341         //HACK: ApplicationError not declared to be thrown...
342

343         String JavaDoc key = Utils.name2string(name);
344
345         if (this.elements.containsKey(key) == false) {
346         /* ApplicationErrorInfoTypeImpl error_code =
347                 new ApplicationErrorInfoTypeImpl();
348
349             error_code.error = new UIDType(
350                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
351                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
352
353             error_code.details = new String("object with name " +
354                 key + " does not exist.");
355
356             throw new ApplicationError(error_code);*/

357
358             return -1;
359         }
360
361         LogicalInterfaceDataStructure data =
362             (LogicalInterfaceDataStructure) this.elements.get(key);
363
364         return data.ifIndex;
365     }
366
367     //
368
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifDescrGet:1.0
369
//
370
/**
371      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifDescrGet operation.
372      **/

373     public java.lang.String JavaDoc
374     ifDescrGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
375     throws intt.itu.itut_x780.ApplicationError
376     {
377         //
378
// DONE : implement
379
//
380

381         String JavaDoc key = Utils.name2string(name);
382
383         if (this.elements.containsKey(key) == false) {
384             ApplicationErrorInfoTypeImpl error_code =
385                 new ApplicationErrorInfoTypeImpl();
386
387             error_code.error = new UIDType(
388                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
389                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
390
391             error_code.details = new String JavaDoc("object with name " +
392                 key + " does not exist.");
393
394             throw new ApplicationError(error_code);
395         }
396
397         LogicalInterfaceDataStructure data =
398             (LogicalInterfaceDataStructure) this.elements.get(key);
399
400         int ifIndex = data.ifIndex;
401
402         String JavaDoc ifDescrOid = new String JavaDoc(IF_DESCR_OID + "." + ifIndex);
403
404         DataType ifDescrData = null;
405
406         //HACK: Snmp Port, Read community are hard coded...
407

408         try {
409             ifDescrData = this.connector.get(
410                 ifDescrOid,
411                 new String JavaDoc (data.mgmtIpAddress),
412                 data.getSnmpPort(),
413                 READ_COMMUNITY);
414         }
415         catch (SnmpApplicationError e) {
416
417             ApplicationErrorInfoTypeImpl error_code =
418                 new ApplicationErrorInfoTypeImpl();
419
420             error_code.error = new UIDType(
421                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
422                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
423
424             if (e.reason.equals(ExceptionMessages.agent_response_error))
425                 error_code.details = ExceptionMessages.agent_response_error;
426             else
427                 error_code.details = new String JavaDoc ("Could not retrieve ifDescr " +
428                     "for LogicalInterface Object with name " + key + ":" +
429                     " Object with Snmp Object Identifier " + ifDescrOid +
430                     " does not exist.");
431             throw new ApplicationError (error_code);
432         }
433
434         org.omg.CORBA.Any JavaDoc value = ifDescrData.value;
435
436         //if (value.type().kind().value() != TCKind._tk_string) {
437
if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
438             ApplicationErrorInfoTypeImpl error_code =
439                 new ApplicationErrorInfoTypeImpl();
440
441             error_code.error = new UIDType(
442                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
443                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
444
445             error_code.details = new String JavaDoc ("Could not retrieve ifDescr " +
446                 "for LogicalInterface Object with name " + key + ":" +
447                 " Object with Snmp Object Identifier " + ifDescrOid +
448                 " is not of expected type.");
449
450             throw new ApplicationError (error_code);
451
452         }
453         //by digi
454
//String ifDescr = value.extract_string();
455
String JavaDoc ifDescr = new String JavaDoc(org.omg.CORBA.OctetSeqHelper.extract(value));
456         return ifDescr;
457
458     }
459     //
460
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifTypeGet:1.0
461
//
462
/**
463      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifTypeGet operation.
464      **/

465     public int
466     ifTypeGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
467     throws intt.itu.itut_x780.ApplicationError
468     {
469         //
470
// DONE : implement
471
//
472

473         String JavaDoc key = Utils.name2string(name);
474
475         if (this.elements.containsKey(key) == false) {
476             ApplicationErrorInfoTypeImpl error_code =
477                 new ApplicationErrorInfoTypeImpl();
478
479             error_code.error = new UIDType(
480                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
481                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
482
483             error_code.details = new String JavaDoc("object with name " +
484                 key + " does not exist.");
485
486             throw new ApplicationError(error_code);
487         }
488
489         LogicalInterfaceDataStructure data =
490             (LogicalInterfaceDataStructure) this.elements.get(key);
491
492         int ifIndex = data.ifIndex;
493
494         String JavaDoc ifTypeOid = new String JavaDoc(IF_TYPE_OID + "." + ifIndex);
495
496         DataType ifTypeData = null;
497
498         //HACK: Snmp Port, Read community are hard coded...
499

500         try {
501             ifTypeData = this.connector.get(
502                 ifTypeOid,
503                 new String JavaDoc (data.mgmtIpAddress),
504                 data.getSnmpPort(),
505                 READ_COMMUNITY);
506         }
507         catch (SnmpApplicationError e) {
508
509             ApplicationErrorInfoTypeImpl error_code =
510                 new ApplicationErrorInfoTypeImpl();
511
512             error_code.error = new UIDType(
513                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
514                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
515
516             if (e.reason.equals(ExceptionMessages.agent_response_error))
517                 error_code.details = ExceptionMessages.agent_response_error;
518             else
519                 error_code.details = new String JavaDoc ("Could not retrieve ifType " +
520                     "for LogicalInterface Object with name " + key + ":" +
521                     " Object with Snmp Object Identifier " + ifTypeOid +
522                     " does not exist.");
523             throw new ApplicationError (error_code);
524         }
525
526         org.omg.CORBA.Any JavaDoc value = ifTypeData.value;
527
528         if (value.type().kind().value() != TCKind._tk_long) {
529
530             ApplicationErrorInfoTypeImpl error_code =
531                 new ApplicationErrorInfoTypeImpl();
532
533             error_code.error = new UIDType(
534                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
535                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
536
537             error_code.details = new String JavaDoc ("Could not retrieve ifType " +
538                 "for LogicalInterface Object with name " + key + ":" +
539                 " Object with Snmp Object Identifier " + ifTypeOid +
540                 " is not of type integer, as expected.");
541
542             throw new ApplicationError (error_code);
543
544         }
545
546         int ifType = value.extract_long();
547
548         return ifType;
549     }
550     //
551
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifMtuGet:1.0
552
//
553
/**
554      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifMtuGet operation.
555      **/

556     public int
557     ifMtuGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
558     throws intt.itu.itut_x780.ApplicationError
559     {
560         //
561
// DONE : implement
562
//
563
String JavaDoc key = Utils.name2string(name);
564
565         if (this.elements.containsKey(key) == false) {
566             ApplicationErrorInfoTypeImpl error_code =
567                 new ApplicationErrorInfoTypeImpl();
568
569             error_code.error = new UIDType(
570                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
571                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
572
573             error_code.details = new String JavaDoc("object with name " +
574                 key + " does not exist.");
575
576             throw new ApplicationError(error_code);
577         }
578
579         LogicalInterfaceDataStructure data =
580             (LogicalInterfaceDataStructure) this.elements.get(key);
581
582         int ifIndex = data.ifIndex;
583
584         String JavaDoc ifMtuOid = new String JavaDoc(IF_MTU_OID + "." + ifIndex);
585
586         DataType ifMtuData = null;
587
588         //HACK: Snmp Port, Read community are hard coded...
589

590         try {
591
592             ifMtuData = this.connector.get(
593                 ifMtuOid,
594                 new String JavaDoc (data.mgmtIpAddress),
595                 data.getSnmpPort(),
596                 READ_COMMUNITY);
597         }
598         catch (SnmpApplicationError e) {
599
600             ApplicationErrorInfoTypeImpl error_code =
601                 new ApplicationErrorInfoTypeImpl();
602
603             error_code.error = new UIDType(
604                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
605                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
606
607             if (e.reason.equals(ExceptionMessages.agent_response_error))
608                 error_code.details = ExceptionMessages.agent_response_error;
609             else
610                 error_code.details = new String JavaDoc ("Could not retrieve ifMtu " +
611                     "for LogicalInterface Object with name " + key + ":" +
612                     " Object with Snmp Object Identifier " + ifMtuOid +
613                     " does not exist.");
614             throw new ApplicationError (error_code);
615         }
616
617         org.omg.CORBA.Any JavaDoc value = ifMtuData.value;
618
619         if (value.type().kind().value() != TCKind._tk_long) {
620
621             ApplicationErrorInfoTypeImpl error_code =
622                 new ApplicationErrorInfoTypeImpl();
623
624             error_code.error = new UIDType(
625                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
626                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
627
628             error_code.details = new String JavaDoc ("Could not retrieve ifMtu " +
629                 "for LogicalInterface Object with name " + key + ":" +
630                 " Object with Snmp Object Identifier " + ifMtuOid +
631                 " is not of type integer, as expected.");
632
633             throw new ApplicationError (error_code);
634
635         }
636
637         int ifMtu = value.extract_long();
638
639         return ifMtu;
640     }
641     //
642
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifSpeedGet:1.0
643
//
644
/**
645      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifSpeedGet operation.
646      **/

647     public long
648     ifSpeedGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
649     throws intt.itu.itut_x780.ApplicationError
650     {
651         //
652
// DONE : implement
653
//
654
String JavaDoc key = Utils.name2string(name);
655
656         if (this.elements.containsKey(key) == false) {
657             ApplicationErrorInfoTypeImpl error_code =
658                 new ApplicationErrorInfoTypeImpl();
659
660             error_code.error = new UIDType(
661                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
662                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
663
664             error_code.details = new String JavaDoc("object with name " +
665                 key + " does not exist.");
666
667             throw new ApplicationError(error_code);
668         }
669
670         LogicalInterfaceDataStructure data =
671             (LogicalInterfaceDataStructure) this.elements.get(key);
672
673         int ifIndex = data.ifIndex;
674
675         String JavaDoc ifSpeedOid = new String JavaDoc(IF_SPEED_OID + "." + ifIndex);
676
677         DataType ifSpeedData = null;
678
679         //HACK: Snmp Port, Read community are hard coded...
680

681         try {
682             ifSpeedData = this.connector.get(
683                 ifSpeedOid,
684                 new String JavaDoc (data.mgmtIpAddress),
685                 data.getSnmpPort(),
686                 READ_COMMUNITY);
687         }
688         catch (SnmpApplicationError e) {
689
690             ApplicationErrorInfoTypeImpl error_code =
691                 new ApplicationErrorInfoTypeImpl();
692
693             error_code.error = new UIDType(
694                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
695                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
696
697             if (e.reason.equals(ExceptionMessages.agent_response_error))
698                 error_code.details = ExceptionMessages.agent_response_error;
699             else
700                 error_code.details = new String JavaDoc ("Could not retrieve ifMtu " +
701                     "for LogicalInterface Object with name " + key + ":" +
702                     " Object with Snmp Object Identifier " + ifSpeedOid +
703                     " does not exist.");
704             throw new ApplicationError (error_code);
705         }
706
707         org.omg.CORBA.Any JavaDoc value = ifSpeedData.value;
708
709         if (value.type().kind().value() != TCKind._tk_longlong) {
710
711             ApplicationErrorInfoTypeImpl error_code =
712                 new ApplicationErrorInfoTypeImpl();
713
714             error_code.error = new UIDType(
715                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
716                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
717
718             error_code.details = new String JavaDoc ("Could not retrieve ifSpeed " +
719                 "for LogicalInterface Object with name " + key + ":" +
720                 " Object with Snmp Object Identifier " + ifSpeedOid +
721                 " is not of type integer, as expected.");
722
723             throw new ApplicationError (error_code);
724
725         }
726
727         long ifSpeed = value.extract_longlong();
728
729         return ifSpeed;
730     }
731     //
732
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifPhysAddressGet:1.0
733
//
734
/**
735      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifPhysAddressGet operation.
736      **/

737     public byte[]
738     ifPhysAddressGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
739     throws intt.itu.itut_x780.ApplicationError
740     {
741         //
742
// DONE : implement
743
//
744
String JavaDoc key = Utils.name2string(name);
745
746         if (this.elements.containsKey(key) == false) {
747             ApplicationErrorInfoTypeImpl error_code =
748                 new ApplicationErrorInfoTypeImpl();
749
750             error_code.error = new UIDType(
751                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
752                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
753
754             error_code.details = new String JavaDoc("object with name " +
755                 key + " does not exist.");
756
757             throw new ApplicationError(error_code);
758         }
759
760         LogicalInterfaceDataStructure data =
761             (LogicalInterfaceDataStructure) this.elements.get(key);
762
763         int ifIndex = data.ifIndex;
764
765         String JavaDoc ifPhysAddrOid = new String JavaDoc(IF_PHYSADDR_OID + "." + ifIndex);
766
767         DataType ifPhysAddrData = null;
768
769         //HACK: Snmp Port, Read community are hard coded...
770

771         try {
772             ifPhysAddrData = this.connector.get(
773                 ifPhysAddrOid,
774                 new String JavaDoc (data.mgmtIpAddress),
775                 data.getSnmpPort(),
776                 READ_COMMUNITY);
777         }
778         catch (SnmpApplicationError e) {
779
780             ApplicationErrorInfoTypeImpl error_code =
781                 new ApplicationErrorInfoTypeImpl();
782
783             error_code.error = new UIDType(
784                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
785                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
786
787             if (e.reason.equals(ExceptionMessages.agent_response_error))
788                 error_code.details = ExceptionMessages.agent_response_error;
789             else
790                 error_code.details = new String JavaDoc ("Could not retrieve ifPhysAddr " +
791                     "for LogicalInterface Object with name " + key + ":" +
792                     " Object with Snmp Object Identifier " + ifPhysAddrOid +
793                     " does not exist.");
794             throw new ApplicationError (error_code);
795         }
796
797         org.omg.CORBA.Any JavaDoc value = ifPhysAddrData.value;
798
799         //if (value.type().kind().value() != TCKind._tk_string) {
800
if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
801             ApplicationErrorInfoTypeImpl error_code =
802                 new ApplicationErrorInfoTypeImpl();
803
804             error_code.error = new UIDType(
805                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
806                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
807
808             error_code.details = new String JavaDoc ("Could not retrieve ifPhysAddr " +
809                 "for LogicalInterface Object with name " + key + ":" +
810                 " Object with Snmp Object Identifier " + ifPhysAddrOid +
811                 " is not of expected type.");
812
813             throw new ApplicationError (error_code);
814
815         }
816         //by digi
817
//String ifPhysAddr = value.extract_string();
818
//return ifPhysAddr.getBytes();
819

820         byte [] ifPhysAddr = org.omg.CORBA.OctetSeqHelper.extract(value);
821         return ifPhysAddr;
822     }
823     //
824
// IDL:coach.ist/coachEmsMib/LogicalInterface_F/ifAdminStatusGet:1.0
825
//
826
/**
827      ** Implementation of the ::coachEmsMib::LogicalInterface_F::ifAdminStatusGet operation.
828      **/

829     public int
830     ifAdminStatusGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
831     throws intt.itu.itut_x780.ApplicationError
832     {
833         //
834
// DONE : implement
835
//
836
String JavaDoc key = Utils.name2string(name);
837
838         if (this.elements.containsKey(key) == false) {
839             ApplicationErrorInfoTypeImpl error_code =
840                 new ApplicationErrorInfoTypeImpl();
841
842  &nbs