Interface RemotePluginServer
- All Superinterfaces:
org.eclipse.keyple.core.common.KeyplePluginExtension
This plugin must be registered as a standard plugin by the application installed on a Server not having local access to the smart card reader and that wishes to control the reader remotely.
It is a KeyplePluginExtension
of a Keyple ObservablePlugin which provides some
specific features.
Please note that this plugin is observable only to trigger ticketing services on the server side, but does not allow observation on the local plugin (reader connection/disconnection).
Note also that its provided remote readers are not observable. If it is necessary to observe the local readers, it is the responsibility of the local application to do so.
How to use it ?
- Register the plugin.
- Subscribe to plugin observation.
- Wait to be notified of a plugin event of type "READER_CONNECTED".
- Retrieve the name of the first reader contained in the event readers list.
- Retrieve the remote reader from the plugin.
- Retrieve the service id from the reader using the method
RemoteReaderServer.getServiceId()
. - Execute the ticketing service identified by the service id.
- During the ticketing service execution, you can retrieve from the reader the initial smart
card content transmitted by the client using the method
RemoteReaderServer.getInitialCardContent()
and/or the additional input data using the methodRemoteReaderServer.getInputData(Class)
. - To end the remote ticketing service, invoke on the plugin the method
endRemoteService(String, Object)
by providing the reader name and optionally a output data to transmit to the client.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
endRemoteService
(String remoteReaderName, Object outputData) Ends the remote ticketing service associated to the provided remote reader name and returns to the client the provided optional output data.org.eclipse.keyple.distributed.AsyncNodeServer
Gets the associatedAsyncNodeServer
if the service is configured with an asynchronous network protocol.org.eclipse.keyple.distributed.SyncNodeServer
Gets the associatedSyncNodeServer
if the service is configured with a synchronous network protocol.
-
Method Details
-
getSyncNode
org.eclipse.keyple.distributed.SyncNodeServer getSyncNode()Gets the associatedSyncNodeServer
if the service is configured with a synchronous network protocol.- Returns:
- A not null reference.
- Throws:
IllegalStateException
- If the service is not configured with a synchronous network protocol.- Since:
- 2.0.0
-
getAsyncNode
org.eclipse.keyple.distributed.AsyncNodeServer getAsyncNode()Gets the associatedAsyncNodeServer
if the service is configured with an asynchronous network protocol.- Returns:
- A not null reference.
- Throws:
IllegalStateException
- If the service is not configured with an asynchronous network protocol.- Since:
- 2.0.0
-
endRemoteService
Ends the remote ticketing service associated to the provided remote reader name and returns to the client the provided optional output data.This method uses Class.getClass() to get the type for the specified object, but the getClass() loses the generic type information because of the Type Erasure feature of Java.
Note that this method works fine if the any of the object fields are of generic type, just the object itself should not be of a generic type.
- Parameters:
remoteReaderName
- The remote reader name.outputData
- The object containing output data (optional).- Throws:
IllegalArgumentException
- If the remote reader name is null, empty or unknown.- Since:
- 2.0.0
-