KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > itut_m3120Components > ManagedElementProviderMonolithicImpl


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.itut_m3120Components;
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 import intt.itu.itut_m3120.ManagedElementValueType;
37
38 import ist.coach.coachEmfCommon.Utils;
39 import ist.coach.coachEmfCommon.StateChangedEventImpl;
40 import ist.coach.coachEmfCommon.ObjectCreationImpl;
41 import ist.coach.coachEmfCommon.ObjectDeletionImpl;
42 import ist.coach.coachEmfCommon.ExceptionMessages;
43 import ist.coach.coachEmfCommon.CreateErrorInfoTypeImpl;
44 import ist.coach.coachEmfCommon.ApplicationErrorInfoTypeImpl;
45 import ist.coach.coachEmfCommon.ManagedElementValueTypeImpl;
46 import java.util.Hashtable JavaDoc;
47
48 /**
49  ** Implementation skeleton class for the ::itut_m3120Components::ManagedElementProvider component.
50  ** Business operations MUST be completed !!!
51  **/

52 public class ManagedElementProviderMonolithicImpl
53        extends org.omg.CORBA.LocalObject JavaDoc
54        implements CCM_ManagedElementProvider,
55                   ist.coach.itut_m3120Components.CCM_ManagedElementMgmt,
56                   org.omg.Components.SessionComponent
57 {
58     // ==================================================================
59
//
60
// Internal State.
61
//
62
// ===================================================================
63
/**
64      ** Context reference.
65      **/

66     private CCM_ManagedElementProvider_Context the_context_;
67     private String JavaDoc _facade_name;
68     private int notifId = 200;
69     private Hashtable JavaDoc elements;
70     // ==================================================================
71
//
72
// Constructor.
73
//
74
// ===================================================================
75
/**
76      ** The default constructor.
77      **/

78     public
79     ManagedElementProviderMonolithicImpl()
80     {
81         the_context_ = null;
82     }
83     // ==================================================================
84
//
85
// Internal methods.
86
//
87
// ===================================================================
88
// ==================================================================
89
//
90
// Public methods.
91
//
92
// ===================================================================
93
/**
94      ** To obtain the context.
95      **
96      ** @return The context that has been previously set by
97      ** the set_session_context operation.
98      **/

99     public CCM_ManagedElementProvider_Context
100     getContext()
101     {
102         return the_context_;
103     }
104     // ==================================================================
105
//
106
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
107
//
108
// ==================================================================
109
//
110
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
111
//
112
/**
113      ** Completes the component configuration.
114      **
115      ** @throws org.omg.Components.InvalidConfiguration
116      ** Thrown if the configuration is invalid.
117      **/

118     public void
119     configuration_complete()
120     throws org.omg.Components.InvalidConfiguration
121     {
122         //
123
// DONE : implement !!!
124
//
125
elements = new java.util.Hashtable JavaDoc();
126         System.err.println(facade_name() + " configuration completed...");
127     }
128     // ==================================================================
129
//
130
// Methods for the OMG IDL Components::SessionComponent local interface.
131
//
132
// ==================================================================
133
//
134
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
135
//
136
/**
137      * Called by the container when the component session context will be fixed.
138      *
139      * @param context The session context.
140      *
141      * @throws org.omg.Components.CCMException
142      * Thrown if a system level error occured.
143      */

144     public void
145     set_session_context(org.omg.Components.SessionContext context)
146     throws org.omg.Components.CCMException
147     {
148         the_context_ = (CCM_ManagedElementProvider_Context)context;
149     }
150     //
151
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
152
//
153
/**
154      *
155      * Called by the container when the component will be activated.
156      *
157      * @throws org.omg.Components.CCMException
158      * Thrown if a system level error occured.
159      */

160     public void
161     ccm_activate()
162     throws org.omg.Components.CCMException
163     {
164         //
165
// Unused by actual OpenCCM containers
166
//
167
}
168     //
169
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
170
//
171
/**
172      *
173      * Called by the container when the component will be passivated.
174      *
175      * @throws org.omg.Components.CCMException
176      * Thrown if a system level error occured.
177      */

178     public void
179     ccm_passivate()
180     throws org.omg.Components.CCMException
181     {
182         //
183
// Unused by actual OpenCCM containers
184
//
185
}
186     //
187
// IDL:omg.org/Components/SessionComponent/ccm_remove:1.0
188
//
189
/**
190      *
191      * Called by the container when the component will be removed.
192      *
193      * @throws org.omg.Components.CCMException
194      * Thrown if a system level error occured.
195      */

196     public void
197     ccm_remove()
198     throws org.omg.Components.CCMException
199     {
200         //
201
// TO DO: implement !!!
202
//
203
}
204     // ==================================================================
205
//
206
// Public methods for the CCM_ManagedElementProvider local interface.
207
//
208
// ==================================================================
209
//
210
// IDL:coach.ist/itut_m3120Components/CCM_ManagedElementProvider/get_mgmt:1.0
211
//
212
/**
213      ** Implementation of the ::itut_m3120Components::CCM_ManagedElementProvider::get_mgmt operation.
214      **/

215     public ist.coach.itut_m3120Components.CCM_ManagedElementMgmt
216     get_mgmt()
217     {
218         return this;
219     }
220     //
221
// IDL:coach.ist/itut_x780Components/CCM_NamedComponent_Executor/facade_name:1.0
222
//
223
/**
224      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as accessor operation.
225      **/

226     public java.lang.String JavaDoc
227     facade_name()
228     {
229         //
230
// DONE : implement
231
//
232
return _facade_name;
233     }
234
235     /**
236      ** Implementation of the ::itut_x780Components::CCM_NamedComponent_Executor::facade_name attribute as mutator operation.
237      **/

238     public void
239     facade_name(java.lang.String JavaDoc val)
240     {
241         //
242
// DONE : implement
243
//
244
if (val != null)
245             _facade_name = new String JavaDoc(val);
246     }
247     //
248
// IDL:itu.intt/itut_m3120/ManagedElement_F/administrativeStateGet:1.0
249
//
250
/**
251      ** Implementation of the ::itut_m3120::ManagedElement_F::administrativeStateGet operation.
252      **/

253     public intt.itu.itut_x780.AdministrativeStateType
254     administrativeStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
255     throws intt.itu.itut_x780.ApplicationError
256     {
257         //
258
// DONE: implement
259
//
260
String JavaDoc key = Utils.name2string(name);
261         if (this.elements.containsKey(key) == false) {
262
263           ApplicationErrorInfoTypeImpl error_code =
264             new ApplicationErrorInfoTypeImpl();
265
266           error_code.error = new UIDType(
267             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
268             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
269
270           error_code.details = new String JavaDoc ("object with name" +
271             key + " does not exist.");
272
273           throw new ApplicationError(error_code);
274        }
275        ManagedElementValueType mo_value =
276         (ManagedElementValueType) elements.get(key);
277
278         return mo_value.administrativeState;
279     }
280     //
281
// IDL:itu.intt/itut_m3120/ManagedElement_F/administrativeStateSet:1.0
282
//
283
/**
284      ** Implementation of the ::itut_m3120::ManagedElement_F::administrativeStateSet operation.
285      **/

286     public void
287     administrativeStateSet(org.omg.CosNaming.NameComponent JavaDoc[] name,
288     intt.itu.itut_x780.AdministrativeStateType administrativeState)
289     throws intt.itu.itut_x780.ApplicationError
290     {
291         //
292
// DONE : implement
293
//
294
String JavaDoc key = Utils.name2string(name);
295         if (this.elements.containsKey(key) == false) {
296
297           ApplicationErrorInfoTypeImpl error_code =
298             new ApplicationErrorInfoTypeImpl();
299
300           error_code.error = new UIDType(
301             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
302             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
303
304           error_code.details = new String JavaDoc ("object with name " +
305             key + " does not exist.");
306
307           throw new ApplicationError(error_code);
308         }
309         ManagedElementValueType mo_value =
310         (ManagedElementValueType) elements.remove(key);
311         mo_value.administrativeState = administrativeState;
312         elements.put(key, mo_value);
313     }
314     //
315
// IDL:itu.intt/itut_m3120/ManagedElement_F/operationalStateGet:1.0
316
//
317
/**
318      ** Implementation of the ::itut_m3120::ManagedElement_F::operationalStateGet operation.
319      **/

320     public intt.itu.itut_x780.OperationalStateType
321     operationalStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
322     throws intt.itu.itut_x780.ApplicationError
323     {
324         //
325
// DONE : implement
326
//
327
String JavaDoc key = Utils.name2string(name);
328         if (this.elements.containsKey(key) == false) {
329
330           ApplicationErrorInfoTypeImpl error_code =
331             new ApplicationErrorInfoTypeImpl();
332
333           error_code.error = new UIDType(
334             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
335             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
336
337           error_code.details = new String JavaDoc ("object with name" +
338             key + " does not exist.");
339
340           throw new ApplicationError(error_code);
341        }
342        ManagedElementValueType mo_value =
343         (ManagedElementValueType) elements.get(key);
344
345         return mo_value.operationalState;
346
347     }
348
349     //
350
// IDL:itu.intt/itut_m3120/ManagedElement_F/usageStateGet:1.0
351
//
352
/**
353      ** Implementation of the ::itut_m3120::ManagedElement_F::usageStateGet operation.
354      **/

355     public intt.itu.itut_x780.UsageStateType
356     usageStateGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
357     throws intt.itu.itut_x780.ApplicationError
358     {
359         //
360
// DONE : implement
361
//
362
String JavaDoc key = Utils.name2string(name);
363         if (this.elements.containsKey(key) == false) {
364
365           ApplicationErrorInfoTypeImpl error_code =
366             new ApplicationErrorInfoTypeImpl();
367
368           error_code.error = new UIDType(
369             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
370             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
371
372           error_code.details = new String JavaDoc ("object with name" +
373             key + " does not exist.");
374
375           throw new ApplicationError(error_code);
376        }
377        ManagedElementValueType mo_value =
378         (ManagedElementValueType) elements.get(key);
379
380         return mo_value.usageState;
381
382     }
383     //
384
// IDL:itu.intt/itut_m3120/ManagedElement_F/userLabelGet:1.0
385
//
386
/**
387      ** Implementation of the ::itut_m3120::ManagedElement_F::userLabelGet operation.
388      **/

389     public java.lang.String JavaDoc
390     userLabelGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
391     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException
392     {
393         //
394
// DONE : implement
395
//
396
String JavaDoc key = Utils.name2string(name);
397         if (this.elements.containsKey(key) == false) {
398
399           ApplicationErrorInfoTypeImpl error_code =
400             new ApplicationErrorInfoTypeImpl();
401
402           error_code.error = new UIDType(
403             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
404             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
405
406           error_code.details = new String JavaDoc ("object with name" +
407             key + " does not exist.");
408
409           throw new ApplicationError(error_code);
410        }
411        ManagedElementValueType mo_value =
412         (ManagedElementValueType) elements.get(key);
413
414         return mo_value.userLabel;
415
416     }
417     //
418
// IDL:itu.intt/itut_m3120/ManagedElement_F/userLabelSet:1.0
419
//
420
/**
421      ** Implementation of the ::itut_m3120::ManagedElement_F::userLabelSet operation.
422      **/

423     public void
424     userLabelSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc userLabel)
425     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOuserLabelPackageException
426     {
427         //
428
// DONE : implement
429
//
430
String JavaDoc key = Utils.name2string(name);
431         if (this.elements.containsKey(key) == false) {
432
433           ApplicationErrorInfoTypeImpl error_code =
434             new ApplicationErrorInfoTypeImpl();
435
436           error_code.error = new UIDType(
437             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
438             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
439
440           error_code.details = new String JavaDoc ("object with name " +
441             key + " does not exist.");
442
443           throw new ApplicationError(error_code);
444         }
445         ManagedElementValueType mo_value =
446         (ManagedElementValueType) elements.remove(key);
447         mo_value.userLabel = userLabel;
448         elements.put(key, mo_value);
449     }
450     //
451
// IDL:itu.intt/itut_m3120/ManagedElement_F/vendorNameGet:1.0
452
//
453
/**
454      ** Implementation of the ::itut_m3120::ManagedElement_F::vendorNameGet operation.
455      **/

456     public java.lang.String JavaDoc
457     vendorNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
458     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException
459     {
460         //
461
// DONE : implement
462
//
463
String JavaDoc key = Utils.name2string(name);
464         if (this.elements.containsKey(key) == false) {
465
466           ApplicationErrorInfoTypeImpl error_code =
467             new ApplicationErrorInfoTypeImpl();
468
469           error_code.error = new UIDType(
470             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
471             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
472
473           error_code.details = new String JavaDoc ("object with name" +
474             key + " does not exist.");
475
476           throw new ApplicationError(error_code);
477        }
478        ManagedElementValueType mo_value =
479         (ManagedElementValueType) elements.get(key);
480
481         return mo_value.vendorName;
482
483     }
484     //
485
// IDL:itu.intt/itut_m3120/ManagedElement_F/vendorNameSet:1.0
486
//
487
/**
488      ** Implementation of the ::itut_m3120::ManagedElement_F::vendorNameSet operation.
489      **/

490     public void
491     vendorNameSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc vendorName)
492     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOvendorNamePackageException
493     {
494         //
495
// DONE : implement
496
//
497
String JavaDoc key = Utils.name2string(name);
498         if (this.elements.containsKey(key) == false) {
499
500           ApplicationErrorInfoTypeImpl error_code =
501             new ApplicationErrorInfoTypeImpl();
502
503           error_code.error = new UIDType(
504             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
505             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
506
507           error_code.details = new String JavaDoc ("object with name " +
508             key + " does not exist.");
509
510           throw new ApplicationError(error_code);
511         }
512         ManagedElementValueType mo_value =
513         (ManagedElementValueType) elements.remove(key);
514         mo_value.vendorName = vendorName;
515         elements.put(key, mo_value);
516     }
517     //
518
// IDL:itu.intt/itut_m3120/ManagedElement_F/versionGet:1.0
519
//
520
/**
521      ** Implementation of the ::itut_m3120::ManagedElement_F::versionGet operation.
522      **/

523     public java.lang.String JavaDoc
524     versionGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
525     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException
526     {
527         //
528
// DONE : implement
529
//
530
String JavaDoc key = Utils.name2string(name);
531         if (this.elements.containsKey(key) == false) {
532
533           ApplicationErrorInfoTypeImpl error_code =
534             new ApplicationErrorInfoTypeImpl();
535
536           error_code.error = new UIDType(
537             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
538             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
539
540           error_code.details = new String JavaDoc ("object with name" +
541             key + " does not exist.");
542
543           throw new ApplicationError(error_code);
544        }
545        ManagedElementValueType mo_value =
546         (ManagedElementValueType) elements.get(key);
547
548         return mo_value.version;
549     }
550     //
551
// IDL:itu.intt/itut_m3120/ManagedElement_F/versionSet:1.0
552
//
553
/**
554      ** Implementation of the ::itut_m3120::ManagedElement_F::versionSet operation.
555      **/

556     public void
557     versionSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc version)
558     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOversionPackageException
559     {
560         //
561
// DONE : implement
562
//
563
String JavaDoc key = Utils.name2string(name);
564         if (this.elements.containsKey(key) == false) {
565
566           ApplicationErrorInfoTypeImpl error_code =
567             new ApplicationErrorInfoTypeImpl();
568
569           error_code.error = new UIDType(
570             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
571             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
572
573           error_code.details = new String JavaDoc ("object with name " +
574             key + " does not exist.");
575
576           throw new ApplicationError(error_code);
577         }
578         ManagedElementValueType mo_value =
579         (ManagedElementValueType) elements.remove(key);
580         mo_value.version = version;
581         elements.put(key, mo_value);
582
583     }
584     //
585
// IDL:itu.intt/itut_m3120/ManagedElement_F/locationNameGet:1.0
586
//
587
/**
588      ** Implementation of the ::itut_m3120::ManagedElement_F::locationNameGet operation.
589      **/

590     public java.lang.String JavaDoc
591     locationNameGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
592     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException
593     {
594         //
595
// DONE : implement
596
//
597
String JavaDoc key = Utils.name2string(name);
598         if (this.elements.containsKey(key) == false) {
599
600           ApplicationErrorInfoTypeImpl error_code =
601             new ApplicationErrorInfoTypeImpl();
602
603           error_code.error = new UIDType(
604             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
605             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
606
607           error_code.details = new String JavaDoc ("object with name" +
608             key + " does not exist.");
609
610           throw new ApplicationError(error_code);
611        }
612        ManagedElementValueType mo_value =
613         (ManagedElementValueType) elements.get(key);
614
615         return mo_value.locationName;
616
617     }
618     //
619
// IDL:itu.intt/itut_m3120/ManagedElement_F/locationNameSet:1.0
620
//
621
/**
622      ** Implementation of the ::itut_m3120::ManagedElement_F::locationNameSet operation.
623      **/

624     public void
625     locationNameSet(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc locationName)
626     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_m3120.NOlocationNamePackageException
627     {
628         //
629
// DONE : implement
630
//
631
String JavaDoc key = Utils.name2string(name);
632         if (this.elements.containsKey(key) == false) {
633
634           ApplicationErrorInfoTypeImpl error_code =
635             new ApplicationErrorInfoTypeImpl();
636
637           error_code.error = new UIDType(
638             intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
639             intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
640
641           error_code.details = new String JavaDoc ("object with name " +
642             key + " does not exist.");
643
644           throw new ApplicationError(error_code);
645         }
646         ManagedElementValueType mo_value =
647         (ManagedElementValueType) elements.remove(key);
648         mo_value.locationName = locationName;
649         elements.put(key, mo_value);
650     }
651     //
652
// IDL:itu.intt/itut_x780/ManagedObject_F/nameGet:1.0
653
//
654
/**
655      ** Implementation of the ::itut_x780::ManagedObject_F::nameGet operation.
656      **/

657     public org.omg.CosNaming.NameComponent JavaDoc[]
658     nameGet()
659     {
660         //
661
// DONE : implement
662
//
663
return Utils.string2name(_facade_name);
664     }
665     //
666
// IDL:itu.intt/itut_x780/ManagedObject_F/objectClassGet:1.0
667
//
668
/**
669      ** Implementation of the ::itut_x780::ManagedObject_F::objectClassGet operation.
670      **/

671     public java.lang.String JavaDoc
672     objectClassGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
673     throws intt.itu.itut_x780.ApplicationError
674     {
675         //
676
// DONE : implement
677
//
678
if ( ! elements.containsKey(Utils.name2string(name))) {
679             ApplicationErrorInfoTypeImpl error_code =
680                     new ApplicationErrorInfoTypeImpl();
681             error_code.error = new UIDType(
682                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
683                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
684             error_code.details = ExceptionMessages.not_exists_error;
685
686             throw new ApplicationError(error_code);
687         }
688         ManagedObjectValueType mo_value =
689             (ManagedObjectValueType) elements.get(Utils.name2string(name));
690         return mo_value.objectClass;
691     }
692     //
693
// IDL:itu.intt/itut_x780/ManagedObject_F/attributesGet:1.0
694
//
695
/**
696      ** Implementation of the ::itut_x780::ManagedObject_F::attributesGet operation.
697      **/

698     public intt.itu.itut_x780.ManagedObjectValueType
699     attributesGet(org.omg.CosNaming.NameComponent JavaDoc[] name, intt.itu.itut_x780.StringSetTypeHolder attributeNames)
700     throws intt.itu.itut_x780.ApplicationError
701     {
702         //
703
// DONE : implement
704
//
705
if ( ! elements.containsKey(Utils.name2string(name))) {
706             ApplicationErrorInfoTypeImpl error_code =
707                     new ApplicationErrorInfoTypeImpl();
708             error_code.error = new UIDType(
709                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
710                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
711             error_code.details = ExceptionMessages.not_exists_error;
712
713             throw new ApplicationError(error_code);
714         }
715         ManagedElementValueType mo_value =
716             (ManagedElementValueType) elements.get(Utils.name2string(name));
717         return mo_value;
718     }
719     //
720
// IDL:itu.intt/itut_x780/ManagedObject_F/packagesGet:1.0
721
//
722
/**
723      ** Implementation of the ::itut_x780::ManagedObject_F::packagesGet operation.
724      **/

725     public java.lang.String JavaDoc[]
726     packagesGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
727     throws intt.itu.itut_x780.ApplicationError
728     {
729         //
730
// DONE : implement
731
//
732
if ( ! elements.containsKey(Utils.name2string(name))) {
733             ApplicationErrorInfoTypeImpl error_code =
734                     new ApplicationErrorInfoTypeImpl();
735             error_code.error = new UIDType(
736                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
737                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
738                 error_code.details = ExceptionMessages.not_exists_error;
739
740             throw new ApplicationError(error_code);
741         }
742         ManagedObjectValueType mo_value =
743             (ManagedObjectValueType) elements.get(Utils.name2string(name));
744         return mo_value.packages;
745     }
746     //
747
// IDL:itu.intt/itut_x780/ManagedObject_F/creationSourceGet:1.0
748
//
749
/**
750      ** Implementation of the ::itut_x780::ManagedObject_F::creationSourceGet operation.
751      **/

752     public intt.itu.itut_x780.SourceIndicatorType
753     creationSourceGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
754     throws intt.itu.itut_x780.ApplicationError
755     {
756         //
757
// DONE : implement
758
//
759
if ( ! elements.containsKey(Utils.name2string(name))) {
760             ApplicationErrorInfoTypeImpl error_code =
761                     new ApplicationErrorInfoTypeImpl();
762             error_code.error = new UIDType(
763                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
764                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
765                 error_code.details = ExceptionMessages.not_exists_error;
766
767             throw new ApplicationError(error_code);
768         }
769         ManagedObjectValueType mo_value =
770             (ManagedObjectValueType) elements.get(Utils.name2string(name));
771         return mo_value.creationSource;
772     }
773     //
774
// IDL:itu.intt/itut_x780/ManagedObject_F/deletePolicyGet:1.0
775
//
776
/**
777      ** Implementation of the ::itut_x780::ManagedObject_F::deletePolicyGet operation.
778      **/

779     public short
780     deletePolicyGet(org.omg.CosNaming.NameComponent JavaDoc[] name)
781     throws intt.itu.itut_x780.ApplicationError
782     {
783         //
784
// DONE : implement
785
//
786
if ( ! elements.containsKey(Utils.name2string(name))) {
787             ApplicationErrorInfoTypeImpl error_code =
788                     new ApplicationErrorInfoTypeImpl();
789             error_code.error = new UIDType(
790                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
791                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
792                 error_code.details = ExceptionMessages.not_exists_error;
793
794             throw new ApplicationError(error_code);
795         }
796         ManagedObjectValueType mo_value =
797             (ManagedObjectValueType) elements.get(Utils.name2string(name));
798         return mo_value.deletePolicy;
799
800     }
801     //
802
// IDL:itu.intt/itut_x780/ManagedObject_F/destroy:1.0
803
//
804
/**
805      ** Implementation of the ::itut_x780::ManagedObject_F::destroy operation.
806      **/

807     public void
808     destroy(org.omg.CosNaming.NameComponent JavaDoc[] name)
809     throws intt.itu.itut_x780.ApplicationError, intt.itu.itut_x780.DeleteError
810     {
811         //
812
// DONE : implement
813
//
814
if ( ! elements.containsKey(Utils.name2string(name))) {
815             ApplicationErrorInfoTypeImpl error_code =
816                     new ApplicationErrorInfoTypeImpl();
817             error_code.error = new UIDType(
818                 intt.itu.itut_x780.ApplicationErrorConst.moduleName.value,
819                 intt.itu.itut_x780.ApplicationErrorConst.invalidParameter.value);
820                 error_code.details = ExceptionMessages.not_exists_error;
821
822             throw new ApplicationError(error_code);
823
824         }
825         ManagedElementValueType mo_value =
826             (ManagedElementValueType) elements.remove(Utils.name2string(name));
827         org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(),
828                     0,(short) 0,(short) 0);
829         the_context_.push_objectDeletion_alarm(new ObjectDeletionImpl(eventTime, name,
830                                         mo_value.objectClass,
831                                         getUniqueNotificationIdentifier(),
832                                         mo_value.creationSource,
833                                         new AttributeValueType[0]));
834     }
835     // ==================================================================
836
//
837
// Public methods for the ::itut_m3120Components::CCM_ManagedElementMgmt local interface.
838
//
839
// ==================================================================
840
//
841
// IDL:coach.ist/itut_m3120Components/ManagedElementMgmt/create:1.0
842
//
843
/**
844      ** Implementation of the ::itut_m3120Components::ManagedElementMgmt::create operation.
845      **/

846     public void
847     create(org.omg.CosNaming.NameComponent JavaDoc[] name, java.lang.String JavaDoc objectClass,
848           java.lang.String JavaDoc[] packages, short deletePolicy,
849           intt.itu.itut_x780.SourceIndicatorType sourceIndicator,
850           intt.itu.itut_x780.AdministrativeStateType administrativeState,
851           java.lang.String JavaDoc userLabel, java.lang.String JavaDoc vendorName,
852           java.lang.String JavaDoc version, java.lang.String JavaDoc locationName)
853     throws intt.itu.itut_x780.CreateError, intt.itu.itut_x780.ApplicationError
854     {
855         //
856
// DONE : implement
857
//
858
if (elements.containsKey(Utils.name2string(name))) {
859             System.err.println(Utils.name2string(name) + " already exists!");
860             CreateErrorInfoTypeImpl error_code = new CreateErrorInfoTypeImpl();
861             error_code.error = new UIDType(
862                 intt.itu.itut_x780.CreateErrorConst.moduleName.value,
863                 intt.itu.itut_x780.CreateErrorConst.duplicateName.value);
864
865             error_code.details = ExceptionMessages.already_exists_error;
866             throw new CreateError(error_code);
867         }
868         ManagedElementValueTypeImpl value_type =
869                 new ManagedElementValueTypeImpl(name, objectClass, packages,
870                         sourceIndicator, deletePolicy, administrativeState,
871                         userLabel, vendorName, version, locationName);
872
873         elements.put(Utils.name2string(name), value_type);
874
875         org.omg.TimeBase.UtcT eventTime = new org.omg.TimeBase.UtcT(System.currentTimeMillis(),
876                     0,(short) 0,(short) 0);
877
878         //System.err.println("ManagedElementProvider attempts to push object creation alarm...");
879
the_context_.push_objectCreation_alarm(new ObjectCreationImpl(eventTime, name,
880                                         objectClass,
881                                         getUniqueNotificationIdentifier(),
882                                         sourceIndicator,
883                                         new AttributeValueType[0]));
884
885     }
886    private int getUniqueNotificationIdentifier() {
887
888        notifId++;
889
890        return (notifId);
891    }
892 }
893
Popular Tags