1 21 package ist.coach.coachEmfServicesComponents; 22 25 public class AlarmChannelProviderMonolithicImpl 26 extends org.omg.CORBA.LocalObject 27 implements CCM_AlarmChannelProvider, 28 org.omg.Components.SessionComponent 29 { 30 38 private CCM_AlarmChannelProvider_Context the_context_; 39 public static final String OBJECT_TYPE = "AlarmChannelProvider"; 40 41 String _channelId; 42 String [] _sourceClasses = null; 43 String [] _excludedSourceClasses = null; 44 String [] _eventTypes = null; 45 String [] _excludedEventTypes = null; 46 intt.itu.itut_q816.ChannelFinderComponent channel_finder = null; 47 55 public 56 AlarmChannelProviderMonolithicImpl() 57 { 58 the_context_ = null; 59 } 60 76 public CCM_AlarmChannelProvider_Context 77 getContext() 78 { 79 return the_context_; 80 } 81 95 public void 96 configuration_complete() 97 throws org.omg.Components.InvalidConfiguration 98 { 99 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 [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 [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 [0]; 129 _excludedSourceClasses = new String [0]; 130 131 try { 132 133 org.omg.CORBA.Object 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 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 195 public void 196 ccm_activate() 197 throws org.omg.Components.CCMException 198 { 199 } 203 213 public void 214 ccm_passivate() 215 throws org.omg.Components.CCMException 216 { 217 } 221 231 public void 232 ccm_remove() 233 throws org.omg.Components.CCMException 234 { 235 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 262 public void 263 push_f_objectCreation_alarm(ist.coach.itut_q816Components.ObjectCreation event) 264 { 265 the_context_.push_objectCreation_alarm(event); 269 } 270 276 public void 277 push_f_objectDeletion_alarm(ist.coach.itut_q816Components.ObjectDeletion event) 278 { 279 the_context_.push_objectDeletion_alarm(event); 283 } 284 290 public void 291 push_f_operational_alarm(ist.coach.itut_q816Components.OperationalViolation event) 292 { 293 the_context_.push_operational_alarm(event); 297 } 298 304 public void 305 push_f_stateChanged_alarm(ist.coach.itut_q816Components.StateChangedEvent event) 306 { 307 the_context_.push_stateChanged_alarm(event); 311 } 312 318 public void 319 push_h_heartbeat(ist.coach.itut_q816Components.Heartbeat event) 320 { 321 event.channelID = new String (_channelId); 325 the_context_.push_heartbeat_event(event); 327 } 328 334 public void 335 push_cf_channelChange_event(ist.coach.itut_q816Components.ChannelChangeEvent event) 336 { 337 the_context_.push_channelChange_event(event); 341 } 342 348 public void 349 push_l_attributeValueChange_alarm(ist.coach.coachEmfServicesComponents.LogAttributeValueChange event) 350 { 351 the_context_.push_log_attributeValueChange_alarm(event); 355 } 356 362 public void 363 push_l_threshold_alarm(ist.coach.coachEmfServicesComponents.LogThresholdAlarm event) 364 { 365 the_context_.push_log_threshold_alarm(event); 369 } 370 376 public java.lang.String 377 channelId() 378 { 379 return _channelId; 383 } 384 385 388 public void 389 channelId(java.lang.String val) 390 { 391 if (val != null) 395 _channelId = new String (val); 396 else 397 _channelId = new String (); 398 System.err.println("Channel Id is set to " + _channelId); 399 } 400 406 public java.lang.String [] 407 sourceClasses() 408 { 409 return _sourceClasses; 413 } 414 415 418 public void 419 sourceClasses(java.lang.String [] val) 420 { 421 System.err.print("AlarmChannelProvider will serve:"); 425 if (val == null) 426 _sourceClasses = new String [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 439 public java.lang.String [] 440 excludedSourceClasses() 441 { 442 return _excludedSourceClasses; 446 } 447 448 451 public void 452 excludedSourceClasses(java.lang.String [] val) 453 { 454 System.err.println("excludedSourceClasses will be set..."); 458 if (val == null) 459 _excludedSourceClasses = new String [0]; 460 else 461 _excludedSourceClasses = val; 462 } 463 469 public java.lang.String [] 470 eventTypes() 471 { 472 return _eventTypes; 476 } 477 478 481 public void 482 eventTypes(java.lang.String [] val) 483 { 484 488 if (val == null) 489 _eventTypes = new String [0]; 490 else 491 _eventTypes = val; 492 493 System.err.println(channelId() + " " + _eventTypes.length + " eventTypes supported.."); 494 } 495 501 public java.lang.String [] 502 excludedeventTypes() 503 { 504 return _excludedEventTypes; 508 } 509 510 513 public void 514 excludedeventTypes(java.lang.String [] val) 515 { 516 if (val == null) 520 _excludedEventTypes = new String [0]; 521 else 522 _excludedEventTypes = val; 523 } 524 } 525 | Popular Tags |