Interface CardResourceService
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
andObservableCardReader
.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptiongetCardResource
(String cardResourceProfileName) Gets the first card resource available for the provided card resource profile name using the configured allocation strategy.Gets the configuration builder to set up the service.void
releaseCardResource
(CardResource cardResource) Releases the card resource to make it available to other users.void
removeCardResource
(CardResource cardResource) Removes the card resource and releases it if it is in use.void
start()
Starts the service using the current configuration, initializes the list of card resources, activates the required monitoring, if any.void
stop()
Stops the service if it is started.
-
Method Details
-
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:
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
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:
IllegalArgumentException
- If the profile name is null, empty or not configured.IllegalStateException
- If the service is not started.- Since:
- 2.0.0
-
releaseCardResource
Releases the card resource to make it available to other users.- Parameters:
cardResource
- The card resource to release.- Throws:
IllegalArgumentException
- If the provided card resource is null.- Since:
- 2.0.0
-
removeCardResource
Removes the card resource and releases it if it is in use.- Parameters:
cardResource
- The card resource to remove.- Throws:
IllegalArgumentException
- If the provided card resource is null.- Since:
- 2.0.0
-