Class ControlBlockNetworkSettingsCsvHelper
java.lang.Object
org.lfenergy.compas.sct.commons.util.ControlBlockNetworkSettingsCsvHelper
- All Implemented Interfaces:
ControlBlockNetworkSettings
public class ControlBlockNetworkSettingsCsvHelper
extends Object
implements ControlBlockNetworkSettings
This class is an implementation example for interface ControlBlockNetworkSettings.
It relies on a CSV file.
The first columns of the CSV file are the criteria to match the ControlBlock (controlBlockEnum, systemVersionWithoutV, iedType, iedRedundancy,
isBayInternal),
The last columns are the network settings for the matched ControlBlock (as described in
ControlBlockNetworkSettings.Settings
).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.lfenergy.compas.sct.commons.dto.ControlBlockNetworkSettings
ControlBlockNetworkSettings.NetworkRanges, ControlBlockNetworkSettings.RangesPerCbType, ControlBlockNetworkSettings.Settings, ControlBlockNetworkSettings.SettingsOrError
-
Constructor Summary
ConstructorDescriptionControlBlockNetworkSettingsCsvHelper
(Reader csvSource) Constructor Provide the CSV file as a Reader. -
Method Summary
Modifier and TypeMethodDescriptiongetNetworkSettings
(ControlBlockAdapter controlBlockAdapter) This method provides a vlanId, vlanPriority, minTime, maxTime for this ControlBlock.
-
Constructor Details
-
ControlBlockNetworkSettingsCsvHelper
Constructor Provide the CSV file as a Reader. For example, you can create a reader like this :new InputStreamReader(getClass().getClassLoader().getResourceAsStream(fileName), StandardCharsets.UTF_8);
- Parameters:
csvSource
- a reader that provides the data as CSV. For example :
-
-
Method Details
-
getNetworkSettings
public ControlBlockNetworkSettings.SettingsOrError getNetworkSettings(ControlBlockAdapter controlBlockAdapter) Description copied from interface:ControlBlockNetworkSettings
This method provides a vlanId, vlanPriority, minTime, maxTime for this ControlBlock. vlanPriority will be ignored when vlanId is null.- Specified by:
getNetworkSettings
in interfaceControlBlockNetworkSettings
- Parameters:
controlBlockAdapter
- ControlBlock for which we want to configure the communication section- Returns:
- network settings to use for configuring Communication section for this ControlBlock. An error message can be provided (i.e. errorMessage not null) or a null settings, in order to avoid configuring the ControlBlock.
-