Class DefaultBusinessServiceStateMachine
- java.lang.Object
-
- org.opennms.netmgt.bsm.service.internal.DefaultBusinessServiceStateMachine
-
- All Implemented Interfaces:
BusinessServiceStateMachine
public class DefaultBusinessServiceStateMachine extends Object implements BusinessServiceStateMachine
-
-
Field Summary
Fields Modifier and Type Field Description static StatusMIN_SEVERITY
-
Constructor Summary
Constructors Constructor Description DefaultBusinessServiceStateMachine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHandler(BusinessServiceStateChangeHandler handler, Map<String,String> attributes)Registers a state change handler.List<GraphVertex>calculateImpact(String reductionKey)List<GraphVertex>calculateImpact(Application application)List<GraphVertex>calculateImpact(BusinessService businessService)List<GraphVertex>calculateImpact(IpService ipService)Set<GraphEdge>calculateImpacting(BusinessService businessService)List<GraphVertex>calculateRootCause(BusinessService businessService)BusinessServiceStateMachineclone(boolean preserveState)ThresholdResultExplanationexplain(BusinessService businessService, Threshold threshold)BusinessServiceGraphgetGraph()This returns the actual graph of theBusinessServiceStateMachine.StatusgetOperationalStatus(String reductionKey)Retrieves the current operational status of a particular reduction key.StatusgetOperationalStatus(BusinessService businessService)Retrieves the current operational status of a Business Service.StatusgetOperationalStatus(Edge edge)Retrieves the current operational status of the element associated with a particular Edge.StatusgetOperationalStatus(IpService ipService)Retrieves the current operational status of a particular IP service.voidhandleAllAlarms(List<AlarmWrapper> alarms)Updates the states of the Business Services using the given list of alarms.voidhandleNewOrUpdatedAlarm(AlarmWrapper alarm)Updates the states of the Business Services.booleanremoveHandler(BusinessServiceStateChangeHandler handler, Map<String,String> attributes)Unregisters a state change handler.voidrenderGraphToPng(File tempFile)voidsetAlarmProvider(AlarmProvider alarmProvider)voidsetBusinessServices(List<BusinessService> businessServices)Sets the list of Business Services that need to managed by the state machine.static List<StatusWithIndex>weighEdges(Collection<GraphEdge> edges)static List<StatusWithIndex>weighStatuses(Map<GraphEdge,Status> edgesWithStatus)Apply the edges weights to the associated statuses set in the map, ignoring the actual status stored in the edge.
-
-
-
Field Detail
-
MIN_SEVERITY
public static final Status MIN_SEVERITY
-
-
Method Detail
-
setBusinessServices
public void setBusinessServices(List<BusinessService> businessServices)
Description copied from interface:BusinessServiceStateMachineSets the list of Business Services that need to managed by the state machine.- Specified by:
setBusinessServicesin interfaceBusinessServiceStateMachine- Parameters:
businessServices- list of services to manage
-
handleNewOrUpdatedAlarm
public void handleNewOrUpdatedAlarm(AlarmWrapper alarm)
Description copied from interface:BusinessServiceStateMachineUpdates the states of the Business Services.- Specified by:
handleNewOrUpdatedAlarmin interfaceBusinessServiceStateMachine
-
handleAllAlarms
public void handleAllAlarms(List<AlarmWrapper> alarms)
Description copied from interface:BusinessServiceStateMachineUpdates the states of the Business Services using the given list of alarms. The given list of alarms is expected to be the complete set of current alarms, and any alarms missing from this list will be treated as not being present.- Specified by:
handleAllAlarmsin interfaceBusinessServiceStateMachine
-
weighEdges
public static List<StatusWithIndex> weighEdges(Collection<GraphEdge> edges)
-
weighStatuses
public static List<StatusWithIndex> weighStatuses(Map<GraphEdge,Status> edgesWithStatus)
Apply the edges weights to the associated statuses set in the map, ignoring the actual status stored in the edge. Can be used for simulations without needing to change the actual edge's status.- Parameters:
edgesWithStatus-- Returns:
-
getOperationalStatus
public Status getOperationalStatus(BusinessService businessService)
Description copied from interface:BusinessServiceStateMachineRetrieves the current operational status of a Business Service.- Specified by:
getOperationalStatusin interfaceBusinessServiceStateMachine- Parameters:
businessService- Business Service to query- Returns:
- the current operational status, or null if the Business Service if not managed by the state machine
-
getOperationalStatus
public Status getOperationalStatus(IpService ipService)
Description copied from interface:BusinessServiceStateMachineRetrieves the current operational status of a particular IP service.- Specified by:
getOperationalStatusin interfaceBusinessServiceStateMachine- Parameters:
ipService- IP Service to query- Returns:
- the current operational status, or null if the IP Service is not monitored by the state machine
-
getOperationalStatus
public Status getOperationalStatus(String reductionKey)
Description copied from interface:BusinessServiceStateMachineRetrieves the current operational status of a particular reduction key.- Specified by:
getOperationalStatusin interfaceBusinessServiceStateMachine- Parameters:
reductionKey- reduction key to query for- Returns:
- the current operational status, or null if the Reduction Key is not monitored by the state machine
-
getOperationalStatus
public Status getOperationalStatus(Edge edge)
Description copied from interface:BusinessServiceStateMachineRetrieves the current operational status of the element associated with a particular Edge. A call to this method is equal to a call toBusinessServiceStateMachine.getOperationalStatus(String),BusinessServiceStateMachine.getOperationalStatus(IpService)orBusinessServiceStateMachine.getOperationalStatus(BusinessService)depending on the type of the edge. This method DOES NOT return the mapped status of the edge.- Specified by:
getOperationalStatusin interfaceBusinessServiceStateMachine- Parameters:
edge- edge to query for- Returns:
- the current operational status, or null if the Edge is not monitored by the state machine
-
setAlarmProvider
public void setAlarmProvider(AlarmProvider alarmProvider)
-
addHandler
public void addHandler(BusinessServiceStateChangeHandler handler, Map<String,String> attributes)
Description copied from interface:BusinessServiceStateMachineRegisters a state change handler.- Specified by:
addHandlerin interfaceBusinessServiceStateMachine- Parameters:
handler- handler to registerattributes- map of service attributes, required for compatibility with the ONMS-OSGi bridge.
-
removeHandler
public boolean removeHandler(BusinessServiceStateChangeHandler handler, Map<String,String> attributes)
Description copied from interface:BusinessServiceStateMachineUnregisters a state change handler.- Specified by:
removeHandlerin interfaceBusinessServiceStateMachine- Parameters:
handler- handler to unregisterattributes- map of service attributes, required for compatibility with the ONMS-OSGi bridge.- Returns:
- true of the handler was previously registered, and false otherwise
-
renderGraphToPng
public void renderGraphToPng(File tempFile)
- Specified by:
renderGraphToPngin interfaceBusinessServiceStateMachine
-
getGraph
public BusinessServiceGraph getGraph()
Description copied from interface:BusinessServiceStateMachineThis returns the actual graph of theBusinessServiceStateMachine. Please DO NOT MODIFY any object in that graph.- Specified by:
getGraphin interfaceBusinessServiceStateMachine- Returns:
- the actual graph of the
BusinessServiceStateMachine. DO NOT MODIFY!
-
calculateImpacting
public Set<GraphEdge> calculateImpacting(BusinessService businessService)
- Specified by:
calculateImpactingin interfaceBusinessServiceStateMachine
-
clone
public BusinessServiceStateMachine clone(boolean preserveState)
- Specified by:
clonein interfaceBusinessServiceStateMachine
-
calculateRootCause
public List<GraphVertex> calculateRootCause(BusinessService businessService)
- Specified by:
calculateRootCausein interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(BusinessService businessService)
- Specified by:
calculateImpactin interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(IpService ipService)
- Specified by:
calculateImpactin interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(Application application)
- Specified by:
calculateImpactin interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(String reductionKey)
- Specified by:
calculateImpactin interfaceBusinessServiceStateMachine
-
explain
public ThresholdResultExplanation explain(BusinessService businessService, Threshold threshold)
- Specified by:
explainin interfaceBusinessServiceStateMachine
-
-