Interface RemotePluginServer

  • All Superinterfaces:
    org.eclipse.keyple.core.common.KeyplePluginExtension

    public interface RemotePluginServer
    extends org.eclipse.keyple.core.common.KeyplePluginExtension
    API of the Remote Plugin Server associated to a Local Service Client to be used in the Reader Client Side configuration mode.

    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 ?

    1. Register the plugin.
    2. Subscribe to plugin observation.
    3. Wait to be notified of a plugin event of type "READER_CONNECTED".
    4. Retrieve the name of the first reader contained in the event readers list.
    5. Retrieve the remote reader from the plugin.
    6. Retrieve the service id from the reader using the method RemoteReaderServer.getServiceId().
    7. Execute the ticketing service identified by the service id.
    8. 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 method RemoteReaderServer.getInputData(Class).
    9. 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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void endRemoteService​(java.lang.String remoteReaderName, java.lang.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 getAsyncNode()
      Gets the associated AsyncNodeServer if the service is configured with an asynchronous network protocol.
      org.eclipse.keyple.distributed.SyncNodeServer getSyncNode()
      Gets the associated SyncNodeServer if the service is configured with a synchronous network protocol.
    • Method Detail

      • getSyncNode

        org.eclipse.keyple.distributed.SyncNodeServer getSyncNode()
        Gets the associated SyncNodeServer if the service is configured with a synchronous network protocol.
        Returns:
        A not null reference.
        Throws:
        java.lang.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 associated AsyncNodeServer if the service is configured with an asynchronous network protocol.
        Returns:
        A not null reference.
        Throws:
        java.lang.IllegalStateException - If the service is not configured with an asynchronous network protocol.
        Since:
        2.0.0
      • endRemoteService

        void endRemoteService​(java.lang.String remoteReaderName,
                              java.lang.Object outputData)
        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:
        java.lang.IllegalArgumentException - If the remote reader name is null, empty or unknown.
        Since:
        2.0.0