HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Implementing Business Rules in Java"
Vol. 5, Issue 5, Pg.16

	

Listing 1 
 
public void correlateAlarm ( Alarm alarm ) 
{ 
//Related Alarms 
//When a switch raises an equipment failure alarm ignore all 
//communication failure alarms on the associated port. 
if ((alarm.type == Alarm.Type.CommunicationFailure) 
&& (alarm.managedObject.type == 
NetworkElement.Type.Port)) 
{ 
// search for Equip failure on Switch 
AlarmList alarms = GetHistoryAlarmList(); 
for (Alarm a = alarms.firstElement(); 
alarms.hasMoreElements(); a = alarms.nextElement()) 
if ((a.type == Alarm.Type.EquipmentFailure) 
&& (alarm.managedObject.type == NetworkEle- 
ment.Type.Switch) 
&& (a.managedObject.node == alarm.managedObject)) { 
alarm.terminate( 
"Terminated Communication Failure on Port 
due to Equipment Failure on the Switch " + 
alarm.managedObject.id); 
return; 
} 
} 
//Maintenance Activity Scheduled 
//When maintenance activity has been scheduled on a net- 
//work element ignore all alarms raised on this piece 
//of hardware between the maintenance start and end time. 
MaintenanceActivityList activities = GetMaintenanceActiv- 
ityList(alarm.managedObject); 
for (MaintenanceActivity maintenance = 
activities.firstElement(); 
activities.hasMoreElements(); maintenance = activi- 
ties.nextElement()) 
if ((alarm.time > = maintenance.startTime) 
&& (alarm.time <= maintenance.endTime) { 
alarm.terminate("Terminated due to a maintenance 
activity on " 
+ alarm.managedObject.id); 
return; 
} 
// Critical Alarms on Sensitive Devices 
// When more than 15 alarms are detected on a Network Element, 
// notify the Network Operator by Pager. 
// When more than 5 alarms are detected on a Switch, 
// notify the Network Operator by Pager. 
AlarmList alarms = GetHistoryAlarmList(); 
int count = 0; 
int countOnSwitch = 0; 
for (Alarm a = alarms.firstElement(); 
alarms.hasMoreElements(); a = alarms.nextElement()) { 
if (alarm.managedObject == a.managedObject) { 
count++; 
if (alarm.managedObject.type == 
NetworkElement.Type.Switch) 
countOnSwitch++; 
} 
} 
if (count > 15) 
network.pageOperator("More than 15 alarms on the NE " + 
alarm.managedObject.id); 
else if (countOnSwitch > 5) 
network.pageOperator("More than 5 alarms on the Switch " + alarm.managedObject.id); 
} // public void correlateAlarm 
 
Listing 2 
 
//Related Alarms 
//When a switch raises an equipment failure alarm ignore all 
//communication failure alarms on the associated port. 
rule Port_CommunicationFailure_due_to_Switch_EquipmentFailure 
{ 
priority = maximum; 
when 
{ 
?alarm: Alarm(type == Alarm.Type.EquipmentFailure); 
?switch: Switch() from ?alarm.managedObject; 
?comm: Alarm(type == Alarm.Type.CommunicationFailure); 
Port(node == ?switch) from ?comm.managedObject; 
} 
then 
{ 
modify ?comm 
{ 
terminate("Terminated Communication Failure on Port due 
to Equipment Failure on a Switch"); 
} 
} 
}; 
//Maintenance Activity Scheduled 
//When maintenance activity has been scheduled on a network 
//element ignore all alarms raised on this piece of hardware //between the maintenance start and end time. 
rule Terminate_Alarms_During_Maintenance 
{ 
priority = high; 
when 
{ 
?maintenance: MaintenanceActivity(); 
?alarm: Alarm(managedObject == ?maintenance.managedObject ; time >= ?maintenance.startTime ; time < = ?maintenance.endTime); 
} 
then 
{ 
modify ?alarm 
{ 
terminate("Terminated due to a maintenance window on " + ?maintenance.managedObject.id); 
} 
} 
}; 
// Critical Alarms on Sensitive Devices 
// When more than 15 alarms are detected on a Network Element, 
// notify the Network Operator by Pager. 
// When more than 5 alarms are detected on a Switch, 
// notify the Network Operator by Pager. 
rule Page_Operator_When_Critical_Alarm_On_Network_Element 
{ 
when 
{ 
?n: Network(); 
?networkElement: NetworkElement(); 
collect Alarm(managedObject == ?networkElement) 
where (size() >15); 
} 
then 
{ 
?n.pageOperator("More that 15 alarms on the NE " + ?net 
workElement.id); 
} 
}; 
rule Page_Operator_When_Critical_Alarm_On_Switch 
{ 
when 
{ 
?n: Network(); 
?switch: Switch(); 
collect Alarm(managedObject == ?switch) 
where (size() > 5); 
} 
then 
{ 
?n.pageOperator("More that 5 alarms on the Switch" + ?switch.id); 
} 
}; 


 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.