Interface CardResourceService


  • public interface CardResourceService
    Card Resource Management Service.

    Provides the means to define and manage an arbitrary number of CardResource that can be accessed later by the application using the profile names it has chosen and to which the CardResources will be associated.

    The creation of the CardResource can be static or dynamic, with various allocation strategy options depending on the parameters specified at configuration time (see CardResourceServiceConfigurator).

    The concept of dynamic creation of CardResource comes in two forms:

    • with a dynamic allocation of readers from a PoolPlugin,
    • with the internally managed observation mechanisms of ObservablePlugin and ObservableCardReader.
    Since:
    2.0.0
    • Method Detail

      • getConfigurator

        CardResourceServiceConfigurator getConfigurator()
        Gets the configuration builder to set up the service.
        Returns:
        A not null reference.
        Since:
        2.0.0
      • start

        void start()
        Starts the service using the current configuration, initializes the list of card resources, activates the required monitoring, if any.

        The service is restarted if it is already started.

        Throws:
        java.lang.IllegalStateException - If no configuration was done.
        Since:
        2.0.0
      • stop

        void stop()
        Stops the service if it is started.

        All monitoring processes are stopped, all card resources are released.

        Since:
        2.0.0
      • getCardResource

        CardResource getCardResource​(java.lang.String cardResourceProfileName)
        Gets the first card resource available for the provided card resource profile name using the configured allocation strategy.

        Note : The returned resource is then no longer available to other users until the releaseCardResource(CardResource) method is called or the service restarted.

        Parameters:
        cardResourceProfileName - The name of the card resource profile.
        Returns:
        Null if no card resource is available.
        Throws:
        java.lang.IllegalArgumentException - If the profile name is null, empty or not configured.
        java.lang.IllegalStateException - If the service is not started.
        Since:
        2.0.0
      • releaseCardResource

        void releaseCardResource​(CardResource cardResource)
        Releases the card resource to make it available to other users.
        Parameters:
        cardResource - The card resource to release.
        Throws:
        java.lang.IllegalArgumentException - If the provided card resource is null.
        Since:
        2.0.0
      • removeCardResource

        void removeCardResource​(CardResource cardResource)
        Removes the card resource and releases it if it is in use.
        Parameters:
        cardResource - The card resource to remove.
        Throws:
        java.lang.IllegalArgumentException - If the provided card resource is null.
        Since:
        2.0.0