KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ist > coach > coachEmfServicesComponents > AlarmChannelProviderMonolithicImpl


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.coachEmfServicesComponents;
22 /**
23  ** Implementation skeleton class for the ::coachEmfServicesComponents::AlarmChannelProvider component.
24  **/

25 public class AlarmChannelProviderMonolithicImpl
26        extends org.omg.CORBA.LocalObject JavaDoc
27        implements CCM_AlarmChannelProvider,
28                   org.omg.Components.SessionComponent
29 {
30     // ==================================================================
31
//
32
// Internal State.
33
//
34
// ===================================================================
35
/**
36      ** Context reference.
37      **/

38     private CCM_AlarmChannelProvider_Context the_context_;
39     public static final String JavaDoc OBJECT_TYPE = "AlarmChannelProvider";
40         /* business logic */
41     String JavaDoc _channelId;
42     String JavaDoc[] _sourceClasses = null;
43     String JavaDoc[] _excludedSourceClasses = null;
44     String JavaDoc[] _eventTypes = null;
45     String JavaDoc[] _excludedEventTypes = null;
46     intt.itu.itut_q816.ChannelFinderComponent channel_finder = null;
47     // ==================================================================
48
//
49
// Constructor.
50
//
51
// ===================================================================
52
/**
53      ** The default constructor.
54      **/

55     public
56     AlarmChannelProviderMonolithicImpl()
57     {
58         the_context_ = null;
59     }
60     // ==================================================================
61
//
62
// Internal methods.
63
//
64
// ===================================================================
65
// ==================================================================
66
//
67
// Public methods.
68
//
69
// ===================================================================
70
/**
71      ** To obtain the context.
72      **
73      ** @return The context that has been previously set by
74      ** the set_session_context operation.
75      **/

76     public CCM_AlarmChannelProvider_Context
77     getContext()
78     {
79         return the_context_;
80     }
81     // ==================================================================
82
//
83
// Methods for the OMG IDL Components::EnterpriseComponent local interface.
84
//
85
// ==================================================================
86
//
87
// IDL:omg.org/Components/EnterpriseComponent/configuration_complete:1.0
88
//
89
/**
90      ** Completes the component configuration.
91      **
92      ** @throws org.omg.Components.InvalidConfiguration
93      ** Thrown if the configuration is invalid.
94      **/

95     public void
96     configuration_complete()
97     throws org.omg.Components.InvalidConfiguration
98     {
99         //
100
// DONE : implement !!!
101
//
102

103         System.err.println("AlarmChannelProvider configuration started...");
104         channel_finder = the_context_.get_connection_channelfinder_admin();
105
106         if (channel_finder == null || _channelId == null) {
107             System.err.println("AlarmChannelProvider failed to locate ChannelFinder!");
108             throw new org.omg.Components.InvalidConfiguration();
109         }
110
111         if (_sourceClasses == null || _sourceClasses.length == 0) {
112             System.err.println("Alarm Channel sourceClasses are not set..Proceeding manually");
113             _sourceClasses = new String JavaDoc[1];
114             _sourceClasses[0] = "IpNode";
115         }
116
117         if (_eventTypes == null || _eventTypes.length == 0) {
118             System.err.println("Alarm Channel eventTypes are not set..Proceeding manually");
119             _eventTypes = new String JavaDoc[6];
120             _eventTypes[0] = "ObjectCreation";
121             _eventTypes[1] = "ObjectDeletion";
122             _eventTypes[2] = "StateChangedEvent";
123             _eventTypes[3] = "Heartbeat";
124             _eventTypes[4] = "ChannelChangeEvent";
125             _eventTypes[5] = "OperationalViolation";
126         }
127
128             _excludedEventTypes = new String JavaDoc[0];
129             _excludedSourceClasses = new String JavaDoc[0];
130
131         try {
132
133             org.omg.CORBA.Object JavaDoc myself =
134                 ((org.omg.Components.SessionContext) the_context_).get_CCM_object();
135             if (myself == null)
136             System.err.println("AlarmChannelProvider there is a problem getting myself as a component!");
137
138             channel_finder.register(_channelId,
139                                     OBJECT_TYPE,
140                                     _eventTypes,
141                                     _excludedEventTypes,
142                                     _sourceClasses,
143                                     _excludedSourceClasses,
144                                     myself);
145
146         }
147         catch(intt.itu.itut_x780.ApplicationError ex) {
148             System.err.println("Application Error exception caught while registering " +
149                 "AlarmChannelProvider " + _channelId + " to ChannelFinder");
150         }
151         catch(intt.itu.itut_q816.ChannelAlreadyRegistered channel_ex) {
152             System.err.println("ChannelAlreadyRegistered exception caught while registering " +
153                 "AlarmChannelProvider " + _channelId + " to ChannelFinder");
154         }
155         catch(org.omg.Components.IllegalState state_ex) {
156             System.err.println("org.omg.Components.IllegalState exception caught while registering " +
157                 "AlarmChannelProvider " + _channelId + " to ChannelFinder");
158         }
159         System.err.println(_channelId + " AlarmChannelProvider configuration completed...");
160
161
162     }
163     // ==================================================================
164
//
165
// Methods for the OMG IDL Components::SessionComponent local interface.
166
//
167
// ==================================================================
168
//
169
// IDL:omg.org/Components/SessionComponent/set_session_context:1.0
170
//
171
/**
172      * Called by the container when the component session context will be fixed.
173      *
174      * @param context The session context.
175      *
176      * @throws org.omg.Components.CCMException
177      * Thrown if a system level error occured.
178      */

179     public void
180     set_session_context(org.omg.Components.SessionContext context)
181     throws org.omg.Components.CCMException
182     {
183         the_context_ = (CCM_AlarmChannelProvider_Context)context;
184     }
185     //
186
// IDL:omg.org/Components/SessionComponent/ccm_activate:1.0
187
//
188
/**
189      *
190      * Called by the container when the component will be activated.
191      *
192      * @throws org.omg.Components.CCMException
193      * Thrown if a system level error occured.
194      */

195     public void
196     ccm_activate()
197     throws org.omg.Components.CCMException
198     {
199         //
200
// Unused by actual OpenCCM containers
201
//
202
}
203     //
204
// IDL:omg.org/Components/SessionComponent/ccm_passivate:1.0
205
//
206
/**
207      *
208      * Called by the container when the component will be passivated.
209      *
210      * @throws org.omg.Components.CCMException
211      * Thrown if a system level error occured.
212      */

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

231     public void
232     ccm_remove()
233     throws org.omg.Components.CCMException
234     {
235         //
236
// DONE: implement !!!
237
//
238
try {
239             channel_finder.unregister(_channelId);
240         }
241         catch(intt.itu.itut_q816.ChannelNotFound channel_ex) {
242             System.err.println("ChannelNotFound exception caught unregistering " +
243                 _channelId + " from ChannelFinderService ");
244
245         }
246         catch(intt.itu.itut_x780.ApplicationError ex) {
247             System.err.println("ApplicationError exception caught unregistering " +
248                 _channelId + " from ChannelFinderService ");
249         }
250     }
251     // ==================================================================
252
//
253
// Public methods for the CCM_AlarmChannelProvider local interface.
254
//
255
// ==================================================================
256
//
257
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_f_objectCreation_alarm:1.0
258
//
259
/**
260      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_f_objectCreation_alarm operation.
261      **/

262     public void
263     push_f_objectCreation_alarm(ist.coach.itut_q816Components.ObjectCreation event)
264     {
265         //
266
// DONE : implement
267
//
268
the_context_.push_objectCreation_alarm(event);
269     }
270     //
271
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_f_objectDeletion_alarm:1.0
272
//
273
/**
274      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_f_objectDeletion_alarm operation.
275      **/

276     public void
277     push_f_objectDeletion_alarm(ist.coach.itut_q816Components.ObjectDeletion event)
278     {
279         //
280
// DONE : implement
281
//
282
the_context_.push_objectDeletion_alarm(event);
283     }
284     //
285
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_f_operational_alarm:1.0
286
//
287
/**
288      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_f_operational_alarm operation.
289      **/

290     public void
291     push_f_operational_alarm(ist.coach.itut_q816Components.OperationalViolation event)
292     {
293         //
294
// DONE : implement
295
//
296
the_context_.push_operational_alarm(event);
297     }
298     //
299
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_f_stateChanged_alarm:1.0
300
//
301
/**
302      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_f_stateChanged_alarm operation.
303      **/

304     public void
305     push_f_stateChanged_alarm(ist.coach.itut_q816Components.StateChangedEvent event)
306     {
307         //
308
// DONE : implement
309
//
310
the_context_.push_stateChanged_alarm(event);
311     }
312     //
313
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_h_heartbeat:1.0
314
//
315
/**
316      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_h_heartbeat operation.
317      **/

318     public void
319     push_h_heartbeat(ist.coach.itut_q816Components.Heartbeat event)
320     {
321         //
322
// DONE : implement
323
//
324
event.channelID = new String JavaDoc(_channelId);
325         //System.err.println("AlarmChannelProvider>push_h_heartbeat> Attempting to forward heartbeat to client...");
326
the_context_.push_heartbeat_event(event);
327     }
328     //
329
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_cf_channelChange_event:1.0
330
//
331
/**
332      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_cf_channelChange_event operation.
333      **/

334     public void
335     push_cf_channelChange_event(ist.coach.itut_q816Components.ChannelChangeEvent event)
336     {
337         //
338
// DONE : implement
339
//
340
the_context_.push_channelChange_event(event);
341     }
342     //
343
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_l_attributeValueChange_alarm:1.0
344
//
345
/**
346      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_l_attributeValueChange_alarm operation.
347      **/

348     public void
349     push_l_attributeValueChange_alarm(ist.coach.coachEmfServicesComponents.LogAttributeValueChange event)
350     {
351         //
352
// DONE : implement
353
//
354
the_context_.push_log_attributeValueChange_alarm(event);
355     }
356     //
357
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider/push_l_threshold_alarm:1.0
358
//
359
/**
360      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider::push_l_threshold_alarm operation.
361      **/

362     public void
363     push_l_threshold_alarm(ist.coach.coachEmfServicesComponents.LogThresholdAlarm event)
364     {
365         //
366
// DONE : implement
367
//
368
the_context_.push_log_threshold_alarm(event);
369     }
370     //
371
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider_Executor/channelId:1.0
372
//
373
/**
374      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::channelId attribute as accessor operation.
375      **/

376     public java.lang.String JavaDoc
377     channelId()
378     {
379         //
380
// DONE : implement
381
//
382
return _channelId;
383     }
384
385     /**
386      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::channelId attribute as mutator operation.
387      **/

388     public void
389     channelId(java.lang.String JavaDoc val)
390     {
391         //
392
// DONE : implement
393
//
394
if (val != null)
395             _channelId = new String JavaDoc(val);
396         else
397             _channelId = new String JavaDoc();
398         System.err.println("Channel Id is set to " + _channelId);
399     }
400     //
401
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider_Executor/sourceClasses:1.0
402
//
403
/**
404      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::sourceClasses attribute as accessor operation.
405      **/

406     public java.lang.String JavaDoc[]
407     sourceClasses()
408     {
409         //
410
// DONE : implement
411
//
412
return _sourceClasses;
413     }
414
415     /**
416      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::sourceClasses attribute as mutator operation.
417      **/

418     public void
419     sourceClasses(java.lang.String JavaDoc[] val)
420     {
421         //
422
// DONE : implement
423
//
424
System.err.print("AlarmChannelProvider will serve:");
425         if (val == null)
426             _sourceClasses = new String JavaDoc[0];
427         else
428             _sourceClasses = val;
429         for (int i = 0; i < _sourceClasses.length; i++)
430             System.err.print(_sourceClasses[i] + ", ");
431         System.err.println();
432     }
433     //
434
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider_Executor/excludedSourceClasses:1.0
435
//
436
/**
437      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::excludedSourceClasses attribute as accessor operation.
438      **/

439     public java.lang.String JavaDoc[]
440     excludedSourceClasses()
441     {
442         //
443
// DONE : implement
444
//
445
return _excludedSourceClasses;
446     }
447
448     /**
449      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::excludedSourceClasses attribute as mutator operation.
450      **/

451     public void
452     excludedSourceClasses(java.lang.String JavaDoc[] val)
453     {
454         //
455
// DONE : implement
456
//
457
System.err.println("excludedSourceClasses will be set...");
458         if (val == null)
459             _excludedSourceClasses = new String JavaDoc[0];
460         else
461             _excludedSourceClasses = val;
462     }
463     //
464
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider_Executor/eventTypes:1.0
465
//
466
/**
467      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::eventTypes attribute as accessor operation.
468      **/

469     public java.lang.String JavaDoc[]
470     eventTypes()
471     {
472         //
473
// DONE : implement
474
//
475
return _eventTypes;
476     }
477
478     /**
479      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::eventTypes attribute as mutator operation.
480      **/

481     public void
482     eventTypes(java.lang.String JavaDoc[] val)
483     {
484         //
485
// DONE : implement
486
//
487

488         if (val == null)
489             _eventTypes = new String JavaDoc[0];
490         else
491             _eventTypes = val;
492
493         System.err.println(channelId() + " " + _eventTypes.length + " eventTypes supported..");
494     }
495     //
496
// IDL:coach.ist/coachEmfServicesComponents/CCM_AlarmChannelProvider_Executor/excludedeventTypes:1.0
497
//
498
/**
499      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::excludedeventTypes attribute as accessor operation.
500      **/

501     public java.lang.String JavaDoc[]
502     excludedeventTypes()
503     {
504         //
505
// DONE : implement
506
//
507
return _excludedEventTypes;
508     }
509
510     /**
511      ** Implementation of the ::coachEmfServicesComponents::CCM_AlarmChannelProvider_Executor::excludedeventTypes attribute as mutator operation.
512      **/

513     public void
514     excludedeventTypes(java.lang.String JavaDoc[] val)
515     {
516         //
517
// DONE : implement
518
//
519
if (val == null)
520             _excludedEventTypes = new String JavaDoc[0];
521         else
522             _excludedEventTypes = val;
523     }
524 }
525
Popular Tags