Class PluginsConfigurator.Builder

    • Method Detail

      • withUsageTimeout

        public PluginsConfigurator.Builder withUsageTimeout​(int usageTimeoutMillis)
        Specifies the timeout to use after that an allocated card resource can be automatically re-allocated by card resource service to a new thread if requested.

        Default value: infinite

        Parameters:
        usageTimeoutMillis - The max usage duration of a card resource (in milliseconds).
        Returns:
        The current builder instance.
        Throws:
        java.lang.IllegalArgumentException - If the provided value is less or equal to 0.
        java.lang.IllegalStateException - If the timeout has already been configured.
        Since:
        2.0.0
      • addPlugin

        public PluginsConfigurator.Builder addPlugin​(org.eclipse.keyple.core.service.Plugin plugin,
                                                     ReaderConfiguratorSpi readerConfiguratorSpi)
        Adds a Plugin or ObservablePlugin to the default list of all card profiles.

        Note: The order of the plugins is important because it will be kept during the allocation process unless redefined by card profiles.

        Parameters:
        plugin - The plugin to add.
        readerConfiguratorSpi - The reader configurator to use when a reader is connected and accepted by at leas one card resource profile.
        Returns:
        The current builder instance.
        Throws:
        java.lang.IllegalArgumentException - If the provided plugin or reader configurator is null or if the plugin is not an instance of Plugin or ObservablePlugin.
        java.lang.IllegalStateException - If the plugin has already been configured.
        Since:
        2.0.0
      • addPluginWithMonitoring

        public PluginsConfigurator.Builder addPluginWithMonitoring​(org.eclipse.keyple.core.service.Plugin plugin,
                                                                   ReaderConfiguratorSpi readerConfiguratorSpi,
                                                                   org.eclipse.keyple.core.service.spi.PluginObservationExceptionHandlerSpi pluginObservationExceptionHandlerSpi,
                                                                   org.calypsonet.terminal.reader.spi.CardReaderObservationExceptionHandlerSpi readerObservationExceptionHandlerSpi)
        Adds a Plugin or ObservablePlugin to the default list of all card profiles with background auto monitoring of reader connections/disconnections and/or card insertions/removals.

        Note: The order of the plugins is important because it will be kept during the allocation process unless redefined by card profiles.

        The plugin or readers must be observable for the monitoring operations to have an effect.

        Parameters:
        plugin - The plugin to add.
        readerConfiguratorSpi - The reader configurator to use when a reader is connected and accepted by at leas one card resource profile.
        pluginObservationExceptionHandlerSpi - If not null, then activates the monitoring of the plugin and specifies the exception handler to use in case of error occurs during the asynchronous observation process.
        readerObservationExceptionHandlerSpi - If not null, then activates the monitoring of the readers and specifies the exception handler to use in case of error occurs during the asynchronous observation process.
        Returns:
        The current builder instance.
        Throws:
        java.lang.IllegalArgumentException - If the provided plugin or reader configurator is null or if the plugin is not an instance of Plugin or ObservablePlugin.
        java.lang.IllegalStateException - If the plugin has already been configured.
        Since:
        2.0.0
      • build

        public PluginsConfigurator build()
        Creates a new instance of PluginsConfigurator using the current configuration.
        Returns:
        A new instance.
        Throws:
        java.lang.IllegalStateException - If no plugin has been configured.
        Since:
        2.0.0