Package jmri.spi

Interface JsonServiceFactory<H extends JsonHttpService,​S extends JsonSocketService<H>>

    • Method Detail

      • getTypes

        @Nonnull
        String[] getTypes​(@Nonnull
                          String version)
        Get the service type(s) for services created by this factory respond to. These type must have valid schemas for messages received from a client and sent to a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        If a service returns no types, it will never be used.

        Parameters:
        version - The JSON protocol version major component identifier
        Returns:
        An array of types this service responds to
      • getSentTypes

        @Nonnull
        default String[] getSentTypes​(@Nonnull
                                      String version)
        Get the message type(s) services created by this factory send, if not also listed in getTypes(String). These types must only have schemas for messages sent to a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        Parameters:
        version - The JSON protocol version major component identifier
        Returns:
        An array of types this service sends, but does not respond to
      • getReceivedTypes

        @Nonnull
        default String[] getReceivedTypes​(@Nonnull
                                          String version)
        Get the message type(s) services created by this factory receive, if not also listed in getTypes(String). These types must only have schemas for messages received from a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        Parameters:
        version - The JSON protocol version major component identifier
        Returns:
        An array of types this service sends, but does not respond to
      • getSocketService

        @Nonnull
        S getSocketService​(@Nonnull
                           JsonConnection connection,
                           @Nonnull
                           String version)
        Create a JSON service for the given connection. This connection can be a WebSocket or raw socket.
        Parameters:
        connection - The connection for this service to respond to
        version - The JSON protocol version major component identifier
        Returns:
        A service or null if the service does not support sockets
      • getHttpService

        @Nonnull
        H getHttpService​(@Nonnull
                         com.fasterxml.jackson.databind.ObjectMapper mapper,
                         @Nonnull
                         String version)
        Create a JSON HTTP service.
        Parameters:
        mapper - The object mapper for the HTTP service to use
        version - The JSON protocol version major component identifier
        Returns:
        A servlet or null if the service does not support HTTP
      • getTypes

        @Deprecated
        @Nonnull
        default String[] getTypes()
        Deprecated.
        since 4.19.2; use getTypes(String) instead
        Get the service type(s) for services created by this factory respond to. These type must have valid schemas for messages received from a client and sent to a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        If a service returns no types, it will never be used.

        Returns:
        An array of types this service responds to
      • getSentTypes

        @Deprecated
        @Nonnull
        default String[] getSentTypes()
        Deprecated.
        since 4.19.2; use getSentTypes(String) instead
        Get the message type(s) services created by this factory send, if not also listed in getTypes(). These types must only have schemas for messages sent to a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        Returns:
        An array of types this service sends, but does not respond to
      • getReceivedTypes

        @Deprecated
        @Nonnull
        default String[] getReceivedTypes()
        Deprecated.
        since 4.19.2; use getReceivedTypes(String) instead
        Get the message type(s) services created by this factory receive, if not also listed in getTypes(). These types must only have schemas for messages received from a client.

        Types should be single words, in camelCase if needed, unless supporting a plural noun introduced in the JSON 1.x or 2.x protocols and exposed in the JSON 3.0 or newer protocol.

        Returns:
        An array of types this service sends, but does not respond to
      • getHttpService

        @Deprecated
        @Nonnull
        default H getHttpService​(com.fasterxml.jackson.databind.ObjectMapper mapper)
        Deprecated.
        since 4.19.2; use getHttpService(ObjectMapper, String) instead
        Create a JSON HTTP service.
        Parameters:
        mapper - The object mapper for the HTTP service to use
        Returns:
        A servlet or null if the service does not support HTTP