Interface LocalServiceClient

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

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

    This service must be started by the application installed on a Client having local access to the smart card reader but wishes to delegate all or part of the ticketing processing to a remote application :

    • To start the service, use the class LocalServiceClientFactoryBuilder to build an instance of the factory LocalServiceClientFactory and register it to the Keyple service.
    • To access the service, use the available accessors in the Keyple service.
    • To stop the service, unregister it from the Keyple service.
    Since:
    2.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T executeRemoteService​(java.lang.String serviceId, java.lang.String localReaderName, java.lang.Object initialCardContent, java.lang.Object inputData, java.lang.Class<T> outputDataClass)
      Executes on a local reader a specific ticketing service remotely from the server.
      org.eclipse.keyple.distributed.AsyncNodeClient getAsyncNode()
      Gets the associated AsyncNodeClient if the service is configured with an asynchronous network protocol.
    • Method Detail

      • getAsyncNode

        org.eclipse.keyple.distributed.AsyncNodeClient getAsyncNode()
        Gets the associated AsyncNodeClient 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
      • executeRemoteService

        <T> T executeRemoteService​(java.lang.String serviceId,
                                   java.lang.String localReaderName,
                                   java.lang.Object initialCardContent,
                                   java.lang.Object inputData,
                                   java.lang.Class<T> outputDataClass)
        Executes on a local reader a specific ticketing service remotely from the server.

        A remote reader associated with the local reader is created during the transaction. Thus, the remote application will be able to transparently interact directly with the local reader via the remote reader.

        Note : The associated remote reader is not observable. If it is necessary to observe the local reader, it is the responsibility of the local application to do so.

        Type Parameters:
        T - The generic type of the expected output data.
        Parameters:
        serviceId - The ticketing service ID. It will permit to indicate to the server which ticketing service to execute (Materialization, Validation, Control, etc...). This field is free.
        localReaderName - The name of the local reader to manage remotely from the server.
        initialCardContent - (optional) : A org.calypsonet.terminal.reader.selection.SmartCard containing the initial smart card content to transmit to the remote ticketing service.
        inputData - (optional) : A DTO containing additional information if needed. This field is free. 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.
        outputDataClass - (optional) : The class of the expected output data. At the end of the execution of the remote service, the server can transmit output data if needed. A null value indicates that the remote service will return nothing.
        Returns:
        A new instance of T or null if the provided output data class is null or if the returned server output data is null.
        Throws:
        java.lang.IllegalArgumentException - If the service ID or the local reader name are null or empty.
        java.lang.IllegalStateException - If the local reader is not registered.
        Since:
        2.0.0