Package com.powsybl.iidm.import_
Class Importers
- java.lang.Object
-
- com.powsybl.iidm.import_.Importers
-
public final class Importers extends Object
A utility class to work with IIDM importers.- Author:
- Geoffroy Jamgotchian
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Importer
addPostProcessors(Importer importer, ComputationManager computationManager, String... names)
static Importer
addPostProcessors(Importer importer, String... names)
static Importer
addPostProcessors(ImportersLoader loader, Importer importer, ComputationManager computationManager, String... names)
static DataSource
createDataSource(Path file)
static DataSource
createDataSource(Path directory, String fileNameOrBaseName)
static Importer
findImporter(ReadOnlyDataSource dataSource, ComputationManager computationManager)
static Importer
findImporter(ReadOnlyDataSource dataSource, ImportersLoader loader, ComputationManager computationManager, ImportConfig config)
static Collection<String>
getFormats()
static Collection<String>
getFormats(ImportersLoader loader)
Get all supported import formats.static Importer
getImporter(ImportersLoader loader, String format, ComputationManager computationManager, ImportConfig config)
Get an importer for the specified format name.static Importer
getImporter(String format)
Get an importer for the specified format name.static Importer
getImporter(String format, ComputationManager computationManager)
Get an importer for the specified format name.static Importer
getImporter(String format, ComputationManager computationManager, ImportConfig config)
Get an importer for the specified format name.static Collection<String>
getPostProcessorNames()
static Collection<String>
getPostProcessorNames(ImportersLoader loader)
static void
importAll(Path dir, Importer importer, boolean parallel, Consumer<Network> consumer)
static void
importAll(Path dir, Importer importer, boolean parallel, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
importAll(Path dir, Importer importer, boolean parallel, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener, Reporter reporter)
static Network
importData(ImportersLoader loader, String format, ReadOnlyDataSource dataSource, Properties parameters, ComputationManager computationManager, ImportConfig config)
A convenient method to create a model from data in a given format.static Network
importData(String format, ReadOnlyDataSource dataSource, Properties parameters)
static Network
importData(String format, ReadOnlyDataSource dataSource, Properties parameters, ComputationManager computationManager)
static Network
importData(String format, String directory, String baseName, Properties parameters)
A convenient method to create a model from data in a given format.static Collection<Importer>
list()
static Collection<Importer>
list(ComputationManager computationManager, ImportConfig config)
static Collection<Importer>
list(ImportersLoader loader, ComputationManager computationManager, ImportConfig config)
static Network
loadNetwork(String file)
Loads a network from the specified file path, seeloadNetwork(Path)
.static Network
loadNetwork(String filename, InputStream data)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services.static Network
loadNetwork(String filename, InputStream data, Reporter reporter)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services.static Network
loadNetwork(String filename, InputStream data, ComputationManager computationManager)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services.static Network
loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services.static Network
loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader)
Loads a network from a raw input stream, trying to guess the format from the specified filename.static Network
loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader, Reporter reporter)
Loads a network from a raw input stream, trying to guess the format from the specified filename.static Network
loadNetwork(Path file)
Loads a network from the specified file, trying to guess its format, and using importers and post processors defined as services.static Network
loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters)
Loads a network from the specified file, trying to guess its format, and using importers and post processors defined as services.static Network
loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader)
Loads a network from the specified file, trying to guess its format.static Network
loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader, Reporter reporter)
Loads a network from the specified file, trying to guess its format.static void
loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer)
static void
loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener, Reporter reporter)
static void
loadNetworks(Path dir, boolean parallel, Consumer<Network> consumer)
static void
loadNetworks(Path dir, boolean parallel, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener)
static void
loadNetworks(Path dir, Consumer<Network> consumer)
static Object
readParameter(String format, Properties parameters, Parameter configuredParameter)
Deprecated.static Object
readParameter(String format, Properties parameters, Parameter configuredParameter, ParameterDefaultValueConfig defaultValueConfig)
Deprecated.static Importer
removePostProcessors(Importer importer)
static Importer
setPostProcessors(Importer importer, ComputationManager computationManager, String... names)
static Importer
setPostProcessors(Importer importer, String... names)
static Importer
setPostProcessors(ImportersLoader loader, Importer importer, ComputationManager computationManager, String... names)
-
-
-
Method Detail
-
getFormats
public static Collection<String> getFormats(ImportersLoader loader)
Get all supported import formats.
-
getFormats
public static Collection<String> getFormats()
-
list
public static Collection<Importer> list(ImportersLoader loader, ComputationManager computationManager, ImportConfig config)
-
list
public static Collection<Importer> list(ComputationManager computationManager, ImportConfig config)
-
list
public static Collection<Importer> list()
-
getImporter
public static Importer getImporter(ImportersLoader loader, String format, @Nullable ComputationManager computationManager, ImportConfig config)
Get an importer for the specified format name. The returned importer will apply configuredImportPostProcessor
s on imported networks.- Parameters:
loader
- the loader responsible for providing the list of available importers and post processorsformat
- the import formatcomputationManager
- a computation manager which may be used by configuredImportPostProcessor
sconfig
- the import configuration- Returns:
- the importer if one exists for the given format or
null
otherwise.
-
getImporter
public static Importer getImporter(String format, @Nullable ComputationManager computationManager, ImportConfig config)
Get an importer for the specified format name. The returned importer will apply configuredImportPostProcessor
s on imported networks.All declared services implementing the
Importer
interface are available.- Parameters:
format
- the import formatcomputationManager
- a computation manager which may be used by configuredImportPostProcessor
sconfig
- the import configuration- Returns:
- the importer if one exists for the given format or
null
otherwise.
-
getImporter
public static Importer getImporter(String format, @Nullable ComputationManager computationManager)
Get an importer for the specified format name. The returned importer will apply configuredImportPostProcessor
s on imported networks.All declared services implementing the
Importer
interface are available. The import configuration is loaded from default platform config.- Parameters:
format
- the import formatcomputationManager
- a computation manager which may be used by configuredImportPostProcessor
s- Returns:
- the importer if one exists for the given format or
null
otherwise.
-
getImporter
public static Importer getImporter(String format)
Get an importer for the specified format name. The returned importer will apply configuredImportPostProcessor
s on imported networks.All declared services implementing the
Importer
interface are available. The import configuration is loaded from default platform config. Import post processors will use the default instance ofLocalComputationManager
, as configured in default platform config.- Parameters:
format
- the import format- Returns:
- the importer if one exists for the given format or
null
otherwise.
-
getPostProcessorNames
public static Collection<String> getPostProcessorNames(ImportersLoader loader)
-
getPostProcessorNames
public static Collection<String> getPostProcessorNames()
-
addPostProcessors
public static Importer addPostProcessors(ImportersLoader loader, Importer importer, ComputationManager computationManager, String... names)
-
addPostProcessors
public static Importer addPostProcessors(Importer importer, ComputationManager computationManager, String... names)
-
setPostProcessors
public static Importer setPostProcessors(ImportersLoader loader, Importer importer, ComputationManager computationManager, String... names)
-
setPostProcessors
public static Importer setPostProcessors(Importer importer, ComputationManager computationManager, String... names)
-
importData
public static Network importData(ImportersLoader loader, String format, ReadOnlyDataSource dataSource, Properties parameters, ComputationManager computationManager, ImportConfig config)
A convenient method to create a model from data in a given format.- Parameters:
format
- the import formatdataSource
- data sourceparameters
- some properties to configure the importcomputationManager
- computation manager to use for default post processors- Returns:
- the model
-
importData
public static Network importData(String format, ReadOnlyDataSource dataSource, Properties parameters, ComputationManager computationManager)
-
importData
public static Network importData(String format, ReadOnlyDataSource dataSource, Properties parameters)
-
importData
public static Network importData(String format, String directory, String baseName, Properties parameters)
A convenient method to create a model from data in a given format.- Parameters:
format
- the import formatdirectory
- the directory where input files arebaseName
- a base name for all input filesparameters
- some properties to configure the import- Returns:
- the model
-
importAll
public static void importAll(Path dir, Importer importer, boolean parallel, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener, Reporter reporter) throws IOException, InterruptedException, ExecutionException
-
importAll
public static void importAll(Path dir, Importer importer, boolean parallel, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
importAll
public static void importAll(Path dir, Importer importer, boolean parallel, Consumer<Network> consumer) throws IOException, InterruptedException, ExecutionException
-
readParameter
@Deprecated public static Object readParameter(String format, Properties parameters, Parameter configuredParameter)
Deprecated.
-
readParameter
@Deprecated public static Object readParameter(String format, Properties parameters, Parameter configuredParameter, ParameterDefaultValueConfig defaultValueConfig)
Deprecated.
-
createDataSource
public static DataSource createDataSource(Path file)
-
createDataSource
public static DataSource createDataSource(Path directory, String fileNameOrBaseName)
-
findImporter
public static Importer findImporter(ReadOnlyDataSource dataSource, ImportersLoader loader, ComputationManager computationManager, ImportConfig config)
-
findImporter
public static Importer findImporter(ReadOnlyDataSource dataSource, ComputationManager computationManager)
-
loadNetwork
public static Network loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader, Reporter reporter)
Loads a network from the specified file, trying to guess its format.- Parameters:
file
- The file to be loaded.computationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parametersloader
- Provides the list of available importers and post-processorsreporter
- The reporter used for functional logs- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader)
Loads a network from the specified file, trying to guess its format.- Parameters:
file
- The file to be loaded.computationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parametersloader
- Provides the list of available importers and post-processors- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(Path file, ComputationManager computationManager, ImportConfig config, Properties parameters)
Loads a network from the specified file, trying to guess its format, and using importers and post processors defined as services.- Parameters:
file
- The file to be loaded.computationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parameters- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(Path file)
Loads a network from the specified file, trying to guess its format, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the defaultLocalComputationManager
, as defined in default platform config.- Parameters:
file
- The file to be loaded.- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String file)
Loads a network from the specified file path, seeloadNetwork(Path)
.- Parameters:
file
- The file to be loaded.- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader, Reporter reporter)
Loads a network from a raw input stream, trying to guess the format from the specified filename.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loadedcomputationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parametersloader
- Provides the list of available importers and post-processorsreporter
- The reporter used for functional logs- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters, ImportersLoader loader)
Loads a network from a raw input stream, trying to guess the format from the specified filename.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loadedcomputationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parametersloader
- Provides the list of available importers and post-processors- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data, ComputationManager computationManager, ImportConfig config, Properties parameters)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loadedcomputationManager
- A computation manager which may be used by import post-processorsconfig
- The import config, in particular definition of post processorsparameters
- Import-specific parameters- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data, ComputationManager computationManager)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loadedcomputationManager
- A computation manager which may be used by import post-processors- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the defaultLocalComputationManager
, as defined in default platform config.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loaded- Returns:
- The loaded network
-
loadNetwork
public static Network loadNetwork(String filename, InputStream data, Reporter reporter)
Loads a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the defaultLocalComputationManager
, as defined in default platform config.- Parameters:
filename
- The name of the file to be imported.data
- The raw data from which the network should be loadedreporter
- The reporter used for functional logs- Returns:
- The loaded network
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener, Reporter reporter) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ImportersLoader loader, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Properties parameters, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, ComputationManager computationManager, ImportConfig config, Consumer<Network> consumer) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, Consumer<Network> consumer) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, boolean parallel, Consumer<Network> consumer, Consumer<ReadOnlyDataSource> listener) throws IOException, InterruptedException, ExecutionException
-
loadNetworks
public static void loadNetworks(Path dir, Consumer<Network> consumer) throws IOException, InterruptedException, ExecutionException
-
-