1 28 29 package ist.coach.coachEmfServicesComponents.AlarmChannelProviderComposition; 30 31 32 38 public class AlarmChannelProviderImpl 39 extends ist.coach.coachEmfServicesComponents.AlarmChannelProviderComposition.AlarmChannelProvider_impl 40 { 41 public static final String OBJECT_TYPE = "AlarmChannelProvider"; 47 48 private String _channelId = "Undefined"; 49 private String [] _sourceClasses = null; 50 private String [] _excludedSourceClasses = null; 51 private String [] _eventTypes = null; 52 private String [] _excludedEventTypes = null; 53 intt.itu.itut_q816.ChannelFinderComponent channel_finder = null; 54 55 58 private boolean postInit = false; 59 private org.omg.CORBA.Object myself; 60 66 public AlarmChannelProviderImpl() 67 { 68 } 69 70 76 79 public String 80 channelId() 81 { 82 return _channelId; 86 } 87 88 91 public void 92 channelId(String channelId) 93 { 94 if (channelId != null && ! "undefined".equals(channelId)) 98 _channelId = new String (channelId); 99 100 System.err.println("Channel Id is set to " + _channelId); 101 } 102 103 106 public String [] 107 sourceClasses() 108 { 109 return _sourceClasses; 113 } 114 115 118 public void 119 sourceClasses(String [] sourceClasses) 120 { 121 System.err.print(channelId() + "AlarmChannelProvider will serve:"); 125 if (sourceClasses == null) 126 _sourceClasses = new String [0]; 127 else 128 _sourceClasses = sourceClasses; 129 130 if (postInit) 131 performUpdate(); 132 133 for (int i = 0; i < _sourceClasses.length; i++) 134 System.err.print(_sourceClasses[i] + ", "); 135 System.err.println(); 136 } 137 138 141 public String [] 142 excludedSourceClasses() 143 { 144 return _excludedSourceClasses; 148 } 149 150 153 public void 154 excludedSourceClasses(String [] excludedSourceClasses) 155 { 156 if (excludedSourceClasses == null) 160 _excludedSourceClasses = new String [0]; 161 else 162 _excludedSourceClasses = excludedSourceClasses; 163 164 if (postInit) 165 performUpdate(); 166 167 } 168 169 172 public String [] 173 eventTypes() 174 { 175 return _eventTypes; 179 } 180 181 184 public void 185 eventTypes(String [] eventTypes) 186 { 187 191 if (eventTypes == null) 192 _eventTypes = new String [0]; 193 else 194 _eventTypes = eventTypes; 195 196 if (postInit) 197 performUpdate(); 198 199 System.err.println(channelId() + " " + _eventTypes.length + " eventTypes supported.."); 200 } 201 202 205 public String [] 206 excludedeventTypes() 207 { 208 return _excludedEventTypes; 212 } 213 214 217 public void 218 excludedeventTypes(String [] excludedeventTypes) 219 { 220 if (excludedeventTypes == null) 224 _excludedEventTypes = new String [0]; 225 else 226 _excludedEventTypes = excludedeventTypes; 227 228 if (postInit) 229 performUpdate(); 230 231 } 232 233 public void performUpdate() { 234 235 try { 236 channel_finder.update(_channelId, 237 OBJECT_TYPE, 238 _eventTypes, 239 _excludedEventTypes, 240 _sourceClasses, 241 _excludedSourceClasses, 242 myself); 243 244 } 245 catch(intt.itu.itut_x780.ApplicationError ex) { 246 System.err.println("Application Error exception caught while updating " + 247 "AlarmChannelProvider " + _channelId + " to ChannelFinder"); 248 } 249 catch(intt.itu.itut_q816.ChannelNotFound channel_ex) { 250 System.err.println("ChannelAlreadyRegistered exception caught while updating " + 251 "AlarmChannelProvider " + _channelId + " to ChannelFinder"); 252 } 253 } 254 268 public void 269 configuration_complete() 270 throws org.omg.Components.InvalidConfiguration 271 { 272 276 System.err.println("AlarmChannelProvider configuration started..."); 277 channel_finder = get_context().get_connection_channelfinder_admin(); 278 279 if (channel_finder == null || _channelId == null) { 280 System.err.println("AlarmChannelProvider failed to locate ChannelFinder!"); 281 throw new org.omg.Components.InvalidConfiguration(); 282 } 283 284 if (_sourceClasses == null || _sourceClasses.length == 0) { 285 System.err.println("Alarm Channel sourceClasses are not set..Proceeding manually"); 286 _sourceClasses = new String [1]; 287 _sourceClasses[0] = "IpNode"; 288 289 _excludedSourceClasses = new String [0]; 290 } 291 292 if (_eventTypes == null || _eventTypes.length == 0) { 293 System.err.println("Alarm Channel eventTypes are not set..Proceeding manually"); 294 _eventTypes = new String [6]; 295 _eventTypes[0] = "ObjectCreation"; 296 _eventTypes[1] = "ObjectDeletion"; 297 _eventTypes[2] = "StateChangedEvent"; 298 _eventTypes[3] = "Heartbeat"; 299 _eventTypes[4] = "ChannelChangeEvent"; 300 _eventTypes[5] = "OperationalViolation"; 301 302 _excludedEventTypes = new String [0]; 303 } 304 305 306 try { 307 308 myself = 310 ((org.omg.Components.SessionContext) get_context()).get_CCM_object(); 311 if (myself == null) 312 System.err.println("AlarmChannelProvider there is a problem getting myself as a component!"); 313 314 channel_finder.register(_channelId, 315 OBJECT_TYPE, 316 _eventTypes, 317 _excludedEventTypes, 318 _sourceClasses, 319 _excludedSourceClasses, 320 myself); 321 322 } 323 catch(intt.itu.itut_x780.ApplicationError ex) { 324 System.err.println("Application Error exception caught while registering " + 325 "AlarmChannelProvider " + _channelId + " to ChannelFinder"); 326 } 327 catch(intt.itu.itut_q816.ChannelAlreadyRegistered channel_ex) { 328 System.err.println("ChannelAlreadyRegistered exception caught while registering " + 329 "AlarmChannelProvider " + _channelId + " to ChannelFinder"); 330 } 331 catch(org.omg.Components.IllegalState state_ex) { 332 System.err.println("org.omg.Components.IllegalState exception caught while registering " + 333 "AlarmChannelProvider " + _channelId + " to ChannelFinder"); 334 } 335 336 postInit = true; 337 System.err.println(_channelId + " AlarmChannelProvider configuration completed..."); 338 339 340 } 341 342 352 public void 353 ccm_remove() 354 throws org.omg.Components.CCMException 355 { 356 try { 360 channel_finder.unregister(_channelId); 361 } 362 catch(intt.itu.itut_q816.ChannelNotFound channel_ex) { 363 System.err.println("ChannelNotFound exception caught unregistering " + 364 _channelId + " from ChannelFinderService "); 365 366 } 367 catch(intt.itu.itut_x780.ApplicationError ex) { 368 System.err.println("ApplicationError exception caught unregistering " + 369 _channelId + " from ChannelFinderService "); 370 } 371 } 372 } 373 | Popular Tags |