Class TrdpConfig

java.lang.Object
com.trdp.config.TrdpConfig

public final class TrdpConfig extends Object
Loads TRDP device configuration from XML files conforming to the IEC 61375-2-3 trdp-config.xsd schema.

The XML is first validated against the XSD (bundled on the classpath), then deserialized into an immutable DeviceConfig object graph.

Usage:

DeviceConfig config = TrdpConfig.load(Path.of("trdp-config.xml"));
for (BusInterface bi : config.getBusInterfaces()) {
    System.out.println(bi.getName() + " -> " + bi.getTelegrams().size() + " telegrams");
}
See Also:
  • Method Details

    • load

      public static DeviceConfig load(Path path) throws TrdpConfigException
      Loads and validates a TRDP configuration from the given file path.
      Parameters:
      path - the path to the XML configuration file.
      Returns:
      the parsed device configuration.
      Throws:
      TrdpConfigException - if the file cannot be read, fails XSD validation, or cannot be deserialized.
    • load

      public static DeviceConfig load(InputStream inputStream) throws TrdpConfigException
      Loads and validates a TRDP configuration from the given input stream.
      Parameters:
      inputStream - the input stream containing the XML configuration.
      Returns:
      the parsed device configuration.
      Throws:
      TrdpConfigException - if the stream cannot be read, fails XSD validation, or cannot be deserialized.