KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.omg.CosNaming.NameComponent JavaDoc;
23
24 import ist.coach.coachEmfCommon.Utils;
25 import ist.coach.coachEmfCommon.CreateController;
26 import ist.coach.coachEmfCommon.CreateBindingInfo;
27 import ist.coach.coachEmfCommon.DataTypeImpl;
28 import ist.coach.coachEmfCommon.ExceptionMessages;
29 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
30 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
31
32 import ist.coach.coachEmfServices.SnmpAdapter.DataType;
33 import ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError;
34
35
36 import ist.coach.coachEmsMib.conditionalPackages.sysInfoSetPackageType;
37 import ist.coach.coachEmsMib.LogicalInterfaceFactory;
38 import ist.coach.coachEmsMib.LogicalInterfaceFactoryHelper;
39 import ist.coach.coachEmsMib.IpProtocolMonitorFactory;
40 import ist.coach.coachEmsMib.IpProtocolMonitorFactoryHelper;
41
42 import ist.coach.coachEmsMib.IpNodeFactory;
43 import ist.coach.coachEmsMib.IpNodeFactoryHelper;
44
45 import intt.itu.itut_x780.UIDType;
46 import intt.itu.itut_x780.CreateError;
47 import intt.itu.itut_x780.ApplicationError;
48 import intt.itu.itut_x780.ManagedObjectFactoryHelper;
49 import intt.itu.itut_x780.ManagedObjectFactory;
50
51 import intt.itu.itut_m3120.conditionalPackages.*;
52
53
54 import org.opennms.protocols.snmp.SnmpSMI;
55
56
57 /**
58  ** Implementation skeleton class for the ::coachEmsMibComponents::IpNodeFactoryProvider component.
59  **/

60 public class IpNodeFactoryProviderMonolithicImpl
61        extends org.omg.CORBA.LocalObject JavaDoc
62        implements CCM_IpNodeFactoryProvider,
63                   org.omg.Components.SessionComponent
64 {
65     // ==================================================================
66
//
67
// Internal State.
68
//
69
// ===================================================================
70
/**
71      ** Context reference.
72      **/

73     private CCM_IpNodeFactoryProvider_Context the_context_;
74    /* Business logic **/
75     intt.itu.itut_q816.ContainmentComponent c_admin = null;
76     intt.itu.itut_q816.Containment c_query = null;
77     //ist.coach.coachEmsMib.LogicalInterfaceFactory logicalInterfaceFactory = null;
78

79     private static final String JavaDoc FACTORY_CLASS = "IpNodeFactory";
80     IpNodeMgmt facade = null;
81
82     ist.coach.coachEmfServices.SnmpAdapter.SnmpConnector connector = null;
83
84     private org.omg.CORBA.ORB JavaDoc orb = null;
85
86     private static final String JavaDoc SYS_CONTACT_OID = ".1.3.6.1.2.1.1.4.0";
87     private static final String JavaDoc SYS_NAME_OID = ".1.3.6.1.2.1.1.5.0";
88     private static final String JavaDoc SYS_LOCATION_OID = ".1.3.6.1.2.1.1.6.0";
89     private static final String JavaDoc [] IP_GROUP_OIDS = {
90
91                     IpProtocolMonitorProviderMonolithicImpl.IP_FWD_TYPE_OID,
92                     IpProtocolMonitorProviderMonolithicImpl.IP_DEFAULT_TTL_OID,
93                     IpProtocolMonitorProviderMonolithicImpl.IP_INRECEIVE_OID,
94                     IpProtocolMonitorProviderMonolithicImpl.IP_INHDRERRORS_OID,
95                     IpProtocolMonitorProviderMonolithicImpl.IP_INADDRERRORRS_OID,
96                     IpProtocolMonitorProviderMonolithicImpl.IP_FWDDATAGRAMS_OID,
97                     IpProtocolMonitorProviderMonolithicImpl.IP_INUNKNOWNPROTO_OID,
98                     IpProtocolMonitorProviderMonolithicImpl.IP_INDISCARDS_OID,
99                     IpProtocolMonitorProviderMonolithicImpl.IP_INDELIVERS_OID,
100                     IpProtocolMonitorProviderMonolithicImpl.IP_OUTREQUESTS_OID,
101                     IpProtocolMonitorProviderMonolithicImpl.IP_OUTDISCARDS_OID,
102                     IpProtocolMonitorProviderMonolithicImpl.IP_NOROUTE_OID,
103                     IpProtocolMonitorProviderMonolithicImpl.IP_REASMTIMEOUT_OID,
104                     IpProtocolMonitorProviderMonolithicImpl.IP_REASMREQ_OID,
105                     IpProtocolMonitorProviderMonolithicImpl.IP_REASMOK_OID,
106                     IpProtocolMonitorProviderMonolithicImpl.IP_REASMFAIL_OID,
107                     IpProtocolMonitorProviderMonolithicImpl.IP_FRAGOK_OID,
108                     IpProtocolMonitorProviderMonolithicImpl.IP_FRAGFAIL_OID,
109                     IpProtocolMonitorProviderMonolithicImpl.IP_FRAGCREATE_OID,
110                     IpProtocolMonitorProviderMonolithicImpl.IP_ROUTING_DISCARDS_OID
111     };
112
113     private static final String JavaDoc READ_COMMUNITY = "public";
114     private static final String JavaDoc NO_SUCH_OBJECT = "No Such Object";
115     private static final String JavaDoc NO_SUCH_INSTANCE = "No Such Instance";
116
117     // ==================================================================
118
//
119
// Constructor.
120
//
121
// ===================================================================
122
/**
123      ** The default constructor.
124      **/

125     public
126     IpNodeFactoryProviderMonolithicImpl()
127     {
128         the_context_ = null;
129     }
130     // ==================================================================
131
//
132
// Internal methods.
133
//
134
// ===================================================================
135

136     private int [] getIfTableIndexes(
137         DataType [] ifTable,
138         int tableRows,
139         int[] indexRows) {
140
141         int numOfEntries = ifTable.length;
142         int numOfRows = numOfEntries/tableRows;
143
144         int [] indexes = new int[numOfRows];
145
146         for (int i = 0; i < numOfRows; i++) {
147
148             for (int j = 0; j < indexRows.length; j++) {
149
150                 int position = (indexRows[j] - 1)*numOfRows + i;
151
152                 if (position >= numOfEntries) {
153                     System.err.println("IpNodeFactory: getIfTableIndexes> " +
154                         "Cannot determine table indexes!");
155                     return null;
156                 }
157
158                 indexes[i] = ifTable[position].value.extract_long();
159             }
160         }
161
162         return indexes;
163     }
164
165     private String JavaDoc [] getIfTableIfDescrs(
166         DataType [] ifTable,
167         int tableRows,
168         int [] indexRows) {
169
170         int numOfEntries = ifTable.length;
171         int numOfRows = numOfEntries/tableRows;
172
173         String JavaDoc [] ifDescrs = new String JavaDoc[numOfRows];
174
175         for (int i = 0; i < numOfRows; i++) {
176
177             for (int j = 0; j < indexRows.length; j++) {
178
179                 int position = (indexRows[j] - 1)*numOfRows + i;
180
181                 if (position >= numOfEntries) {
182                     System.err.println("IpNodeFactory: getIfTableIfDescrs> " +
183                           "Cannot determine interface descriptions!");
184                     return null;
185                 }
186                 ifDescrs[i] = new String JavaDoc(
187                 org.omg.CORBA.OctetSeqHelper.extract(ifTable[position].value));
188                 System.err.println("ifDescrs[" + i + "] = " + ifDescrs[i]);
189                 //by digi
190
//ifDescrs[i] = ifTable[position].value.extract_string();
191
}
192         }
193         return ifDescrs;
194     }
195
196     // ==================================================================
197
//
198
// Public methods.
199
//
200
// ===================================================================
201
/**
202      ** To obtain the context.
203      **
204      ** @return The context that has been previously set by
205      ** the set_session_context operation.
206      **/

207     public CCM_IpNodeFactoryProvider_Context
208     getContext()
209     {
210         return the_context_;
211     }
212     // ==================================================================
213
//
214
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
215
//
216
// ==================================================================
217
//
218
//
219
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
220
//
221
/**
222      ** Completes the component configuration.
223      **
224      ** @throws org.omg.Components.InvalidConfiguration
225      ** Thrown if the configuration is invalid.
226      **/

227     public void
228     configuration_complete()
229     throws org.omg.Components.InvalidConfiguration
230     {
231         //
232
// DONE : implement !!!
233
//
234
if ((facade = the_context_.get_connection_facade()) == null)
235             throw new org.omg.Components.InvalidConfiguration();
236
237         if ((c_admin = the_context_.get_connection_containment_admin()) == null)
238             throw new org.omg.Components.InvalidConfiguration();
239
240         if ((c_query = the_context_.get_connection_containment_query()) == null)
241             throw new org.omg.Components.InvalidConfiguration();
242
243             // If managers may create, then the factory must register to the
244
// factory finder service
245
intt.itu.itut_q816.FactoryFinderComponent factoryfinder_admin =
246             the_context_.get_connection_factoryfinder_admin();
247
248         if ((connector = the_context_.get_connection_connector()) == null)
249             throw new org.omg.Components.InvalidConfiguration();
250
251          org.omg.CORBA.Object JavaDoc myself_o;
252          IpNodeFactory myself = null;
253
254         try {
255             myself_o = ((org.omg.Components.SessionContext) the_context_).get_CCM_object();
256             myself = IpNodeFactoryHelper.narrow(myself_o);
257
258             factoryfinder_admin.register(FACTORY_CLASS, myself);
259         }
260         catch(intt.itu.itut_x780.ApplicationError ex) {
261             throw new org.omg.Components.InvalidConfiguration();
262         }
263         catch(Exception JavaDoc e) {
264             System.err.println("IpNodeFactory has problems retrieving CCM component");
265         }
266
267         this.orb = org.objectweb.ccm.CORBA.TheORB.getORB();
268
269         System.err.println("IpNodeFactoryProvider configuration completed...");
270
271     }
272     // ==================================================================
273
//
274
// Methods for the OMG IDL Components::SessionComponent local interface.
275
//
276
// ==================================================================
277
//
278
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
279
//
280
/**
281      * Called by the container when the component session context will be fixed.
282      *
283      * @param context The session context.
284      *
285      * @throws org.omg.Components.CCMException
286      * Thrown if a system level error occured.
287      */

288     public void
289     set_session_context(org.omg.Components.SessionContext context)
290     throws org.omg.Components.CCMException
291     {
292         the_context_ = (CCM_IpNodeFactoryProvider_Context)context;
293     }
294     //
295
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
296
//
297
/**
298      *
299      * Called by the container when the component will be activated.
300      *
301      * @throws org.omg.Components.CCMException
302      * Thrown if a system level error occured.
303      */

304     public void
305     ccm_activate()
306     throws org.omg.Components.CCMException
307     {
308         //
309
// Unused by actual OpenCCM containers
310
//
311
}
312     //
313
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
314
//
315
/**
316      *
317      * Called by the container when the component will be passivated.
318      *
319      * @throws org.omg.Components.CCMException
320      * Thrown if a system level error occured.
321      */

322     public void
323     ccm_passivate()
324     throws org.omg.Components.CCMException
325     {
326         //
327
// Unused by actual OpenCCM containers
328
//
329
}
330     //
331
// IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
332
//
333
/**
334      *
335      * Called by the container when the component will be removed.
336      *
337      * @throws org.omg.Components.CCMException
338      * Thrown if a system level error occured.
339      */

340     public void
341     ccm_remove()
342     throws org.omg.Components.CCMException
343     {
344         //
345
// TO DO: implement !!!
346
//
347
}
348     // ==================================================================
349
//
350
// Public methods for the CCM_IpNodeFactoryProvider local interface.
351
//
352
// ==================================================================
353
//
354
// IDL:coach.ist/coachEmsMib/IpNodeFactory/create_ipNode:1.0
355
//
356
/**
357      ** Implementation of the ::coachEmsMib::IpNodeFactory::create operation.
358      **/

359     public org.omg.CosNaming.NameComponent JavaDoc[]
360     create( java.lang.String JavaDoc nameBinding,
361             org.omg.CosNaming.NameComponent JavaDoc[] superior,
362             java.lang.String JavaDoc reqID,
363             java.lang.String JavaDoc[] packageNameList,
364             java.lang.String JavaDoc domainName,
365             java.lang.String JavaDoc hostname,
366             byte[] managementIPAddress,
367             int supportedSnmpVersions,
368             intt.itu.itut_x780.AdministrativeStateType administrativeState,
369             java.lang.String JavaDoc userLabel,
370             java.lang.String JavaDoc vendorName,
371             java.lang.String JavaDoc version,
372             java.lang.String JavaDoc locationName,
373             int snmpPort,
374             java.lang.String JavaDoc sysName,
375             java.lang.String JavaDoc sysContact)
376     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.CreateError
377     {
378         //
379
// DONE : implement
380
//
381

382         String JavaDoc nameBinding_str = "ist.coach.coachEmsMib.NameBindings." +
383                 nameBinding;
384
385 // String objectKind = CreateController.checkNameBinding(nameBinding_str);
386

387         CreateBindingInfo info = CreateController.checkNameBinding(nameBinding_str);
388
389         String JavaDoc objectKind = info.objectKind;
390         short deletePolicy = info.deletePolicy;
391
392         // Check if the parent exists
393
if (! c_query.exists(superior)) {
394             ApplicationErrorInfoTypeImpl error_code = new ApplicationErrorInfoTypeImpl();
395             error_code.error = new UIDType(
396                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
397                 intt.itu.itut_x780.ApplicationErrorConst.objectNotFound.value);
398
399             error_code.details = Utils.name2string(superior) +
400                             ExceptionMessages.parent_object_error;
401
402             throw new ApplicationError(error_code);
403         }
404
405         // The system must have the capability of auto-naming objects
406
String JavaDoc allocatedId = reqID;
407         if (reqID == null || reqID.length() == 0) {
408
409             org.omg.CosNaming.NameComponent JavaDoc[][] siblings =
410                 c_query.getContained(superior);
411
412                 allocatedId = CreateController.autoCreateId(siblings);
413         }
414
415         // Construct the name of the new object
416
org.omg.CosNaming.NameComponent JavaDoc[] name = CreateController.createFullName(
417                     superior,
418                     allocatedId,
419                     Utils.name2facade(facade.facade_name()),
420                     objectKind);
421
422         // Decide the conditional packages that are supported.
423
String JavaDoc [] supportedConditionalPackages = packageNameList;
424
425         if (packageNameList.length == 0) {
426
427             System.err.println("No packages are specified." +
428                 "Trying to determine supported packages...");
429
430             if (vendorName.equalsIgnoreCase("Linux") ||
431                 vendorName.equalsIgnoreCase("RedHat Linux") ||
432                 vendorName.equalsIgnoreCase("RedHat")) {
433
434                 System.err.println("IpNodeFactoryProvider>Found linux System...");
435
436                 System.err.println("supported packages:");
437                 System.err.println("\t" + sysInfoSetPackageType.value);
438                 System.err.println("\t" + locationNamePackageType.value);
439                 System.err.println("\t" + userLabelPackageType.value);
440                 System.err.println("\t" + vendorNamePackageType.value);
441                 System.err.println("\t" + versionPackageType.value);
442
443                 supportedConditionalPackages = new String JavaDoc[5];
444
445                 supportedConditionalPackages[0] = sysInfoSetPackageType.value;
446                 supportedConditionalPackages[1] = locationNamePackageType.value;
447                 supportedConditionalPackages[2] = userLabelPackageType.value;
448                 supportedConditionalPackages[3] = vendorNamePackageType.value;
449                 supportedConditionalPackages[4] = versionPackageType.value;
450             }
451         }
452         else {
453             System.err.println("Factory will not determine supported conditional Packages," +
454                 " because Manager already specified them.");
455         }
456
457
458         if (Utils.packageIsSupported(sysInfoSetPackageType.value, supportedConditionalPackages)) {
459
460             System.err.println("sysName: " + sysName);
461
462             org.omg.CORBA.Any JavaDoc sysNameValue = orb.create_any();
463             org.omg.CORBA.OctetSeqHelper.insert(sysNameValue, sysName.getBytes());
464
465             DataTypeImpl sysNameDataType = new DataTypeImpl(SYS_NAME_OID,
466               sysNameValue, SnmpSMI.SMI_STRING);
467
468
469                //by digi
470
//sysNameValue.insert_string(sysName);
471
//DataTypeImpl sysNameDataType = new DataTypeImpl(SYS_NAME_OID,
472
// sysNameValue, SnmpSMI.SMI_STRING);
473

474             System.err.println("sysContact: " + sysContact);
475             org.omg.CORBA.Any JavaDoc sysContactValue = orb.create_any();
476             org.omg.CORBA.OctetSeqHelper.insert(sysContactValue, sysName.getBytes());
477
478             DataTypeImpl sysContactDataType = new DataTypeImpl(SYS_CONTACT_OID,
479                 sysNameValue, SnmpSMI.SMI_STRING);
480                 //by digi
481
//sysContactValue.insert_string(sysContact);
482
//DataTypeImpl sysContactDataType = new DataTypeImpl(SYS_CONTACT_OID,
483
//sysContactValue, SnmpSMI.SMI_STRING);
484

485             DataTypeImpl [] sysData = {sysNameDataType, sysContactDataType};
486
487             try {
488                 connector.setBulk(
489                     sysData,
490                     new String JavaDoc(managementIPAddress),
491                     snmpPort,
492                     "private");
493             }
494             catch (SnmpApplicationError e) {
495
496                 CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl();
497                 error_code.error = new UIDType(
498                     intt.itu.itut_x780.CreateErrorConst.moduleName.value,
499                     intt.itu.itut_x780.CreateErrorConst.unsupportedPackages.value);
500
501                     error_code.details = e.reason;
502
503                  throw new CreateError(error_code);
504             }
505             catch(Exception JavaDoc e) {
506               System.err.println("IpNodeFactory> Exception caught:" + e.getMessage());
507               e.printStackTrace(System.err);
508             }
509         }
510
511         if (Utils.packageIsSupported(locationNamePackageType.value, supportedConditionalPackages)) {
512
513             org.omg.CORBA.Any JavaDoc sysLocationValue = orb.create_any();
514
515             org.omg.CORBA.OctetSeqHelper.insert(sysLocationValue, locationName.getBytes());
516
517            // by digi
518
//sysLocationValue.insert_string(locationName);
519
DataTypeImpl sysLocationDataType = new DataTypeImpl(SYS_LOCATION_OID,
520                 sysLocationValue, SnmpSMI.SMI_STRING);
521
522             try {
523                 connector.set(
524                     sysLocationDataType,
525                     new String JavaDoc(managementIPAddress),
526                     snmpPort,
527                     "private");
528             }
529             catch (SnmpApplicationError e) {
530
531              CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl();
532              error_code.error = new UIDType(
533                  intt.itu.itut_x780.CreateErrorConst.moduleName.value,
534                  intt.itu.itut_x780.CreateErrorConst.unsupportedPackages.value);
535
536              error_code.details = e.reason;
537              throw new CreateError(error_code);
538             }
539             catch (Exception JavaDoc e) {
540               System.err.println("System exception caught:" + e.getMessage());
541               e.printStackTrace(System.err);
542             }
543
544         }
545
546         System.err.println("IpNodeFactory> Before invoking the facade " +
547                     Utils.name2facade(facade.facade_name()) + " to create " + Utils.name2string(name));
548
549         //facade.create(name, objectKind, new String[0], deletePolicy,
550
facade.create(name, objectKind, supportedConditionalPackages, deletePolicy,
551                     intt.itu.itut_x780.SourceIndicatorType.managementOperation,
552                     domainName,
553                     hostname,
554                     managementIPAddress,
555                     supportedSnmpVersions,
556                     administrativeState,
557                     userLabel,
558                     vendorName,
559                     version,
560                     locationName,
561                     (short)snmpPort,
562                     sysName,
563                     sysContact);
564
565          System.err.println("IpNodeFactory>Before registering to the containment service");
566             c_admin.addName(name, superior);
567         System.err.println("IpNodeFactory>After registering to the containment service");
568
569         // HACK: digi: Maybe a utility class would be better...
570
// Code below is not good. Written just for testing.
571

572         DataType[] ifTable = new DataType[0];
573         try {
574             ifTable = this.connector.getSnmpTable(
575                 LogicalInterfaceProviderMonolithicImpl.IF_TABLE_OID,
576                     new String JavaDoc(managementIPAddress),
577                     snmpPort,
578                 "public");
579         }
580         catch(ist.coach.coachEmfServices.SnmpAdapter.SnmpApplicationError snmp_ex) {
581             System.err.println("SnmpApplicationError caught> " +
582                         snmp_ex.reason);
583                 return name;
584         }
585         catch(Exception JavaDoc e) {
586           System.err.println("IpNodeFactory: create>Exception caught: " + e.getMessage());
587           e.printStackTrace(System.err);
588         }
589
590         int[] indexRows = { 1 };
591         int [] ifTableIndexes = getIfTableIndexes(ifTable,
592             18, indexRows);
593
594         int[] ifDescrIndexRows = { 2 };
595         String JavaDoc [] ifTableIfDescrs = getIfTableIfDescrs(ifTable,
596             18, ifDescrIndexRows);
597
598         if (ifTableIndexes == null) {
599             System.err.println("Indexes could not be determined for" +
600                 " Logical Interfaces. No Logical Interface objects will" +
601                 " be created.");
602         }
603         else
604         if (ifTableIndexes.length == 0)
605             System.err.println("No LogicalInterface objects found");
606         else
607         if (ifTableIfDescrs.length == 0)
608             System.err.println("Could not determine interface descriptions " +
609                 "for Logical Interface Objects");
610         else
611         if (ifTableIfDescrs.length != ifTableIndexes.length)
612             System.err.println("Mapping of ifDescr is not one-to-one with " +
613                 "Logical Interface objects");
614         else {
615
616             LogicalInterfaceFactory lif =
617               the_context_.get_connection_logicalInterfaceFactory();
618
619             if (lif == null)
620                 System.err.println("Factory is null..." +
621                     " No LogicalInterface Objects will be created.");
622             else {
623
624                 System.err.println("IpNodeFactoryProvider>******FOUND " +
625                     ifTableIndexes.length +
626                     " LogicalInterface Objects");
627
628                 String JavaDoc [] logicalInterfacePackages = new String JavaDoc[0];
629
630                 if (vendorName.equalsIgnoreCase("Linux") ||
631                     vendorName.equalsIgnoreCase("RedHat Linux") ||
632                     vendorName.equalsIgnoreCase("RedHat")) {
633
634                     System.err.println("IpNodeFactoryProvider:create> Found linux System..." +
635                         "No package is supported for LogicalInterface");
636                 }
637
638                 for (int i = 0; i < ifTableIndexes.length; i++) {
639                     lif.create(
640                         "LogicalInterface_IpNode",
641                         name,
642                         ifTableIfDescrs[i],
643                         logicalInterfacePackages,
644                         ifTableIndexes[i],
645                         managementIPAddress,
646                         snmpPort,
647                         supportedSnmpVersions,
648                         ifTableIfDescrs[i]);
649                 }
650             }
651         }
652
653         // IpProtocolMonitor creation
654
try {
655
656             DataType[] res = this.connector.getBulk(
657                     IP_GROUP_OIDS,
658                     new String JavaDoc(managementIPAddress),
659                     snmpPort,
660                     READ_COMMUNITY);
661
662             int count = 0;
663
664             for (int i = 0; i < res.length; i++) {
665                 try {
666                     if ( (res[i].value.extract_string().equalsIgnoreCase(
667                         NO_SUCH_OBJECT)) ||
668                         (res[i].value.extract_string().equalsIgnoreCase(
669                         NO_SUCH_INSTANCE)) )
670                     count ++;
671                 }
672                 catch (org.omg.CORBA.BAD_OPERATION JavaDoc badOp) {
673                     // If a string cannot be extracted, then the result
674
// will not be "No Such Object", or "No Such Instance"
675
// so no problem then! Catch this exception and ignore it.
676
}
677             }
678
679             if (count < res.length) {
680                 //System.err.println("IpProtocolMonitor must be created.");
681

682                 IpProtocolMonitorFactory ipf =
683                    the_context_.get_connection_ipProtocolMonitorFactory();
684
685                 if (ipf == null) {
686                     System.err.println("IpProtocolMonitorFactory is null..." +
687                         " No IpProtocolMonitor Object will be created!");
688                 }
689                 else {
690                     System.err.println("Invoking IpProtocolMonitorFactory...");
691
692                     String JavaDoc [] ipProtocolMonitorPackages = new String JavaDoc[0];
693
694                     if (vendorName.equalsIgnoreCase("Linux") ||
695                         vendorName.equalsIgnoreCase("RedHat Linux") ||
696                         vendorName.equalsIgnoreCase("RedHat")) {
697
698                         //System.err.println("Found linux System..." +
699
// "No package is supported for IpProtocolMonitor");
700
}
701
702                     ipf.create(
703                         "IpProtocolMonitor_IpNode",
704                         name,
705                         "IpProtocol",
706                         ipProtocolMonitorPackages,
707                         managementIPAddress,
708                         snmpPort,
709                         supportedSnmpVersions
710                     );
711
712                 }
713             } // IpProtocolMonitor must be created
714
}
715         catch (SnmpApplicationError e) {
716             System.err.println("\nIpNodeFactory:SnmpApplicationError while trying to create IpProtocolMonitorFactory");
717             System.err.println("Reason:" + e.reason);
718             // Continue to create other objects, if possible...
719
}
720         System.err.println("IpNodeFactory>create returns for " + Utils.name2string(name));
721
722
723         return name;
724
725     }
726
727
728 /*** TEMP ******/
729     // ==================================================================
730
//
731
// Public methods for the CCM_ManagedObjectFactoryProvider local interface.
732
//
733
// ==================================================================
734
public org.omg.CosNaming.NameComponent JavaDoc[]
735     create_base(String JavaDoc nameBinding,
736                 org.omg.CosNaming.NameComponent JavaDoc[] superior,
737                 String JavaDoc reqId)
738     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.CreateError {
739
740         return new NameComponent JavaDoc[0];
741     }
742 }
743
Popular Tags