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 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, 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)
BusinessServiceStateMachine
clone(boolean preserveState)
ThresholdResultExplanation
explain(BusinessService businessService, Threshold threshold)
BusinessServiceGraph
getGraph()
This returns the actual graph of theBusinessServiceStateMachine
.Status
getOperationalStatus(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(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, Map<String,String> attributes)
Unregisters a state change handler.void
renderGraphToPng(File tempFile)
void
setAlarmProvider(AlarmProvider alarmProvider)
void
setBusinessServices(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: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(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 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: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(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, Map<String,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, Map<String,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(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 Set<GraphEdge> calculateImpacting(BusinessService businessService)
- Specified by:
calculateImpacting
in interfaceBusinessServiceStateMachine
-
clone
public BusinessServiceStateMachine clone(boolean preserveState)
- Specified by:
clone
in interfaceBusinessServiceStateMachine
-
calculateRootCause
public List<GraphVertex> calculateRootCause(BusinessService businessService)
- Specified by:
calculateRootCause
in interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(BusinessService businessService)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(IpService ipService)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(Application application)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
calculateImpact
public List<GraphVertex> calculateImpact(String reductionKey)
- Specified by:
calculateImpact
in interfaceBusinessServiceStateMachine
-
explain
public ThresholdResultExplanation explain(BusinessService businessService, Threshold threshold)
- Specified by:
explain
in interfaceBusinessServiceStateMachine
-
-