KickJava   Java API By Example, From Geeks To Geeks.

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


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 package ist.coach.coachEmsMibComponents;
22
23 import intt.itu.itut_x780.UIDType;
24 import intt.itu.itut_x780.CreateError;
25 import intt.itu.itut_x780.ApplicationError;
26 import intt.itu.itut_x780.ManagedObjectValueType;
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
32 import intt.itu.itut_m3120.NOuserLabelPackageException;
33 import intt.itu.itut_m3120.NOvendorNamePackageException;
34 import intt.itu.itut_m3120.NOversionPackageException;
35 import intt.itu.itut_m3120.NOlocationNamePackageException;
36
37 import ist.coach.coachEmfCommon.Utils;
38 import ist.coach.coachEmfCommon.StateChangedEventImpl;
39 import ist.coach.coachEmfCommon.ObjectCreationImpl;
40 import ist.coach.coachEmfCommon.ObjectDeletionImpl;
41 import ist.coach.coachEmfCommon.ExceptionMessages;
42 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
43 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
44 import ist.coach.coachEmfCommon.ManagedObjectValueTypeImpl;
45 import ist.coach.coachEmfCommon.DataTypeImpl;
46
47 import ist.coach.coachEmfServices.SnmpAdapter.DataType;
48 import ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError;
49
50 import ist.coach.coachEmsMib.IpNodeValueType;
51 import ist.coach.coachEmsMib.NOsysInformationSetPackageException;
52
53 import ist.coach.coachEmsCommon.IpNodeValueTypeImpl;
54 import org.omg.CosNaming.NameComponent JavaDoc;
55 import org.omg.CORBA.TCKind JavaDoc;
56
57 import org.opennms.protocols.snmp.SnmpSMI;
58
59 import java.util.Hashtable JavaDoc;
60 /**
61  ** Implementation skeleton class for the ::coachEmsMibComponents::IpNodeProvider component.
62  ** Business operations MUST be completed !!!
63  **/

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

79     org.omg.CORBA.ORB JavaDoc orb = null;
80     private CCM_IpNodeProvider_Context the_context_;
81     private String JavaDoc _facade_name;
82     private int notifId = 1000;
83
84     private static final String JavaDoc IF_NUMBER_OID = ".1.3.6.1.2.1.2.1.0";
85     private static final String JavaDoc SYS_DESCR_OID = ".1.3.6.1.2.1.1.1.0";
86     private static final String JavaDoc SYS_OBJECTID_OID = ".1.3.6.1.2.1.1.2.0";
87     private static final String JavaDoc SYS_UPTIME_OID = ".1.3.6.1.2.1.1.3.0";
88     private static final String JavaDoc SYS_CONTACT_OID = ".1.3.6.1.2.1.1.4.0";
89     private static final String JavaDoc SYS_NAME_OID = ".1.3.6.1.2.1.1.5.0";
90     private static final String JavaDoc SYS_LOCATION_OID = ".1.3.6.1.2.1.1.6.0";
91     private static final String JavaDoc SYS_SERVICES_OID = ".1.3.6.1.2.1.1.7.0";
92     private static final String JavaDoc TIME_OID = ".1.3.6.1.2.1.1.3.0";
93
94     private static final int COLDSTART_TRAP = 1;
95     private static final int NETSNMP_SHUTDOWN_TRAP = 4;
96
97     private static final String JavaDoc SYS_INFO_SET_PACKAGE = "sysInfoSetPackage";
98     private static final String JavaDoc LOCATION_NAME_PACKAGE = "locationNamePackage";
99     private static final String JavaDoc USER_LABEL_PACKAGE = "userLabelPackage";
100     private static final String JavaDoc VENDOR_NAME_PACKAGE = "vendorNamePackage";
101     private static final String JavaDoc VERSION_PACKAGE = "versionPackage";
102
103     private static final String JavaDoc READ_COMMUNITY = "public";
104     private static final String JavaDoc WRITE_COMMUNITY = "private";
105
106     private Hashtable JavaDoc elements;
107
108     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
109     ist.coach.coachEmfServices.SnmpAdapter.SnmpTrapDaemon config = null;
110     // ==================================================================
111
//
112
// Constructor.
113
//
114
// ===================================================================
115
/**
116      ** The default constructor.
117      **/

118     public
119     IpNodeProviderMonolithicImpl()
120     {
121         the_context_ = null;
122         this.elements = new Hashtable JavaDoc();
123     }
124     // ==================================================================
125
//
126
// Internal methods.
127
//
128
// ===================================================================
129

130
131     // ==================================================================
132
//
133
// Public methods.
134
//
135
// ===================================================================
136
/**
137      ** To obtain the context.
138      **
139      ** @return The context that has been previously set by
140      ** the set_session_context operation.
141      **/

142     public CCM_IpNodeProvider_Context
143     getContext()
144     {
145         return the_context_;
146     }
147     // ==================================================================
148
//
149
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
150
//
151
// ==================================================================
152
//
153
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
154
//
155
/**
156      ** Completes the component configuration.
157      **
158      ** @throws org.omg.Components.InvalidConfiguration
159      ** Thrown if the configuration is invalid.
160      **/

161     public void
162     configuration_complete()
163     throws org.omg.Components.InvalidConfiguration
164     {
165         //
166
// DONE : implement !!!
167
//
168

169     if ((connector = the_context_.get_connection_connector()) == null)
170             throw new org.omg.Components.InvalidConfiguration();
171
172     if ((config = the_context_.get_connection_config()) == null)
173             throw new org.omg.Components.InvalidConfiguration();
174
175     orb = org.objectweb.ccm.CORBA.TheORB.getORB();
176         System.err.println("IpNodeProvider configuration completed...");
177     }
178     // ==================================================================
179
//
180
// Methods for the OMG IDL Components::SessionComponent local interface.
181
//
182
// ==================================================================
183
//
184
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
185
//
186
/**
187      * Called by the container when the component session context will be fixed.
188      *
189      * @param context The session context.
190      *
191      * @throws org.omg.Components.CCMException
192      * Thrown if a system level error occured.
193      */

194     public void
195     set_session_context(org.omg.Components.SessionContext context)
196     throws org.omg.Components.CCMException
197     {
198         the_context_ = (CCM_IpNodeProvider_Context)context;
199     }
200     //
201
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
202
//
203
/**
204      *
205      * Called by the container when the component will be activated.
206      *
207      * @throws org.omg.Components.CCMException
208      * Thrown if a system level error occured.
209      */

210     public void
211     ccm_activate()
212     throws org.omg.Components.CCMException
213     {
214         //
215
// Unused by actual OpenCCM containers
216
//
217
}
218     //
219
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
220
//
221
/**
222      *
223      * Called by the container when the component will be passivated.
224      *
225      * @throws org.omg.Components.CCMException
226      * Thrown if a system level error occured.
227      */

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

246     public void
247     ccm_remove()
248     throws org.omg.Components.CCMException
249     {
250         //
251
// TO DO: implement !!!
252
//
253
}
254     // ==================================================================
255
//
256
// Public methods for the CCM_IpNodeProvider local interface.
257
//
258
// ==================================================================
259
//
260
// IDL:coach.ist/coachEmsMibComponents/CCM_IpNodeProvider/get_mgmt:1.0
261
//
262
/**
263      ** Implementation of the ::coachEmsMibComponents::CCM_IpNodeProvider::get_mgmt operation.
264      **/

265     public ist.coach.coachEmsMibComponents.CCM_IpNodeMgmt
266     get_mgmt()
267     {
268         return this;
269     }
270     //
271
// IDL:coach.ist/coachEmsMibComponents/CCM_IpNodeProvider/get_snmp_callback:1.0
272
//
273
/**
274      ** Implementation of the ::coachEmsMibComponents::CCM_IpNodeProvider::get_snmp_callback operation.
275      **/

276     //public ist.coach.coachEmfServices.SnmpAdapter.CCM_TrapCallback
277
//get_snmp_callback()
278
//{
279
// return this;
280
// }
281
//
282
// IDL:coach.ist/itut_x780Components/CCM_NamedComponent_Executor/facade_name:1.0
283
//
284
/**
285      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as accessor operation.
286      **/

287     public java.lang.String JavaDoc
288     facade_name()
289     {
290         //
291
// DONE : implement
292
//
293
return _facade_name;
294     }
295
296     /**
297      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as mutator operation.
298      **/

299     public void
300     facade_name(java.lang.String JavaDoc val)
301     {
302         //
303
// DONE : implement
304
//
305
if (val != null)
306             _facade_name = new String JavaDoc(val);
307
308
309     }
310
311     /**
312      ** Implementation of the ManagedObject_F::nameGet operation.
313      **/

314     public NameComponent JavaDoc[] nameGet() {
315         return Utils.string2name(_facade_name);
316     }
317
318     //
319
// IDL:coach.ist/coachEmsMib/IpNode_F/domainNameGet:1.0
320
//
321
/**
322      ** Implementation of the ::coachEmsMib::IpNode_F::domainNameGet operation.
323      **/

324     public java.lang.String JavaDoc
325     domainNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
326     throws intt.itu.itut_x780.ApplicationError
327     {
328         //
329
// DONE : implement
330
//
331
String JavaDoc key = Utils.name2string(name);
332
333     if (this.elements.containsKey(key) == false) {
334         ApplicationErrorInfoTypeImpl error_code =
335             new ApplicationErrorInfoTypeImpl();
336
337         error_code.error = new UIDType(
338             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
339         intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
340
341         error_code.details = new String JavaDoc ("object with name" +
342             key + " does not exist.");
343
344         throw new ApplicationError(error_code);
345     }
346
347     IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
348
349     return data.domainName;
350     }
351     //
352
// IDL:coach.ist/coachEmsMib/IpNode_F/hostnameGet:1.0
353
//
354
/**
355      ** Implementation of the ::coachEmsMib::IpNode_F::hostnameGet operation.
356      **/

357     public java.lang.String JavaDoc
358     hostnameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
359     throws intt.itu.itut_x780.ApplicationError
360     {
361         //
362
// DONE : implement
363
//
364

365
366     String JavaDoc key = Utils.name2string(name);
367
368     if (this.elements.containsKey(key) == false) {
369         ApplicationErrorInfoTypeImpl error_code =
370             new ApplicationErrorInfoTypeImpl();
371
372     error_code.error = new UIDType(
373         intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
374         intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
375
376     error_code.details = new String JavaDoc ("object with name" +
377         key + " does not exist.");
378
379     throw new ApplicationError(error_code);
380     }
381
382     IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
383
384     return data.hostname;
385     }
386     //
387
// IDL:coach.ist/coachEmsMib/IpNode_F/managementIPAddressGet:1.0
388
//
389
/**
390      ** Implementation of the ::coachEmsMib::IpNode_F::managementIPAddressGet operation.
391      **/

392     public byte[]
393     managementIPAddressGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
394     throws intt.itu.itut_x780.ApplicationError
395     {
396         //
397
// DONE : implement
398
//
399
String JavaDoc key = Utils.name2string(name);
400
401     if (this.elements.containsKey(key) == false) {
402         ApplicationErrorInfoTypeImpl error_code =
403             new ApplicationErrorInfoTypeImpl();
404
405     error_code.error = new UIDType(
406         intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
407         intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
408
409     error_code.details = new String JavaDoc ("object with name" +
410         key + " does not exist.");
411
412     throw new ApplicationError(error_code);
413     }
414
415     IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
416
417     return data.managementIPAddress;
418
419     }
420     //
421
// IDL:coach.ist/coachEmsMib/IpNode_F/supportedSnmpVersionsGet:1.0
422
//
423
/**
424      ** Implementation of the ::coachEmsMib::IpNode_F::supportedSnmpVersionsGet operation.
425      **/

426     public int
427     supportedSnmpVersionsGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
428     throws intt.itu.itut_x780.ApplicationError
429     {
430         //
431
// DONE : implement
432
//
433

434
435     String JavaDoc key = Utils.name2string(name);
436
437     if (this.elements.containsKey(key) == false) {
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 ("object with name" +
446         key + " does not exist.");
447
448     throw new ApplicationError(error_code);
449     }
450
451     IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
452
453     return data.supportedSnmpVersions;
454     }
455     //
456
// IDL:coach.ist/coachEmsMib/IpNode_F/snmpPortGet:1.0
457
//
458
/**
459      ** Implementation of the ::coachEmsMib::IpNode_F::snmpPortGet operation.
460      **/

461     public int
462     snmpPortGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
463     throws intt.itu.itut_x780.ApplicationError
464     {
465         //
466
// DONE : implement
467
//
468
String JavaDoc key = Utils.name2string(name);
469
470     if (this.elements.containsKey(key) == false) {
471         ApplicationErrorInfoTypeImpl error_code =
472             new ApplicationErrorInfoTypeImpl();
473
474         error_code.error = new UIDType(
475             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
476         intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
477
478         error_code.details = new String JavaDoc ("object with name" +
479             key + " does not exist.");
480
481         throw new ApplicationError(error_code);
482     }
483
484     IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
485
486     return data.snmpPort;
487
488     }
489     //
490
// IDL:coach.ist/coachEmsMib/IpNode_F/ifNumberGet:1.0
491
//
492
/**
493      ** Implementation of the ::coachEmsMib::IpNode_F::ifNumberGet operation.
494      **/

495     public int
496     ifNumberGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
497     throws intt.itu.itut_x780.ApplicationError
498     {
499         //
500
// DONE : implement
501
//
502
DataType ifNumberData = null;
503
504     String JavaDoc key = Utils.name2string(name);
505
506     if (this.elements.containsKey(key) == false) {
507
508         ApplicationErrorInfoTypeImpl error_code =
509             new ApplicationErrorInfoTypeImpl();
510
511         error_code.error = new UIDType(
512             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
513             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
514
515         error_code.details = new String JavaDoc ("object with name" +
516             key + " does not exist.");
517
518         throw new ApplicationError(error_code);
519     }
520
521
522     try {
523
524         ifNumberData = this.connector.get(
525             IF_NUMBER_OID,
526             new String JavaDoc(this.managementIPAddressGet(name)),
527             this.snmpPortGet(name),
528             READ_COMMUNITY);
529     }
530     catch (SnmpApplicationError e) {
531
532         ApplicationErrorInfoTypeImpl error_code =
533             new ApplicationErrorInfoTypeImpl();
534
535         error_code.error = new UIDType(
536             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
537             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
538
539         if (e.reason.equals(ExceptionMessages.agent_response_error))
540             error_code.details = ExceptionMessages.agent_response_error;
541         else
542             error_code.details = new String JavaDoc ("Could not retrieve ifNumber " +
543                 "for IpNode Object with name " + key + ":" +
544                  " Object with Snmp Object Identifier " + IF_NUMBER_OID +
545                 " does not exist.");
546
547         throw new ApplicationError(error_code);
548
549     }
550
551     org.omg.CORBA.Any JavaDoc value = ifNumberData.value;
552
553     if(value.type().kind().value() != TCKind._tk_long) {
554
555         ApplicationErrorInfoTypeImpl error_code =
556             new ApplicationErrorInfoTypeImpl();
557
558         error_code.error = new UIDType(
559             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
560             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
561
562         error_code.details = new String JavaDoc ("Could not retrieve ifNumber " +
563              "for IpNode Object with name " + key + ":" +
564              " Object with Snmp Object Identifier " + IF_NUMBER_OID +
565              " is not of type long, as expected.");
566
567         throw new ApplicationError(error_code);
568
569     }
570
571     int ifNumber = value.extract_long();
572
573     return ifNumber;
574
575     }
576     //
577
// IDL:coach.ist/coachEmsMib/IpNode_F/sysDescrGet:1.0
578
//
579
/**
580      ** Implementation of the ::coachEmsMib::IpNode_F::sysDescrGet operation.
581      **/

582     public java.lang.String JavaDoc
583     sysDescrGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
584     throws intt.itu.itut_x780.ApplicationError
585     {
586         //
587
// DONE: implement
588
//
589

590     DataType sysDescrData = null;
591
592     String JavaDoc key = Utils.name2string(name);
593
594     if (this.elements.containsKey(key) == false) {
595
596         ApplicationErrorInfoTypeImpl error_code =
597             new ApplicationErrorInfoTypeImpl();
598
599         error_code.error = new UIDType(
600             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
601             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
602
603         error_code.details = new String JavaDoc ("object with name" +
604             key + " does not exist.");
605
606         throw new ApplicationError(error_code);
607     }
608
609
610     try {
611
612         sysDescrData = this.connector.get(
613             SYS_DESCR_OID,
614             new String JavaDoc(this.managementIPAddressGet(name)),
615             this.snmpPortGet(name),
616             READ_COMMUNITY);
617     }
618     catch (SnmpApplicationError e) {
619
620         ApplicationErrorInfoTypeImpl error_code =
621         new ApplicationErrorInfoTypeImpl();
622
623         error_code.error = new UIDType(
624             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
625             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
626
627         if (e.reason.equals(ExceptionMessages.agent_response_error))
628             error_code.details = ExceptionMessages.agent_response_error;
629         else
630             error_code.details = new String JavaDoc ("Could not retrieve sysDescr " +
631                  "for IpNode Object with name " + key + ":" +
632                  " Object with Snmp Object Identifier " + SYS_DESCR_OID +
633                  " does not exist.");
634
635         throw new ApplicationError(error_code);
636
637     }
638
639     org.omg.CORBA.Any JavaDoc value = sysDescrData.value;
640
641     //if(value.type().kind().value() != TCKind._tk_string) {
642
if(value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
643         ApplicationErrorInfoTypeImpl error_code =
644             new ApplicationErrorInfoTypeImpl();
645
646         error_code.error = new UIDType(
647             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
648             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
649
650         error_code.details = new String JavaDoc ("Could not retrieve sysDescr " +
651              "for IpNode Object with name " + key + ":" +
652              " Object with Snmp Object Identifier " + SYS_DESCR_OID +
653              " is not of type string, as expected.");
654
655         throw new ApplicationError(error_code);
656
657     }
658     String JavaDoc sysDescr = new String JavaDoc(org.omg.CORBA.OctetSeqHelper.extract(value));
659     //String sysDescr = value.extract_string();
660

661     return sysDescr;
662     }
663     //
664
// IDL:coach.ist/coachEmsMib/IpNode_F/sysObjectIDGet:1.0
665
//
666
/**
667      ** Implementation of the ::coachEmsMib::IpNode_F::sysObjectIDGet operation.
668      **/

669     public java.lang.String JavaDoc
670     sysObjectIDGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
671     throws intt.itu.itut_x780.ApplicationError
672     {
673         //
674
// DONE : implement
675
//
676

677     DataType sysObjectIDData = null;
678
679     String JavaDoc key = Utils.name2string(name);
680
681     if (this.elements.containsKey(key) == false) {
682
683         ApplicationErrorInfoTypeImpl error_code =
684             new ApplicationErrorInfoTypeImpl();
685
686         error_code.error = new UIDType(
687             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
688             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
689
690         error_code.details = new String JavaDoc ("object with name" +
691             key + " does not exist.");
692
693         throw new ApplicationError(error_code);
694     }
695
696
697     try {
698
699         sysObjectIDData = this.connector.get(
700             SYS_OBJECTID_OID,
701             new String JavaDoc(this.managementIPAddressGet(name)),
702             this.snmpPortGet(name),
703             READ_COMMUNITY);
704     }
705     catch (SnmpApplicationError e) {
706
707         ApplicationErrorInfoTypeImpl error_code =
708         new ApplicationErrorInfoTypeImpl();
709
710         error_code.error = new UIDType(
711             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
712             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
713
714         if (e.reason.equals(ExceptionMessages.agent_response_error))
715             error_code.details = ExceptionMessages.agent_response_error;
716         else
717             error_code.details = new String JavaDoc ("Could not retrieve sysObjectID " +
718                  "for IpNode Object with name " + key + ":" +
719                  " Object with Snmp Object Identifier " + SYS_OBJECTID_OID +
720                  " does not exist.");
721
722         throw new ApplicationError(error_code);
723
724     }
725
726     org.omg.CORBA.Any JavaDoc value = sysObjectIDData.value;
727
728     if(value.type().kind().value() != TCKind._tk_string) {
729
730         ApplicationErrorInfoTypeImpl error_code =
731             new ApplicationErrorInfoTypeImpl();
732
733         error_code.error = new UIDType(
734             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
735             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
736
737         error_code.details = new String JavaDoc ("Could not retrieve sysObjectID " +
738              "for IpNode Object with name " + key + ":" +
739              " Object with Snmp Object Identifier " + SYS_OBJECTID_OID +
740              " is not of type string, as expected.");
741
742         throw new ApplicationError(error_code);
743
744     }
745
746     String JavaDoc sysObjectID = value.extract_string();
747
748     return sysObjectID;
749     }
750     //
751
// IDL:coach.ist/coachEmsMib/IpNode_F/sysUpTimeGet:1.0
752
//
753
/**
754      ** Implementation of the ::coachEmsMib::IpNode_F::sysUpTimeGet operation.
755      **/

756     public long
757     sysUpTimeGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
758     throws intt.itu.itut_x780.ApplicationError
759     {
760         //
761
// DONE : implement
762
//
763
DataType sysUpTimeData = null;
764
765     String JavaDoc key = Utils.name2string(name);
766
767     if (this.elements.containsKey(key) == false) {
768
769         ApplicationErrorInfoTypeImpl error_code =
770             new ApplicationErrorInfoTypeImpl();
771
772         error_code.error = new UIDType(
773             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
774             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
775
776         error_code.details = new String JavaDoc ("object with name" +
777             key + " does not exist.");
778
779         throw new ApplicationError(error_code);
780     }
781
782
783     try {
784
785         sysUpTimeData = this.connector.get(
786             SYS_UPTIME_OID,
787             new String JavaDoc(this.managementIPAddressGet(name)),
788             this.snmpPortGet(name),
789             READ_COMMUNITY);
790     }
791     catch (SnmpApplicationError e) {
792
793         ApplicationErrorInfoTypeImpl error_code =
794         new ApplicationErrorInfoTypeImpl();
795
796         error_code.error = new UIDType(
797             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
798             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
799
800         if (e.reason.equals(ExceptionMessages.agent_response_error))
801             error_code.details = ExceptionMessages.agent_response_error;
802         else
803             error_code.details = new String JavaDoc ("Could not retrieve sysUpTime " +
804                 "for IpNode Object with name " + key + ":" +
805                 " Object with Snmp Object Identifier " + SYS_UPTIME_OID +
806                 " does not exist.");
807
808         throw new ApplicationError(error_code);
809
810     }
811
812     org.omg.CORBA.Any JavaDoc value = sysUpTimeData.value;
813
814     if(value.type().kind().value() != TCKind._tk_longlong) {
815
816         ApplicationErrorInfoTypeImpl error_code =
817             new ApplicationErrorInfoTypeImpl();
818
819         error_code.error = new UIDType(
820             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
821             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
822
823         error_code.details = new String JavaDoc ("Could not retrieve sysUpTime " +
824              "for IpNode Object with name " + key + ":" +
825              " Object with Snmp Object Identifier " + SYS_UPTIME_OID +
826              " is not of type long, as expected.");
827
828         throw new ApplicationError(error_code);
829
830     }
831
832     long sysUpTime = value.extract_longlong();
833
834     return sysUpTime;
835
836     }
837     //
838
// IDL:coach.ist/coachEmsMib/IpNode_F/sysContactGet:1.0
839
//
840
/**
841      ** Implementation of the ::coachEmsMib::IpNode_F::sysContactGet operation.
842      **/

843     public java.lang.String JavaDoc
844     sysContactGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
845     throws intt.itu.itut_x780.ApplicationError
846     {
847         //
848
// DONE : implement
849
//
850

851
852     DataType sysDescrData = null;
853
854     String JavaDoc key = Utils.name2string(name);
855
856     if (this.elements.containsKey(key) == false) {
857
858         ApplicationErrorInfoTypeImpl error_code =
859             new ApplicationErrorInfoTypeImpl();
860
861         error_code.error = new UIDType(
862             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
863             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
864
865         error_code.details = new String JavaDoc ("object with name" +
866             key + " does not exist.");
867
868         throw new ApplicationError(error_code);
869     }
870
871
872     try {
873
874         sysDescrData = this.connector.get(
875             SYS_CONTACT_OID,
876             new String JavaDoc(this.managementIPAddressGet(name)),
877             this.snmpPortGet(name),
878             READ_COMMUNITY);
879     }
880     catch (SnmpApplicationError e) {
881
882         ApplicationErrorInfoTypeImpl error_code =
883         new ApplicationErrorInfoTypeImpl();
884
885         error_code.error = new UIDType(
886             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
887             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
888
889         if (e.reason.equals(ExceptionMessages.agent_response_error))
890             error_code.details = ExceptionMessages.agent_response_error;
891         else
892                 error_code.details = new String JavaDoc ("Could not retrieve sysContact " +
893                  "for IpNode Object with name " + key + ":" +
894                  " Object with Snmp Object Identifier " + SYS_CONTACT_OID +
895                  " does not exist.");
896
897         throw new ApplicationError(error_code);
898
899     }
900
901     org.omg.CORBA.Any JavaDoc value = sysDescrData.value;
902
903     //if(value.type().kind().value() != TCKind._tk_string) {
904
if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
905         ApplicationErrorInfoTypeImpl error_code =
906             new ApplicationErrorInfoTypeImpl();
907
908         error_code.error = new UIDType(
909             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
910             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
911
912         error_code.details = new String JavaDoc ("Could not retrieve sysContact " +
913              "for IpNode Object with name " + key + ":" +
914              " Object with Snmp Object Identifier " + SYS_CONTACT_OID +
915              " is not of type string, as expected.");
916
917         throw new ApplicationError(error_code);
918
919     }
920     String JavaDoc sysContact = new String JavaDoc(org.omg.CORBA.OctetSeqHelper.extract(value));
921     //String sysContact = value.extract_string();
922

923     return sysContact;
924     }
925     //
926
// IDL:coach.ist/coachEmsMib/IpNode_F/sysContactSet:1.0
927
//
928
/**
929      ** Implementation of the ::coachEmsMib::IpNode_F::sysContactSet operation.
930      **/

931     public void
932     sysContactSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc sysContact)
933     throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOsysInformationSetPackageException
934     {
935         //
936
// DONE : implement
937
//
938

939     String JavaDoc key = Utils.name2string(name);
940
941     if (this.elements.containsKey(key) == false) {
942
943         ApplicationErrorInfoTypeImpl error_code =
944             new ApplicationErrorInfoTypeImpl();
945
946         error_code.error = new UIDType(
947             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
948             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
949
950         error_code.details = new String JavaDoc ("object with name" +
951             key + " does not exist.");
952
953         throw new ApplicationError(error_code);
954     }
955
956     if (!Utils.packageIsSupported(SYS_INFO_SET_PACKAGE,
957             packagesGet(name))) {
958         System.out.println("Package " + SYS_INFO_SET_PACKAGE +
959             "is not supported by IpNode Object" + key);
960
961         throw new NOsysInformationSetPackageException();
962     }
963
964     org.omg.CORBA.Any JavaDoc value = orb.create_any();
965     //value.insert_string(sysContact);
966
org.omg.CORBA.OctetSeqHelper.insert(value, sysContact.getBytes());
967     DataTypeImpl sysContactData = new DataTypeImpl(
968         SYS_CONTACT_OID,
969         value,
970         SnmpSMI.SMI_STRING);
971
972     try {
973
974         this.connector.set(
975             sysContactData,
976             new String JavaDoc(this.managementIPAddressGet(name)),
977             this.snmpPortGet(name),
978             WRITE_COMMUNITY);
979         }
980     catch (SnmpApplicationError e) {
981
982         ApplicationErrorInfoTypeImpl error_code =
983             new ApplicationErrorInfoTypeImpl();
984
985         error_code.error = new UIDType(
986             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
987             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
988
989         if (e.reason.equals(ExceptionMessages.agent_response_error))
990             error_code.details = ExceptionMessages.agent_response_error;
991         else
992             error_code.details = new String JavaDoc ("Could not set sysContact " +
993                  "for IpNode Object with name " + key + ".");
994
995         throw new ApplicationError(error_code);
996
997     }
998
999     }
1000    //
1001
// IDL:coach.ist/coachEmsMib/IpNode_F/sysNameGet:1.0
1002
//
1003
/**
1004     ** Implementation of the ::coachEmsMib::IpNode_F::sysNameGet operation.
1005     **/

1006    public java.lang.String JavaDoc
1007    sysNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1008    throws intt.itu.itut_x780.ApplicationError
1009    {
1010        //
1011
// DONE : implement
1012
//
1013

1014    DataType sysNameData = null;
1015
1016    String JavaDoc key = Utils.name2string(name);
1017
1018    if (this.elements.containsKey(key) == false) {
1019
1020        ApplicationErrorInfoTypeImpl error_code =
1021            new ApplicationErrorInfoTypeImpl();
1022
1023        error_code.error = new UIDType(
1024            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1025            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1026
1027        error_code.details = new String JavaDoc ("object with name" +
1028            key + " does not exist.");
1029
1030        throw new ApplicationError(error_code);
1031    }
1032
1033
1034    try {
1035
1036        sysNameData = this.connector.get(
1037            SYS_NAME_OID,
1038            new String JavaDoc(this.managementIPAddressGet(name)),
1039            this.snmpPortGet(name),
1040            READ_COMMUNITY);
1041    }
1042    catch (SnmpApplicationError e) {
1043
1044        ApplicationErrorInfoTypeImpl error_code =
1045        new ApplicationErrorInfoTypeImpl();
1046
1047        error_code.error = new UIDType(
1048            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1049            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1050
1051        if (e.reason.equals(ExceptionMessages.agent_response_error))
1052            error_code.details = ExceptionMessages.agent_response_error;
1053        else
1054            error_code.details = new String JavaDoc ("Could not retrieve sysName " +
1055                "for IpNode Object with name " + key + ":" +
1056                " Object with Snmp Object Identifier " + SYS_NAME_OID +
1057                " does not exist.");
1058
1059        throw new ApplicationError(error_code);
1060
1061    }
1062
1063    org.omg.CORBA.Any JavaDoc value = sysNameData.value;
1064
1065    //if(value.type().kind().value() != TCKind._tk_string) {
1066
if(value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
1067        ApplicationErrorInfoTypeImpl error_code =
1068            new ApplicationErrorInfoTypeImpl();
1069
1070        error_code.error = new UIDType(
1071            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1072            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1073
1074        error_code.details = new String JavaDoc ("Could not retrieve sysName " +
1075             "for IpNode Object with name " + key + ":" +
1076             " Object with Snmp Object Identifier " + SYS_NAME_OID +
1077             " is not of type string, as expected.");
1078
1079        throw new ApplicationError(error_code);
1080
1081    }
1082
1083    //String sysContact = value.extract_string();
1084
String JavaDoc sysName = new String JavaDoc(org.omg.CORBA.OctetSeqHelper.extract(value));
1085    return sysName;
1086    }
1087    //
1088
// IDL:coach.ist/coachEmsMib/IpNode_F/sysNameSet:1.0
1089
//
1090
/**
1091     ** Implementation of the ::coachEmsMib::IpNode_F::sysNameSet operation.
1092     **/

1093    public void
1094    sysNameSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc sysName)
1095    throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmsMib.NOsysInformationSetPackageException
1096    {
1097        //
1098
// DONE : implement
1099
//
1100

1101    String JavaDoc key = Utils.name2string(name);
1102
1103    if (this.elements.containsKey(key) == false) {
1104
1105        ApplicationErrorInfoTypeImpl error_code =
1106            new ApplicationErrorInfoTypeImpl();
1107
1108        error_code.error = new UIDType(
1109            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1110            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1111
1112        error_code.details = new String JavaDoc ("object with name" +
1113            key + " does not exist.");
1114
1115        throw new ApplicationError(error_code);
1116    }
1117
1118    if (!Utils.packageIsSupported(SYS_INFO_SET_PACKAGE,
1119            packagesGet(name))) {
1120        System.out.println("Package " + SYS_INFO_SET_PACKAGE +
1121            "is not supported by IpNode Object" + key);
1122
1123        throw new NOsysInformationSetPackageException();
1124    }
1125
1126    org.omg.CORBA.Any JavaDoc value = orb.create_any();
1127    //value.insert_string(sysName);
1128

1129    org.omg.CORBA.OctetSeqHelper.insert(value, sysName.getBytes());
1130
1131    DataTypeImpl sysNameData = new DataTypeImpl(
1132        SYS_NAME_OID,
1133        value,
1134        SnmpSMI.SMI_STRING);
1135
1136    try {
1137
1138        this.connector.set(
1139            sysNameData,
1140            new String JavaDoc(this.managementIPAddressGet(name)),
1141            this.snmpPortGet(name),
1142            WRITE_COMMUNITY);
1143    }
1144    catch (SnmpApplicationError e) {
1145
1146        ApplicationErrorInfoTypeImpl error_code =
1147            new ApplicationErrorInfoTypeImpl();
1148
1149        error_code.error = new UIDType(
1150            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1151            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1152
1153        if (e.reason.equals(ExceptionMessages.agent_response_error))
1154            error_code.details = ExceptionMessages.agent_response_error;
1155        else
1156            error_code.details = new String JavaDoc ("Could not set sysName " +
1157                 "for IpNode Object with name " + key + ".");
1158
1159        throw new ApplicationError(error_code);
1160
1161    }
1162    }
1163    //
1164
// IDL:coach.ist/coachEmsMib/IpNode_F/sysServicesGet:1.0
1165
//
1166
/**
1167     ** Implementation of the ::coachEmsMib::IpNode_F::sysServicesGet operation.
1168     **/

1169    public short
1170    sysServicesGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1171    throws intt.itu.itut_x780.ApplicationError
1172    {
1173        //
1174
// DONE : implement
1175
//
1176

1177    DataType sysServicesData = null;
1178
1179    String JavaDoc key = Utils.name2string(name);
1180
1181    if (this.elements.containsKey(key) == false) {
1182
1183        ApplicationErrorInfoTypeImpl error_code =
1184            new ApplicationErrorInfoTypeImpl();
1185
1186        error_code.error = new UIDType(
1187            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1188            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1189
1190        error_code.details = new String JavaDoc ("object with name" +
1191            key + " does not exist.");
1192
1193        throw new ApplicationError(error_code);
1194    }
1195
1196
1197    try {
1198
1199        sysServicesData = this.connector.get(
1200            SYS_SERVICES_OID,
1201            new String JavaDoc(this.managementIPAddressGet(name)),
1202            this.snmpPortGet(name),
1203            READ_COMMUNITY);
1204    }
1205    catch (SnmpApplicationError e) {
1206
1207        ApplicationErrorInfoTypeImpl error_code =
1208        new ApplicationErrorInfoTypeImpl();
1209
1210        error_code.error = new UIDType(
1211            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1212            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1213
1214        if (e.reason.equals(ExceptionMessages.agent_response_error))
1215            error_code.details = ExceptionMessages.agent_response_error;
1216        else
1217            error_code.details = new String JavaDoc ("Could not retrieve sysServices " +
1218                 "for IpNode Object with name " + key + ":" +
1219                 " Object with Snmp Object Identifier " + SYS_SERVICES_OID +
1220                 " does not exist.");
1221
1222        throw new ApplicationError(error_code);
1223
1224    }
1225
1226    org.omg.CORBA.Any JavaDoc value = sysServicesData.value;
1227
1228    if(value.type().kind().value() != TCKind._tk_long) {
1229
1230        ApplicationErrorInfoTypeImpl error_code =
1231            new ApplicationErrorInfoTypeImpl();
1232
1233        error_code.error = new UIDType(
1234            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1235            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1236
1237        error_code.details = new String JavaDoc ("Could not retrieve sysServices " +
1238             "for IpNode Object with name " + key + ":" +
1239             " Object with Snmp Object Identifier " + SYS_SERVICES_OID +
1240             " is not of type int, as expected.");
1241
1242        throw new ApplicationError(error_code);
1243
1244    }
1245
1246    short sysServices = (short)value.extract_long();
1247
1248    return sysServices;
1249
1250    }
1251    //
1252
// IDL:itu.intt/itut_m3120/ManagedElement_F/administrativeStateGet:1.0
1253
//
1254
/**
1255     ** Implementation of the ::itut_m3120::ManagedElement_F::administrativeStateGet operation.
1256     **/

1257    public intt.itu.itut_x780.AdministrativeStateType
1258    administrativeStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1259    throws intt.itu.itut_x780.ApplicationError
1260    {
1261        //
1262
// DONE : implement
1263
//
1264

1265    String JavaDoc key = Utils.name2string(name);
1266
1267    if (this.elements.containsKey(key) == false) {
1268
1269        ApplicationErrorInfoTypeImpl error_code =
1270            new ApplicationErrorInfoTypeImpl();
1271
1272        error_code.error = new UIDType(
1273            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1274            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1275
1276        error_code.details = new String JavaDoc ("object with name" +
1277            key + " does not exist.");
1278
1279        throw new ApplicationError(error_code);
1280    }
1281
1282    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(
1283        Utils.name2string(name));
1284
1285    return ipNodeData.administrativeState;
1286
1287    }
1288    //
1289
// IDL:itu.intt/itut_m3120/ManagedElement_F/administrativeStateSet:1.0
1290
//
1291
/**
1292     ** Implementation of the ::itut_m3120::ManagedElement_F::administrativeStateSet operation.
1293     **/

1294    public void
1295    administrativeStateSet(org.omg.CosNaming.NameComponent JavaDoc[] name, intt.itu.itut_x780.AdministrativeStateType administrativeState)
1296    throws intt.itu.itut_x780.ApplicationError
1297    {
1298        //
1299
// DONE : implement
1300
//
1301

1302    //HACK: Dummy operation! No support from underlying SNMP Agent!
1303

1304    String JavaDoc key = Utils.name2string(name);
1305
1306    if (this.elements.containsKey(key) == false) {
1307
1308        ApplicationErrorInfoTypeImpl error_code =
1309            new ApplicationErrorInfoTypeImpl();
1310
1311        error_code.error = new UIDType(
1312            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1313            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1314
1315        error_code.details = new String JavaDoc ("object with name" +
1316            key + " does not exist.");
1317
1318        throw new ApplicationError(error_code);
1319    }
1320
1321    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1322
1323    ipNodeData.administrativeState = administrativeState;
1324    }
1325    //
1326
// IDL:itu.intt/itut_m3120/ManagedElement_F/operationalStateGet:1.0
1327
//
1328
/**
1329     ** Implementation of the ::itut_m3120::ManagedElement_F::operationalStateGet operation.
1330     **/

1331    public intt.itu.itut_x780.OperationalStateType
1332    operationalStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1333    throws intt.itu.itut_x780.ApplicationError
1334    {
1335        //
1336
// TODO : implement
1337
//
1338
//HACK: Dummy operation! No support from underlying SNMP Agent!
1339

1340    String JavaDoc key = Utils.name2string(name);
1341
1342    if (this.elements.containsKey(key) == false) {
1343
1344        ApplicationErrorInfoTypeImpl error_code =
1345            new ApplicationErrorInfoTypeImpl();
1346
1347        error_code.error = new UIDType(
1348            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1349            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1350
1351        error_code.details = new String JavaDoc ("object with name" +
1352            key + " does not exist.");
1353
1354        throw new ApplicationError(error_code);
1355    }
1356
1357    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(
1358        Utils.name2string(name));
1359
1360    return ipNodeData.operationalState;
1361
1362    }
1363    //
1364
// IDL:itu.intt/itut_m3120/ManagedElement_F/usageStateGet:1.0
1365
//
1366
/**
1367     ** Implementation of the ::itut_m3120::ManagedElement_F::usageStateGet operation.
1368     **/

1369    public intt.itu.itut_x780.UsageStateType
1370    usageStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1371    throws intt.itu.itut_x780.ApplicationError
1372    {
1373        //
1374
// DONE : implement
1375
//
1376

1377    //HACK: Dummy operation! No support from underlying SNMP Agent!
1378

1379    String JavaDoc key = Utils.name2string(name);
1380
1381    if (this.elements.containsKey(key) == false) {
1382
1383        ApplicationErrorInfoTypeImpl error_code =
1384            new ApplicationErrorInfoTypeImpl();
1385
1386        error_code.error = new UIDType(
1387            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1388            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1389
1390        error_code.details = new String JavaDoc ("object with name" +
1391            key + " does not exist.");
1392
1393        throw new ApplicationError(error_code);
1394    }
1395    return intt.itu.itut_x780.UsageStateType.active;
1396    }
1397    //
1398
// IDL:itu.intt/itut_m3120/ManagedElement_F/userLabelGet:1.0
1399
//
1400
/**
1401     ** Implementation of the ::itut_m3120::ManagedElement_F::userLabelGet operation.
1402     **/

1403    public java.lang.String JavaDoc
1404    userLabelGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1405    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException
1406    {
1407        //
1408
// DONE : implement
1409
//
1410

1411    String JavaDoc key = Utils.name2string(name);
1412
1413    if (this.elements.containsKey(key) == false) {
1414
1415        ApplicationErrorInfoTypeImpl error_code =
1416            new ApplicationErrorInfoTypeImpl();
1417
1418        error_code.error = new UIDType(
1419            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1420            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1421
1422        error_code.details = new String JavaDoc ("object with name" +
1423            key + " does not exist.");
1424
1425        throw new ApplicationError(error_code);
1426    }
1427
1428    if (!Utils.packageIsSupported(USER_LABEL_PACKAGE,
1429            packagesGet(name))) {
1430        throw new NOuserLabelPackageException();
1431    }
1432
1433    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1434
1435    return ipNodeData.userLabel;
1436    }
1437    //
1438
// IDL:itu.intt/itut_m3120/ManagedElement_F/userLabelSet:1.0
1439
//
1440
/**
1441     ** Implementation of the ::itut_m3120::ManagedElement_F::userLabelSet operation.
1442     **/

1443    public void
1444    userLabelSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc userLabel)
1445    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException
1446    {
1447        //
1448
// DONE : implement
1449
//
1450

1451    String JavaDoc key = Utils.name2string(name);
1452
1453    if (this.elements.containsKey(key) == false) {
1454
1455        ApplicationErrorInfoTypeImpl error_code =
1456            new ApplicationErrorInfoTypeImpl();
1457
1458        error_code.error = new UIDType(
1459            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1460            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1461
1462        error_code.details = new String JavaDoc ("object with name" +
1463            key + " does not exist.");
1464
1465        throw new ApplicationError(error_code);
1466    }
1467
1468    if (!Utils.packageIsSupported(USER_LABEL_PACKAGE,
1469            packagesGet(name))) {
1470        throw new NOuserLabelPackageException();
1471    }
1472
1473    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1474
1475    ipNodeData.userLabel = userLabel;
1476    }
1477    //
1478
// IDL:itu.intt/itut_m3120/ManagedElement_F/vendorNameGet:1.0
1479
//
1480
/**
1481     ** Implementation of the ::itut_m3120::ManagedElement_F::vendorNameGet operation.
1482     **/

1483    public java.lang.String JavaDoc
1484    vendorNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1485    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException
1486    {
1487        //
1488
// DONE : implement
1489
//
1490

1491    String JavaDoc key = Utils.name2string(name);
1492
1493    if (this.elements.containsKey(key) == false) {
1494
1495        ApplicationErrorInfoTypeImpl error_code =
1496            new ApplicationErrorInfoTypeImpl();
1497
1498        error_code.error = new UIDType(
1499            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1500            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1501
1502        error_code.details = new String JavaDoc ("object with name" +
1503            key + " does not exist.");
1504
1505        throw new ApplicationError(error_code);
1506    }
1507
1508    if (!Utils.packageIsSupported(VENDOR_NAME_PACKAGE,
1509            packagesGet(name))) {
1510        throw new NOvendorNamePackageException();
1511    }
1512
1513    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1514
1515    return ipNodeData.vendorName;
1516    }
1517    //
1518
// IDL:itu.intt/itut_m3120/ManagedElement_F/vendorNameSet:1.0
1519
//
1520
/**
1521     ** Implementation of the ::itut_m3120::ManagedElement_F::vendorNameSet operation.
1522     **/

1523    public void
1524    vendorNameSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc vendorName)
1525    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException
1526    {
1527        //
1528
// DONE : implement
1529
//
1530

1531    String JavaDoc key = Utils.name2string(name);
1532
1533    if (this.elements.containsKey(key) == false) {
1534
1535        ApplicationErrorInfoTypeImpl error_code =
1536            new ApplicationErrorInfoTypeImpl();
1537
1538        error_code.error = new UIDType(
1539            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1540            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1541
1542        error_code.details = new String JavaDoc ("object with name" +
1543            key + " does not exist.");
1544
1545        throw new ApplicationError(error_code);
1546    }
1547
1548    if (!Utils.packageIsSupported(VENDOR_NAME_PACKAGE,
1549                packagesGet(name))) {
1550        throw new NOvendorNamePackageException();
1551    }
1552
1553    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1554
1555    ipNodeData.vendorName = vendorName;
1556    }
1557    //
1558
// IDL:itu.intt/itut_m3120/ManagedElement_F/versionGet:1.0
1559
//
1560
/**
1561     ** Implementation of the ::itut_m3120::ManagedElement_F::versionGet operation.
1562     **/

1563    public java.lang.String JavaDoc
1564    versionGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1565    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException
1566    {
1567        //
1568
// DONE : implement
1569
//
1570

1571    String JavaDoc key = Utils.name2string(name);
1572
1573    if (this.elements.containsKey(key) == false) {
1574
1575        ApplicationErrorInfoTypeImpl error_code =
1576            new ApplicationErrorInfoTypeImpl();
1577
1578        error_code.error = new UIDType(
1579            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1580            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1581
1582        error_code.details = new String JavaDoc ("object with name" +
1583            key + " does not exist.");
1584
1585        throw new ApplicationError(error_code);
1586    }
1587
1588    if (!Utils.packageIsSupported(VERSION_PACKAGE,
1589            packagesGet(name))) {
1590        throw new NOversionPackageException();
1591    }
1592
1593    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1594
1595    return ipNodeData.version;
1596    }
1597    //
1598
// IDL:itu.intt/itut_m3120/ManagedElement_F/versionSet:1.0
1599
//
1600
/**
1601     ** Implementation of the ::itut_m3120::ManagedElement_F::versionSet operation.
1602     **/

1603    public void
1604    versionSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc version)
1605    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException
1606    {
1607        //
1608
// DONE : implement
1609
//
1610

1611    String JavaDoc key = Utils.name2string(name);
1612
1613    if (this.elements.containsKey(key) == false) {
1614
1615        ApplicationErrorInfoTypeImpl error_code =
1616            new ApplicationErrorInfoTypeImpl();
1617
1618        error_code.error = new UIDType(
1619            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1620            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1621
1622        error_code.details = new String JavaDoc ("object with name" +
1623            key + " does not exist.");
1624
1625        throw new ApplicationError(error_code);
1626    }
1627
1628    if (!Utils.packageIsSupported(VERSION_PACKAGE,
1629            packagesGet(name))) {
1630        throw new NOversionPackageException();
1631    }
1632
1633    IpNodeDataStructure ipNodeData = (IpNodeDataStructure)this.elements.get(key);
1634
1635    ipNodeData.version = version;
1636    }
1637    //
1638
// IDL:itu.intt/itut_m3120/ManagedElement_F/locationNameGet:1.0
1639
//
1640
/**
1641     ** Implementation of the ::itut_m3120::ManagedElement_F::locationNameGet operation.
1642     **/

1643    public java.lang.String JavaDoc
1644    locationNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1645    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException
1646    {
1647        //
1648
// DONE : implement
1649
//
1650

1651    DataType sysLocationData = null;
1652
1653    String JavaDoc key = Utils.name2string(name);
1654
1655    if (this.elements.containsKey(key) == false) {
1656
1657        ApplicationErrorInfoTypeImpl error_code =
1658            new ApplicationErrorInfoTypeImpl();
1659
1660        error_code.error = new UIDType(
1661            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1662            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1663
1664        error_code.details = new String JavaDoc ("object with name" +
1665            key + " does not exist.");
1666
1667        throw new ApplicationError(error_code);
1668    }
1669
1670    if (!Utils.packageIsSupported(LOCATION_NAME_PACKAGE,
1671            packagesGet(name))) {
1672        System.out.println("Package " + LOCATION_NAME_PACKAGE +
1673            "is not supported by IpNode Object" + key);
1674
1675        throw new NOlocationNamePackageException();
1676    }
1677
1678
1679    try {
1680
1681        sysLocationData = this.connector.get(
1682            SYS_LOCATION_OID,
1683            new String JavaDoc(this.managementIPAddressGet(name)),
1684            this.snmpPortGet(name),
1685            READ_COMMUNITY);
1686    }
1687    catch (SnmpApplicationError e) {
1688
1689        ApplicationErrorInfoTypeImpl error_code =
1690        new ApplicationErrorInfoTypeImpl();
1691
1692        error_code.error = new UIDType(
1693            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1694            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1695
1696        if (e.reason.equals(ExceptionMessages.agent_response_error))
1697            error_code.details = ExceptionMessages.agent_response_error;
1698        else
1699            error_code.details = new String JavaDoc ("Could not retrieve sysLocation " +
1700                 "for IpNode Object with name " + key + ":" +
1701                 " Object with Snmp Object Identifier " + SYS_LOCATION_OID +
1702                 " does not exist.");
1703
1704        throw new ApplicationError(error_code);
1705
1706    }
1707
1708    org.omg.CORBA.Any JavaDoc value = sysLocationData.value;
1709    //by digi
1710
//if(value.type().kind().value() != TCKind._tk_string) {
1711
if (value.type().kind().value() != org.omg.CORBA.OctetSeqHelper.type().kind().value()) {
1712        ApplicationErrorInfoTypeImpl error_code =
1713            new ApplicationErrorInfoTypeImpl();
1714
1715        error_code.error = new UIDType(
1716            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1717            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1718
1719        error_code.details = new String JavaDoc ("Could not retrieve sysLocation " +
1720             "for IpNode Object with name " + key + ":" +
1721             " Object with Snmp Object Identifier " + SYS_LOCATION_OID +
1722             " is not of expected type.");
1723
1724        throw new ApplicationError(error_code);
1725
1726    }
1727    // by digi
1728
//String sysLocation = value.extract_string();
1729
String JavaDoc sysLocation = new String JavaDoc(org.omg.CORBA.OctetSeqHelper.extract(value));
1730    return sysLocation;
1731    }
1732    //
1733
// IDL:itu.intt/itut_m3120/ManagedElement_F/locationNameSet:1.0
1734
//
1735
/**
1736     ** Implementation of the ::itut_m3120::ManagedElement_F::locationNameSet operation.
1737     **/

1738    public void
1739    locationNameSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc locationName)
1740    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException
1741    {
1742        //
1743
// DONE : implement
1744
//
1745

1746    String JavaDoc key = Utils.name2string(name);
1747
1748    if (this.elements.containsKey(key) == false) {
1749
1750        ApplicationErrorInfoTypeImpl error_code =
1751            new ApplicationErrorInfoTypeImpl();
1752
1753        error_code.error = new UIDType(
1754            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1755            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1756
1757        error_code.details = new String JavaDoc ("object with name" +
1758            key + " does not exist.");
1759
1760        throw new ApplicationError(error_code);
1761    }
1762
1763    if (!Utils.packageIsSupported(LOCATION_NAME_PACKAGE,
1764            packagesGet(name))) {
1765        System.out.println("Package " + LOCATION_NAME_PACKAGE +
1766            "is not supported by IpNode Object" + key);
1767
1768        throw new NOlocationNamePackageException();
1769    }
1770
1771    org.omg.CORBA.Any JavaDoc value = orb.create_any();
1772    // by digi
1773
//value.insert_string(locationName);
1774

1775    org.omg.CORBA.OctetSeqHelper.insert(value, locationName.getBytes());
1776
1777    DataTypeImpl sysLocationData = new DataTypeImpl(
1778        SYS_LOCATION_OID,
1779        value,
1780        SnmpSMI.SMI_STRING);
1781
1782    try {
1783
1784        this.connector.set(
1785            sysLocationData,
1786            new String JavaDoc(this.managementIPAddressGet(name)),
1787            this.snmpPortGet(name),
1788            WRITE_COMMUNITY);
1789    }
1790    catch (SnmpApplicationError e) {
1791
1792        ApplicationErrorInfoTypeImpl error_code =
1793            new ApplicationErrorInfoTypeImpl();
1794
1795        error_code.error = new UIDType(
1796            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1797            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1798
1799        if (e.reason.equals(ExceptionMessages.agent_response_error))
1800            error_code.details = ExceptionMessages.agent_response_error;
1801        else
1802            error_code.details = new String JavaDoc ("Could not set sysLocation " +
1803                 "for IpNode Object with name " + key + ".");
1804
1805        throw new ApplicationError(error_code);
1806
1807    }
1808  }
1809
1810    //
1811
// IDL:itu.intt/itut_x780/ManagedObject_F/objectClassGet:1.0
1812
//
1813
/**
1814     ** Implementation of the ::itut_x780::ManagedObject_F::objectClassGet operation.
1815     **/

1816
1817    public java.lang.String JavaDoc
1818    objectClassGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1819    throws intt.itu.itut_x780.ApplicationError
1820    {
1821        //
1822
// DONE : implement
1823
//
1824

1825    String JavaDoc key = Utils.name2string(name);
1826
1827    if (this.elements.containsKey(key) == false) {
1828
1829        ApplicationErrorInfoTypeImpl error_code =
1830            new ApplicationErrorInfoTypeImpl();
1831
1832        error_code.error = new UIDType(
1833            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1834            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1835
1836        error_code.details = new String JavaDoc ("object with name" +
1837            key + " does not exist.");
1838
1839        throw new ApplicationError(error_code);
1840    }
1841
1842    IpNodeDataStructure ipNodeData =
1843        (IpNodeDataStructure)this.elements.get(key);
1844
1845    return ipNodeData.objectclass;
1846    }
1847    //
1848
// IDL:itu.intt/itut_x780/ManagedObject_F/attributesGet:1.0
1849
//
1850
/**
1851     ** Implementation of the ::itut_x780::ManagedObject_F::attributesGet operation.
1852     **/

1853    public intt.itu.itut_x780.ManagedObjectValueType
1854    attributesGet(org.omg.CosNaming.NameComponent JavaDoc[] name, intt.itu.itut_x780.StringSetTypeHolder attributeNames)
1855    throws intt.itu.itut_x780.ApplicationError
1856    {
1857        //
1858
// DONE : implement
1859
//
1860

1861    String JavaDoc key = Utils.name2string(name);
1862
1863    if (this.elements.containsKey(key) == false) {
1864
1865        ApplicationErrorInfoTypeImpl error_code =
1866            new ApplicationErrorInfoTypeImpl();
1867
1868        error_code.error = new UIDType(
1869            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1870            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1871
1872        error_code.details = new String JavaDoc ("object with name" +
1873            key + " does not exist.");
1874
1875        throw new ApplicationError(error_code);
1876    }
1877
1878    IpNodeDataStructure ipNodeData =
1879        (IpNodeDataStructure)this.elements.get(key);
1880
1881    String JavaDoc userLabel = new String JavaDoc();
1882    String JavaDoc vendorName = new String JavaDoc();
1883    String JavaDoc version = new String JavaDoc();
1884    String JavaDoc locationName = new String JavaDoc();
1885
1886    try {
1887        userLabel = userLabelGet(name);
1888    }
1889    catch (NOuserLabelPackageException noUserLabel) {
1890
1891    }
1892
1893    try {
1894        vendorName = vendorNameGet(name);
1895    }
1896    catch (NOvendorNamePackageException noVendorName) {
1897
1898    }
1899
1900    try {
1901        version = versionGet(name);
1902    }
1903    catch (NOversionPackageException noVersion) {
1904
1905    }
1906
1907    try {
1908        locationName = locationNameGet(name);
1909    }
1910    catch (NOlocationNamePackageException noLocation) {
1911
1912    }
1913
1914    IpNodeValueTypeImpl ipNodeValueType = new IpNodeValueTypeImpl(
1915
1916        ipNodeData.administrativeState,
1917        this.operationalStateGet(name),
1918        this.usageStateGet(name),
1919        userLabel,
1920        vendorName,
1921        version,
1922        locationName,
1923        ipNodeData.domainName,
1924        ipNodeData.hostname,
1925        ipNodeData.managementIPAddress,
1926        ipNodeData.supportedSnmpVersions,
1927        ipNodeData.snmpPort,
1928        this.ifNumberGet(name),
1929        this.sysDescrGet(name),
1930        this.sysObjectIDGet(name),
1931        this.sysUpTimeGet(name),
1932        this.sysContactGet(name),
1933        this.sysNameGet(name),
1934        this.sysServicesGet(name),
1935        ipNodeData.name,
1936        ipNodeData.objectclass,
1937        ipNodeData.packageNameList,
1938        ipNodeData.sourceIndicator,
1939        ipNodeData.deletePolicy
1940    );
1941
1942    return ipNodeValueType;
1943    }
1944    //
1945
// IDL:itu.intt/itut_x780/ManagedObject_F/packagesGet:1.0
1946
//
1947
/**
1948     ** Implementation of the ::itut_x780::ManagedObject_F::packagesGet operation.
1949     **/

1950    public java.lang.String JavaDoc[]
1951    packagesGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1952    throws intt.itu.itut_x780.ApplicationError
1953    {
1954        //
1955
// DONE : implement
1956
//
1957

1958    String JavaDoc key = Utils.name2string(name);
1959
1960    if (this.elements.containsKey(key) == false) {
1961
1962        ApplicationErrorInfoTypeImpl error_code =
1963            new ApplicationErrorInfoTypeImpl();
1964
1965        error_code.error = new UIDType(
1966            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
1967            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
1968
1969        error_code.details = new String JavaDoc ("object with name" +
1970            key + " does not exist.");
1971
1972        throw new ApplicationError(error_code);
1973    }
1974
1975    IpNodeDataStructure ipNodeData =
1976        (IpNodeDataStructure)this.elements.get(key);
1977
1978    return ipNodeData.packageNameList;
1979    }
1980    //
1981
// IDL:itu.intt/itut_x780/ManagedObject_F/creationSourceGet:1.0
1982
//
1983
/**
1984     ** Implementation of the ::itut_x780::ManagedObject_F::creationSourceGet operation.
1985     **/

1986    public intt.itu.itut_x780.SourceIndicatorType
1987    creationSourceGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
1988    throws intt.itu.itut_x780.ApplicationError
1989    {
1990        //
1991
// DONE : implement
1992
//
1993

1994    String JavaDoc key = Utils.name2string(name);
1995
1996    if (this.elements.containsKey(key) == false) {
1997
1998        ApplicationErrorInfoTypeImpl error_code =
1999            new ApplicationErrorInfoTypeImpl();
2000
2001        error_code.error = new UIDType(
2002            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2003            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2004
2005        error_code.details = new String JavaDoc ("object with name" +
2006            key + " does not exist.");
2007
2008        throw new ApplicationError(error_code);
2009    }
2010
2011    IpNodeDataStructure ipNodeData =
2012        (IpNodeDataStructure)this.elements.get(key);
2013
2014    return ipNodeData.sourceIndicator;
2015    }
2016    //
2017
// IDL:itu.intt/itut_x780/ManagedObject_F/deletePolicyGet:1.0
2018
//
2019
/**
2020     ** Implementation of the ::itut_x780::ManagedObject_F::deletePolicyGet operation.
2021     **/

2022    public short
2023    deletePolicyGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
2024    throws intt.itu.itut_x780.ApplicationError
2025    {
2026        //
2027
// DONE : implement
2028
//
2029

2030    String JavaDoc key = Utils.name2string(name);
2031
2032    if (this.elements.containsKey(key) == false) {
2033
2034        ApplicationErrorInfoTypeImpl error_code =
2035            new ApplicationErrorInfoTypeImpl();
2036
2037        error_code.error = new UIDType(
2038            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2039            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2040
2041        error_code.details = new String JavaDoc ("object with name" +
2042            key + " does not exist.");
2043
2044        throw new ApplicationError(error_code);
2045    }
2046
2047    IpNodeDataStructure ipNodeData =
2048        (IpNodeDataStructure)this.elements.get(key);
2049
2050    return ipNodeData.deletePolicy;
2051    }
2052    //
2053
// IDL:itu.intt/itut_x780/ManagedObject_F/destroy:1.0
2054
//
2055
/**
2056     ** Implementation of the ::itut_x780::ManagedObject_F::destroy operation.
2057     **/

2058    public void
2059    destroy(org.omg.CosNaming.NameComponent JavaDoc[] name)
2060    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.DeleteError
2061    {
2062        //
2063
// DONE : implement
2064
//
2065

2066        String JavaDoc key = Utils.name2string(name);
2067
2068        if (this.elements.containsKey(key) == false) {
2069
2070            ApplicationErrorInfoTypeImpl error_code =
2071            new ApplicationErrorInfoTypeImpl();
2072
2073            error_code.error = new UIDType(
2074            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2075            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2076
2077            error_code.details = new String JavaDoc ("object with name" +
2078            key + " does not exist.");
2079
2080            throw new ApplicationError(error_code);
2081        }
2082
2083        IpNodeDataStructure ipNodeData = (IpNodeDataStructure) this.elements.remove(key);
2084        try {
2085            config.unregister(name);
2086        }
2087        catch(ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError snmp_e) {
2088            System.err.println("There was a problem unregistering " + Utils.name2string(name) +
2089            " from the SNMP Trap Deamon");
2090        }
2091
2092        org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(),
2093                    0,(short) 0,(short) 0);
2094        the_context_.push_objectDeletion(new ObjectDeletionImpl(eventTime, name,
2095                                        ipNodeData.objectclass,
2096                                        getUniqueNotificationIdentifier(),
2097                                        //ipNodeData.getUniqueNotificationIdentifier(),
2098
ipNodeData.sourceIndicator,
2099                                        new AttributeValueType[0]));
2100    }
2101    // ==================================================================
2102
//
2103
// Public methods for the ::coachEmsMibComponents::CCM_IpNodeMgmt local interface.
2104
//
2105
// ==================================================================
2106
//
2107
// IDL:coach.ist/coachEmsMibComponents/IpNodeMgmt/create:1.0
2108
//
2109
/**
2110     ** Implementation of the ::coachEmsMibComponents::IpNodeMgmt::create operation.
2111     **/

2112    public void
2113    create( org.omg.CosNaming.NameComponent JavaDoc[] name,
2114                String JavaDoc objectClass,
2115                java.lang.String JavaDoc[] packages,
2116                short deletePolicy,
2117                intt.itu.itut_x780.SourceIndicatorType sourceIndicator,
2118                java.lang.String JavaDoc domainName,
2119                java.lang.String JavaDoc hostname,
2120                byte[] managementIPAddress,
2121                int supportedSnmpVersions,
2122                intt.itu.itut_x780.AdministrativeStateType administrativeState,
2123                java.lang.String JavaDoc userLabel,
2124                java.lang.String JavaDoc vendorName,
2125                java.lang.String JavaDoc version,
2126                java.lang.String JavaDoc locationName,
2127                int snmpPort,
2128                java.lang.String JavaDoc sysName,
2129                java.lang.String JavaDoc sysContact)
2130    throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.CreateError
2131    {
2132        //
2133
// DONE : implement
2134
//
2135

2136        boolean sysInfoSetPackageIsSupported = false;
2137
2138
2139        if (this.elements.containsKey(Utils.name2string(name))) {
2140
2141            CreateErrorInfoTypeImpl errorCode =
2142                new CreateErrorInfoTypeImpl();
2143
2144            errorCode.error = new UIDType(
2145                intt.itu.itut_x780.CreateErrorConst.moduleName.value,
2146                intt.itu.itut_x780.CreateErrorConst.duplicateName.value);
2147
2148            errorCode.details = new String JavaDoc(Utils.name2string(name) +
2149                " object already exists.");
2150            throw new intt.itu.itut_x780.CreateError(errorCode);
2151
2152        }
2153
2154        IpNodeDataStructure ipNodeData = new IpNodeDataStructure(
2155                                                domainName,
2156                                                hostname,
2157                                                managementIPAddress,
2158                                                name,
2159                                                packages,
2160                                                supportedSnmpVersions,
2161                                                administrativeState,
2162                                                userLabel,
2163                                                vendorName,
2164                                                version,
2165                                                locationName,
2166                                                snmpPort,
2167                                                sysName,
2168                                                sysContact,
2169                                                objectClass,
2170                                                deletePolicy,
2171                                                sourceIndicator,
2172                                                intt.itu.itut_x780.OperationalStateType.enabled);
2173
2174        this.elements.put(Utils.name2string(name), ipNodeData);
2175
2176        //System.err.println("IpNodeFacade>Before registering to the SNMP Trap service");
2177

2178        String JavaDoc ipAddress = new String JavaDoc();
2179        if (managementIPAddress != null)
2180            ipAddress = new String JavaDoc(managementIPAddress);
2181
2182        try {
2183            config.registerIP(name, ipAddress);
2184        }
2185        catch( ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError snmp_ex) {
2186            System.err.println("Could not register IpNode " +
2187                Utils.name2string(name) + " to the SNMP Trap Service");
2188            System.err.println("Reason= " + snmp_ex.reason);
2189            ApplicationErrorInfoTypeImpl error_code = new ApplicationErrorInfoTypeImpl();
2190            error_code.error = new UIDType(
2191                intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2192                intt.itu.itut_x780.ApplicationErrorConst.downstreamError.value);
2193
2194            error_code.details = snmp_ex.reason;
2195
2196            throw new ApplicationError(error_code);
2197        }
2198
2199        org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(),
2200                    0,(short) 0,(short) 0);
2201
2202        //System.err.println("IpNodeProvider attempts to push object creation alarm...");
2203
the_context_.push_objectCreation(new ObjectCreationImpl(eventTime, name,
2204                                        objectClass,
2205                                        getUniqueNotificationIdentifier(),
2206                                        //ipNodeData.getUniqueNotificationIdentifier(),
2207
sourceIndicator,
2208                                        new AttributeValueType[0]));
2209
2210        System.err.println("IpNodeProvider finished create operations...");
2211    }
2212    // ==================================================================
2213
//
2214
// Public methods for the ::coachEmfServices::SnmpAdapter::CCM_TrapCallback local interface.
2215
//
2216
// ==================================================================
2217
//
2218
// IDL:coach.ist/coachEmfServices/SnmpAdapter/TrapCallback/notifyTrap:1.0
2219
//
2220
/**
2221     ** Implementation of the ::coachEmfServices::SnmpAdapter::TrapCallback::notifyTrap operation.
2222     **/

2223    public void
2224    notifyTrap(org.omg.CosNaming.NameComponent JavaDoc[] name,
2225                java.lang.String JavaDoc community,
2226                int trapID, int trapType,
2227            ist.coach.coachEmfServices.SnmpAdapter.DataType[] trapData)
2228    throws intt.itu.itut_x780.ApplicationError, ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError
2229    {
2230        //
2231
// TODO : implement
2232
//
2233

2234        //System.err.println("IpNode_F: Notify trap is called for " +
2235
// Utils.name2string(name));
2236

2237        String JavaDoc key = Utils.name2string(name);
2238
2239        if (this.elements.containsKey(key) == false) {
2240
2241            ApplicationErrorInfoTypeImpl error_code =
2242                new ApplicationErrorInfoTypeImpl();
2243
2244            error_code.error = new UIDType(
2245                intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2246                intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2247
2248            error_code.details = new String JavaDoc ("object with name" +
2249            key + " does not exist.");
2250
2251            throw new ApplicationError(error_code);
2252        }
2253
2254        IpNodeDataStructure data = (IpNodeDataStructure) this.elements.get(key);
2255
2256        intt.itu.itut_x780.OperationalStateType oldValue = data.operationalState;
2257
2258        intt.itu.itut_x780.OperationalStateType newValue = null;
2259
2260
2261        if (trapType == COLDSTART_TRAP) {
2262
2263            newValue = intt.itu.itut_x780.OperationalStateType.enabled;
2264
2265        }
2266        else
2267        if (trapType == NETSNMP_SHUTDOWN_TRAP) {
2268
2269            newValue = intt.itu.itut_x780.OperationalStateType.disabled;
2270
2271        }
2272        else {
2273
2274            System.err.println("IpNode_F does not know how to handle trap of type " +
2275                trapType);
2276
2277            ApplicationErrorInfoTypeImpl error_code =
2278                new ApplicationErrorInfoTypeImpl();
2279
2280            error_code.error = new UIDType(
2281            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2282            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2283
2284            error_code.details = new String JavaDoc ("IpNode_F does not know how to handle" +
2285            " trap of type " + trapType + ".");
2286
2287            throw new ApplicationError(error_code);
2288
2289        }
2290
2291        if (newValue == oldValue) {
2292
2293            //System.err.println("No value change occured. Old value is equal to new one.");
2294

2295            ApplicationErrorInfoTypeImpl error_code =
2296                new ApplicationErrorInfoTypeImpl();
2297
2298            error_code.error = new UIDType(
2299            intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2300            intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2301
2302            error_code.details = new String JavaDoc (" Cannot emmit StateChange Event when no" +
2303                " state change has occured for IpNode with name " +
2304                Utils.name2string(name));
2305
2306            throw new ApplicationError(error_code);
2307        }
2308
2309        data.operationalState = newValue;
2310
2311        long trapTime = 0;
2312        boolean trapTimeFound = false;
2313
2314        for (int i = 0; i < trapData.length; i++) {
2315
2316            if (trapData[i].identifier.equals(TIME_OID)) {
2317
2318                org.omg.CORBA.Any JavaDoc value = trapData[i].value;
2319
2320                if(value.type().kind().value() != TCKind._tk_longlong) {
2321
2322                    ApplicationErrorInfoTypeImpl error_code =
2323                        new ApplicationErrorInfoTypeImpl();
2324
2325                    error_code.error = new UIDType(
2326                        intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2327                        intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2328
2329                    error_code.details = new String JavaDoc ("Could not retrieve event time " +
2330                        " for trap. Object with Snmp Object Identifier " + TIME_OID +
2331                        " is not of type long, as expected.");
2332
2333                    throw new ApplicationError(error_code);
2334
2335                }
2336
2337                trapTime = value.extract_longlong();
2338                trapTimeFound = true;
2339                break;
2340            }
2341
2342        }
2343
2344        if (trapTimeFound == false) {
2345            ApplicationErrorInfoTypeImpl error_code =
2346                new ApplicationErrorInfoTypeImpl();
2347
2348            error_code.error = new UIDType(
2349                intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
2350                intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
2351
2352            error_code.details = new String JavaDoc ("Could not retrieve event time " +
2353                " for trap.");
2354
2355            throw new ApplicationError(error_code);
2356        }
2357
2358        //org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(trapTime, 0,(short) 0,(short) 0);
2359
org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(),
2360                        0,(short) 0,(short) 0);
2361
2362// int notificationId = data.getUniqueNotificationIdentifier();
2363
int notificationId = getUniqueNotificationIdentifier();
2364
2365        String JavaDoc sourceClass = data.objectclass;
2366
2367        SourceIndicatorType sourceIndicator = SourceIndicatorType.unknown;
2368
2369        org.omg.CORBA.Any JavaDoc oldValue_any = orb.create_any();
2370        OperationalStateTypeHelper.insert(oldValue_any, oldValue);
2371
2372        org.omg.CORBA.Any JavaDoc newValue_any = orb.create_any();
2373        OperationalStateTypeHelper.insert(newValue_any, newValue);
2374
2375        AttributeValueChangeType [] changedValues = new AttributeValueChangeType[1];
2376        changedValues[0] = new AttributeValueChangeType(
2377                "operationalState",
2378                oldValue_any,
2379                newValue_any);
2380
2381        StateChangedEventImpl stateChangedEvent = new StateChangedEventImpl(
2382                eventTime,
2383                name,
2384                sourceClass,
2385                notificationId,
2386                sourceIndicator,
2387                //new AttributeValueChangeType[0]);
2388
changedValues);
2389
2390        //System.err.println("IpNodeProvider>Before pushing StateChange event with identifier " +
2391
// stateChangedEvent.notificationIdentifier + " for " +
2392
// Utils.name2string(stateChangedEvent.source) + " of objectclass " +
2393
// stateChangedEvent.sourceClass + " generated after SNMP agent " +
2394
// "has been up for " + stateChangedEvent.eventTime.time +
2395
// " caused by an action of type " + sourceIndicator + "." );
2396

2397        the_context_.push_stateChange(stateChangedEvent);
2398
2399    }
2400
2401     private int getUniqueNotificationIdentifier() {
2402
2403            notifId++;
2404
2405            return (notifId);
2406        }
2407
2408
2409    class IpNodeDataStructure {
2410
2411        public String JavaDoc domainName;
2412        public String JavaDoc hostname;
2413        public byte[] managementIPAddress;
2414        public NameComponent JavaDoc[] name;
2415        public String JavaDoc[] packageNameList;
2416        public int supportedSnmpVersions;
2417        public intt.itu.itut_x780.AdministrativeStateType administrativeState;
2418        public String JavaDoc userLabel;
2419        public String JavaDoc vendorName;
2420        public String JavaDoc version;
2421        public String JavaDoc locationName;
2422        public int snmpPort;
2423        public String JavaDoc sysName;
2424        public String JavaDoc sysContact;
2425        public String JavaDoc objectclass;
2426        public short deletePolicy;
2427        public intt.itu.itut_x780.SourceIndicatorType sourceIndicator;
2428        public intt.itu.itut_x780.OperationalStateType operationalState;
2429
2430        private int notificationIdentifier;
2431
2432        public IpNodeDataStructure (
2433            String JavaDoc domainName,
2434            String JavaDoc hostname,
2435            byte[] managementIPAddress,
2436            NameComponent JavaDoc[] name,
2437            String JavaDoc[] packageNameList,
2438            int supportedSnmpVersions,
2439            intt.itu.itut_x780.AdministrativeStateType administrativeState,
2440            String JavaDoc userLabel,
2441            String JavaDoc vendorName,
2442            String JavaDoc version,
2443            String JavaDoc locationName,
2444            int snmpPort,
2445            String JavaDoc sysName,
2446            String JavaDoc sysContact,
2447            String JavaDoc objectclass,
2448            short deletePolicy,
2449            intt.itu.itut_x780.SourceIndicatorType sourceIndicator,
2450            intt.itu.itut_x780.OperationalStateType operationalState) {
2451
2452            this.domainName = domainName;
2453            this.hostname = hostname;
2454            this.managementIPAddress = managementIPAddress;
2455            this.name = name;
2456            this.packageNameList = packageNameList;
2457            this.supportedSnmpVersions = supportedSnmpVersions;
2458            this.administrativeState = administrativeState;
2459            this.userLabel = userLabel;
2460            this.vendorName = vendorName;
2461            this.version = version;
2462            this.locationName = locationName;
2463            this.snmpPort = snmpPort;
2464            this.sysName = sysName;
2465            this.sysContact = sysContact;
2466            this.objectclass = objectclass;
2467            this.deletePolicy = deletePolicy;
2468            this.sourceIndicator = sourceIndicator;
2469            this.operationalState = operationalState;
2470
2471            this.notificationIdentifier = 0;
2472        }
2473
2474        public int getUniqueNotificationIdentifier() {
2475
2476            this.notificationIdentifier++;
2477
2478            return (this.notificationIdentifier);
2479        }
2480
2481    }
2482}
2483
Popular Tags