Class DefaultBusinessServiceStateMachine
- java.lang.Object
-
- org.opennms.netmgt.bsm.service.internal.DefaultBusinessServiceStateMachine
-
- All Implemented Interfaces:
BusinessServiceStateMachine
public class DefaultBusinessServiceStateMachine extends java.lang.Object implements BusinessServiceStateMachine
-
-
Field Summary
Fields Modifier and Type Field Description static Status
MIN_SEVERITY
-
Constructor Summary
Constructors Constructor Description DefaultBusinessServiceStateMachine()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(BusinessServiceStateChangeHandler handler, java.util.Map<java.lang.String,java.lang.String> attributes)
Registers a state change handler.java.util.List<GraphVertex>
calculateImpact(java.lang.String reductionKey)
java.util.List<GraphVertex>
calculateImpact(Application application)
java.util.List<GraphVertex>
calculateImpact(BusinessService businessService)
java.util.List<GraphVertex>
calculateImpact(IpService ipService)
java.util.Set<GraphEdge>
calculateImpacting(BusinessService businessService)
java.util.List<GraphVertex>
calculateRootCause(BusinessService businessService)
BusinessServiceStateMachine
clone(boolean preserveState)
ThresholdResultExplanation
explain(BusinessService businessService, Threshold threshold)
BusinessServiceGraph
getGraph()
This returns the actual graph of theBusinessServiceStateMachine
.Status
getOperationalStatus(java.lang.String reductionKey)
Retrieves the current operational status of a particular reduction key.Status
getOperationalStatus(BusinessService businessService)
Retrieves the current operational status of a Business Service.Status
getOperationalStatus(Edge edge)
Retrieves the current operational status of the element associated with a particular Edge.Status
getOperationalStatus(IpService ipService)
Retrieves the current operational status of a particular IP service.void
handleAllAlarms(java.util.List<AlarmWrapper> alarms)
Updates the states of the Business Services using the given list of alarms.void
handleNewOrUpdatedAlarm(AlarmWrapper alarm)
Updates the states of the Business Services.boolean
removeHandler(BusinessServiceStateChangeHandler handler, java.util.Map<java.lang.String,java.lang.String> attributes)
Unregisters a state change handler.void
renderGraphToPng(java.io.File tempFile)
void
setAlarmProvider(AlarmProvider alarmProvider)
void
setBusinessServices(java.util.List<BusinessService> businessServices)
Sets the list of Business Services that need to managed by the state machine.static java.util.List<StatusWithIndex>
weighEdges(java.util.Collection<GraphEdge> edges)
static java.util.List<StatusWithIndex>
weighStatuses(java.util.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(java.util.List<BusinessService> businessServices)
Description copied from interface:BusinessServiceStateMachine
Sets the list of Business Services that need to managed by the state machine.- Specified by:
setBusinessServices
in interfaceBusinessServiceStateMachine
- Parameters:
businessServices
- list of services to manage
-
handleNewOrUpdatedAlarm
public void handleNewOrUpdatedAlarm(AlarmWrapper alarm)
Description copied from interface:BusinessServiceStateMachine
Updates the states of the Business Services.- Specified by:
handleNewOrUpdatedAlarm
in interfaceBusinessServiceStateMachine
-
handleAllAlarms
public void handleAllAlarms(java.util.List<AlarmWrapper> alarms)
Description copied from interface:BusinessServiceStateMachine
Updates 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:
handleAllAlarms
in interfaceBusinessServiceStateMachine
-
weighEdges
public static java.util.List<StatusWithIndex> weighEdges(java.util.Collection<GraphEdge> edges)
-
weighStatuses
public static java.util.List<StatusWithIndex> weighStatuses(java.util.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:BusinessServiceStateMachine
Retrieves the current operational status of a Business Service.- Specified by:
getOperationalStatus
in 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:BusinessServiceStateMachine
Retrieves the current operational status of a particular IP service.- Specified by:
getOperationalStatus
in 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(java.lang.String reductionKey)
Description copied from interface:BusinessServiceStateMachine
Retrieves the current operational status of a particular reduction key.- Specified by:
getOperationalStatus
in 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:BusinessServiceStateMachine
Retrieves 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:
getOperationalStatus
in 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, java.util.Map<java.lang.String,java.lang.String> attributes)
Description copied from interface:BusinessServiceStateMachine
Registers a state change handler.- Specified by:
addHandler
in interfaceBusinessServiceStateMachine
- Parameters:
handler
- handler to registerattributes
- map of service attributes, required for compatibility with the ONMS-OSGi bridge.
-
removeHandler
public boolean removeHandler(BusinessServiceStateChangeHandler handler, java.util.Map<java.lang.String,java.lang.String> attributes)
Description copied from interface:BusinessServiceStateMachine
Unregisters a state change handler.- Specified by:
removeHandler
in 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(java.io.File tempFile)
- Specified by:
renderGraphToPng
in interfaceBusinessServiceStateMachine
-
getGraph
public BusinessServiceGraph getGraph()
Description copied from interface:BusinessServiceStateMachine
This returns the actual graph of theBusinessServiceStateMachine
. Please DO NOT MODIFY any object in that graph.- Specified by:
getGraph
in interfaceBusinessServiceStateMachine
- Returns:
- the actual graph of the
BusinessServiceStateMachine
. DO NOT MODIFY!
-
calculateImpacting
public java.util.Set<GraphEdge> calculateImpacting(BusinessService businessService)
- Specified by:
calculateImpacting
in interfaceBusinessServiceStateMachine
-
clone
public BusinessServiceStateMachine clone(boolean preserveState)
- Specified by:
clone
in interfaceBusinessServiceStateMachine
-
calculateRootCause
public java.util.List<GraphVertex> calculateRootCause(BusinessService businessService)
- Specified by:
calculateRootCause
in interfaceBusinessServiceStateMachine
-
calculateImpact
public java.util.List<GraphVertex> calculateImpact(BusinessService businessService)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public java.util.List<GraphVertex> calculateImpact(IpService ipService)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public java.util.List<GraphVertex> calculateImpact(Application application)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public java.util.List<GraphVertex> calculateImpact(java.lang.String reductionKey)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
explain
public ThresholdResultExplanation explain(BusinessService businessService, Threshold threshold)
- Specified by:
explain
in interfaceBusinessServiceStateMachine
-
-