Interface JsonServiceFactory<H extends JsonHttpService,S extends JsonSocketService<H>>
- Type Parameters:
H
- the specific supported HTTP serviceS
- the specific supported (Web)Socket service
- All Superinterfaces:
JmriServiceProviderInterface
- All Known Implementing Classes:
JsonBlockServiceFactory
,JsonConsistServiceFactory
,JsonIdTagServiceFactory
,JsonLayoutBlockServiceFactory
,JsonLightServiceFactory
,JsonMemoryServiceFactory
,JsonMessageServiceFactory
,JsonOblockServiceFactory
,JsonOperationsServiceFactory
,JsonPowerServiceFactory
,JsonReporterServiceFactory
,JsonRosterServiceFactory
,JsonRouteServiceFactory
,JsonSchemaServiceFactory
,JsonSensorServiceFactory
,JsonSignalHeadServiceFactory
,JsonSignalMastServiceFactory
,JsonThrottleServiceFactory
,JsonTimeServiceFactory
,JsonTurnoutServiceFactory
,JsonUtilServiceFactory
public interface JsonServiceFactory<H extends JsonHttpService,S extends JsonSocketService<H>> extends JmriServiceProviderInterface
A JSON service is a service provided by the
JsonServer
. This API allows JSON services to be
defined in a modular manner. The factory pattern is used since each
connection gets a unique instance of each service.
-
Method Summary
Modifier and Type Method Description default H
getHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper)
Deprecated.since 4.19.2; usegetHttpService(ObjectMapper, String)
insteadH
getHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper, String version)
Create a JSON HTTP service.default String[]
getReceivedTypes()
Deprecated.since 4.19.2; usegetReceivedTypes(String)
insteaddefault String[]
getReceivedTypes(String version)
Get the message type(s) services created by this factory receive, if not also listed ingetTypes(String)
.default String[]
getSentTypes()
Deprecated.since 4.19.2; usegetSentTypes(String)
insteaddefault String[]
getSentTypes(String version)
Get the message type(s) services created by this factory send, if not also listed ingetTypes(String)
.default S
getSocketService(JsonConnection connection)
Deprecated.since 4.19.2; usegetSocketService(JsonConnection, String)
insteadS
getSocketService(JsonConnection connection, String version)
Create a JSON service for the given connection.default String[]
getTypes()
Deprecated.since 4.19.2; usegetTypes(String)
insteadString[]
getTypes(String version)
Get the service type(s) for services created by this factory respond to.
-
Method Details
-
getTypes
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
Get the message type(s) services created by this factory send, if not also listed ingetTypes(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
Get the message type(s) services created by this factory receive, if not also listed ingetTypes(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
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 toversion
- 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 useversion
- The JSON protocol version major component identifier- Returns:
- A servlet or null if the service does not support HTTP
-
getTypes
Deprecated.since 4.19.2; usegetTypes(String)
insteadGet 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.since 4.19.2; usegetSentTypes(String)
insteadGet the message type(s) services created by this factory send, if not also listed ingetTypes()
. 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.since 4.19.2; usegetReceivedTypes(String)
insteadGet the message type(s) services created by this factory receive, if not also listed ingetTypes()
. 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
-
getSocketService
Deprecated.since 4.19.2; usegetSocketService(JsonConnection, String)
insteadCreate 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- Returns:
- A service or null if the service does not support sockets
-
getHttpService
Deprecated.since 4.19.2; usegetHttpService(ObjectMapper, String)
insteadCreate 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
-