Class SGrDeviceBuilder


  • public class SGrDeviceBuilder
    extends java.lang.Object
    Generic SGr device builder.
    • Constructor Detail

      • SGrDeviceBuilder

        public SGrDeviceBuilder()
        Construct new instance with defaults.
    • Method Detail

      • eid

        public SGrDeviceBuilder eid​(java.nio.file.Path path)
        Sets the EID source to a file system path.
        Parameters:
        path - the file system path
        Returns:
        the same instance of the builder object
      • eid

        public SGrDeviceBuilder eid​(java.io.InputStream inputStream)
        Sets the EID source to an input stream.
        Parameters:
        inputStream - the input stream
        Returns:
        the same instance of the builder object
      • eid

        public SGrDeviceBuilder eid​(java.lang.String content)
        Sets the EID source to XML content.
        Parameters:
        content - the XML content
        Returns:
        the same instance of the builder object
      • useRestServiceClientFactory

        public SGrDeviceBuilder useRestServiceClientFactory​(com.smartgridready.driver.api.http.GenHttpClientFactory httpClientFactory)
        Sets the REST API service client factory.
        Parameters:
        httpClientFactory - an instance of a REST API service client factory
        Returns:
        the same instance of the builder object
      • useModbusClientFactory

        public SGrDeviceBuilder useModbusClientFactory​(com.smartgridready.driver.api.modbus.GenDriverAPI4ModbusFactory modbusClientFactory)
        Sets the Modbus client factory explicitly. If not set explicitly, the Java ServiceLoader mechanism tries to find an implementation.
        Parameters:
        modbusClientFactory - an instance of a Modbus client factory
        Returns:
        the same instance of the builder object
      • useMessagingClientFactory

        public SGrDeviceBuilder useMessagingClientFactory​(com.smartgridready.driver.api.messaging.GenMessagingClientFactory messagingClientFactory,
                                                          com.smartgridready.driver.api.messaging.model.MessagingPlatformType platform)
        Sets the messaging client factory to be used explicitly. If not set explicitly, the Java ServiceLoader mechanism tries to find an implementation.
        Parameters:
        messagingClientFactory - the messaging client factory to be used
        platform - the messaging platform type
      • useContactsDriverFactory

        public SGrDeviceBuilder useContactsDriverFactory​(com.smartgridready.driver.api.contacts.GenDriverAPI4ContactsFactory contactsDriverFactory)
        Sets the contacts driver factory explicitly. If not set explicitly, the Java ServiceLoader mechanism tries to find an implementation.
        Parameters:
        contactsDriverFactory - an instance of a contacts driver factory
        Returns:
        the same instance of the builder object
      • useSharedModbusRtu

        public SGrDeviceBuilder useSharedModbusRtu​(boolean useSharedModbusRtu)
        Enable or disable shared instances of Modbus RTU driver. Is false by default, if not set.
        Parameters:
        useSharedModbusRtu - true if shared, false otherwise
        Returns:
        the same instance of the builder object
      • useSharedModbusGatewayRegistry

        public SGrDeviceBuilder useSharedModbusGatewayRegistry​(ModbusGatewayRegistry sharedModbusGatewayRegistry)
        Sets a custom shared Modbus RTU driver registry. Uses a singleton instance by default, if not set. Also depends on useSharedModbusRtu().
        Parameters:
        sharedModbusGatewayRegistry - the custom registry
        Returns:
        the same instance of the builder object
      • properties

        public SGrDeviceBuilder properties​(java.util.Properties properties)
        Sets the EID configuration parameters.
        Parameters:
        properties - the properties
        Returns:
        the same instance of the builder object
      • build

        public GenDeviceApi build()
                           throws com.smartgridready.driver.api.common.GenDriverException,
                                  RestApiAuthenticationException
        Builds the SGr device using the previously set builder parameters.
        Returns:
        an SGr device object
        Throws:
        com.smartgridready.driver.api.common.GenDriverException - on generic error
        RestApiAuthenticationException - on authentication error