Class ObservableThreat
- All Implemented Interfaces:
IInteractionThreat,IThreat
- Direct Known Subclasses:
ObservablePatternThreat
Threading model: all WritableValues are explicitly bound to the
SWT display realm (rather than the constructing thread's default realm,
which only exists on the display thread), so instances can be constructed
on any thread. In the normal flow the ThreatAnalysisService builds its
databinding graph on the UI thread, so conversion - and therefore
construction and the initial value population - happens on the realm; VIATRA
may however deliver later match updates on other threads, so every value
mutation goes through setOnRealm(WritableValue, Object), which
applies it directly when on the realm and via Realm.asyncExec
otherwise. Getters are meant for the UI thread (JFace bindings and label
providers).
Because off-realm mutations are queued while on-realm ones apply
immediately, a value written from both sides could otherwise be overwritten
by an older queued write. The risk figures of one
risk calculation are therefore published
together, and a queued publication is dropped once a newer calculation has
been published.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LocaleSingle source of truth for the currency locale used across the analysis views.protected org.eclipse.core.databinding.observable.value.WritableValue<String> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected RiskAssessmentLoopConfigurationLoop configuration owned by the analysing engine; used to drive the risk calculation.protected org.eclipse.core.databinding.observable.value.WritableValue<String> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected Stringprotected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected Stringprotected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<String> protected org.eclipse.core.databinding.observable.value.WritableValue<String> protected org.eclipse.core.databinding.observable.value.WritableValue<String> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> protected org.eclipse.core.databinding.observable.value.WritableValue<Double> Fields inherited from class be.kuleuven.cs.distrinet.sparta.core.model.Threat
dataFlow, matchType, nf, patternMatch, riskModel, threatenedElement, threatType -
Constructor Summary
ConstructorsModifierConstructorDescriptionObservableThreat(org.eclipse.core.databinding.DataBindingContext dbc, org.eclipse.viatra.query.runtime.api.IPatternMatch x, RiskAssessmentLoopConfiguration loopConfiguration) protectedObservableThreat(org.eclipse.viatra.query.runtime.api.IPatternMatch x, IRiskModel riskModel, RiskAssessmentLoopConfiguration loopConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringformatCurrency(double value) protected static StringformatRisk(double value) getFlow()doubleprotected org.eclipse.core.databinding.observable.value.IObservableValuegetMatchObservable(String propertyName) doubledoubledoubledoubledoubledoubledoubledoubledoubleprotected voidReport a risk-calculation failure to the platform log rather than stderr.static NumberFormatvoidperformRiskCalculation(RiskAssessmentLoopConfiguration loopConfiguration) Perform Risk calculation Overall formula: LEF x LM When the threat has no threatened element the calculation is skipped; any subsequent read of a risk figure then throws anIllegalStateException(seeSpartaRiskModel) rather than an opaque NullPointerException.voidvoidRecalculate this threat's risk after its inputs changed in the model, e.g.voidvoidsetLef(double lef) voidsetMessage(String message) protected static <T> voidsetOnRealm(org.eclipse.core.databinding.observable.value.WritableValue<T> observable, T value) Apply a value mutation on the observable's realm: directly when already running on it, asynchronously otherwise (e.g.voidsetPotentialRisk(double risk) voidsetRisk(double risk) voidsetRisk_lower(double risk) voidsetRisk_upper(double risk) voidsetSle(double sle) voidsetTef(double tef) voidvoidsetThreatTypeName(String threat) voidsetVulnerability(double vulnerability) voidsetVulnerability_lower(double vulnerability_lower) voidsetVulnerability_upper(double vulnerability_upper) Methods inherited from class be.kuleuven.cs.distrinet.sparta.core.model.Threat
buildMatchTypeLabel, getDataFlow, getDataFlowElement, getDataFlowFrom, getDataFlowFromName, getDataFlowName, getDataFlowTo, getDataFlowToName, getLef, getMitigations, getModelElement, getPatternMatch, getPotentialRisk, getRisk, getRisk_lower, getRisk_upper, getSle, getTef, getThreatenedElement, getThreatenedElementId, getThreatenedElementName, getThreatenedElementTypeName, getThreatType, getThreatTypeElement, getVulnerability, getVulnerability_lower, getVulnerability_upper, isRiskCalculated, simpleTypeName, toString, typeAbbreviation
-
Field Details
-
threatenedElementName
-
threatName
-
threatTypeName
-
flowName
-
message
-
vulnerability
-
vulnerability_lower
-
vulnerability_upper
-
risk
-
risk_lower
-
risk_upper
-
potentialRisk
-
sle
-
tef
-
lef
-
loopConfiguration
Loop configuration owned by the analysing engine; used to drive the risk calculation. -
sender
-
recipient
-
CURRENCY_LOCALE
Single source of truth for the currency locale used across the analysis views.
-
-
Constructor Details
-
ObservableThreat
public ObservableThreat(org.eclipse.core.databinding.DataBindingContext dbc, org.eclipse.viatra.query.runtime.api.IPatternMatch x, RiskAssessmentLoopConfiguration loopConfiguration) -
ObservableThreat
protected ObservableThreat(org.eclipse.viatra.query.runtime.api.IPatternMatch x, IRiskModel riskModel, RiskAssessmentLoopConfiguration loopConfiguration)
-
-
Method Details
-
setOnRealm
protected static <T> void setOnRealm(org.eclipse.core.databinding.observable.value.WritableValue<T> observable, T value) Apply a value mutation on the observable's realm: directly when already running on it, asynchronously otherwise (e.g. VIATRA delivering a match update on a non-UI thread). Off-realm callers get eventual consistency; the realm serialises all mutations and change notifications. -
formatCurrency
-
formatRisk
-
newCurrencyFormat
- Returns:
- a freshly configured currency formatter (grouping, exactly two
fraction digits) using the shared
CURRENCY_LOCALE. Intended for callers such as the analysis view header that need their own formatter instance.
-
processMatch
public void processMatch() -
getThreat
-
getThreatName
- Specified by:
getThreatNamein interfaceIThreat- Overrides:
getThreatNamein classThreat
-
getThreatTypeName
- Specified by:
getThreatTypeNamein interfaceIThreat- Overrides:
getThreatTypeNamein classThreat
-
setThreat
-
setThreatTypeName
-
getFlow
-
setFlow
-
getMessage
- Overrides:
getMessagein classThreat
-
setMessage
-
getVulnerabilityString
-
setVulnerability
public void setVulnerability(double vulnerability) -
getVulnerability_lowerString
-
setVulnerability_lower
public void setVulnerability_lower(double vulnerability_lower) -
getVulnerability_upperString
-
setVulnerability_upper
public void setVulnerability_upper(double vulnerability_upper) -
getRiskString
-
setRisk
public void setRisk(double risk) -
getPotentialRiskString
-
setPotentialRisk
public void setPotentialRisk(double risk) -
getRisk_lowerString
-
setRisk_lower
public void setRisk_lower(double risk) -
getRisk_upperString
-
setRisk_upper
public void setRisk_upper(double risk) -
getSleString
-
setSle
public void setSle(double sle) -
getTefString
-
setTef
public void setTef(double tef) -
getLefString
-
setLef
public void setLef(double lef) -
getRiskAsDouble
public double getRiskAsDouble() -
getPotentialRiskAsDouble
public double getPotentialRiskAsDouble() -
getRisk_lowerAsDouble
public double getRisk_lowerAsDouble() -
getRisk_upperAsDouble
public double getRisk_upperAsDouble() -
getVulnerabilityAsDouble
public double getVulnerabilityAsDouble() -
getVulnerability_lowerAsDouble
public double getVulnerability_lowerAsDouble() -
getVulnerability_upperAsDouble
public double getVulnerability_upperAsDouble() -
getSleAsDouble
public double getSleAsDouble() -
getTefAsDouble
public double getTefAsDouble() -
getLefAsDouble
public double getLefAsDouble() -
getMatchType
- Overrides:
getMatchTypein classThreat
-
getSender
-
getRecipient
-
getMatchObservable
protected org.eclipse.core.databinding.observable.value.IObservableValue getMatchObservable(String propertyName) -
recalculateRisk
public void recalculateRisk()Recalculate this threat's risk after its inputs changed in the model, e.g. a new role binding. Failures are logged, like for the initial calculation. -
logRiskCalculationFailure
Report a risk-calculation failure to the platform log rather than stderr. -
performRiskCalculation
Description copied from class:ThreatPerform Risk calculation Overall formula: LEF x LM When the threat has no threatened element the calculation is skipped; any subsequent read of a risk figure then throws anIllegalStateException(seeSpartaRiskModel) rather than an opaque NullPointerException.- Overrides:
performRiskCalculationin classThreat
-
getDescription
- Specified by:
getDescriptionin interfaceIThreat- Overrides:
getDescriptionin classThreat
-
getFullDescription
-