Package jmri.server.json.message
Class JsonMessageServiceFactory
java.lang.Object
jmri.server.json.message.JsonMessageServiceFactory
- All Implemented Interfaces:
JmriServiceProviderInterface,JsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService>
public class JsonMessageServiceFactory
extends Object
implements JsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService>
Service factory for the JSON messaging service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper, String version) Create a JSON HTTP service.String[]getSentTypes(String version) Get the message type(s) services created by this factory send, if not also listed inJsonServiceFactory.getTypes(String).getSocketService(JsonConnection connection, String version) Create a JSON service for the given connection.String[]Get the service type(s) for services created by this factory respond to.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.spi.JsonServiceFactory
getReceivedTypes
-
Constructor Details
-
JsonMessageServiceFactory
public JsonMessageServiceFactory()
-
-
Method Details
-
getTypes
Description copied from interface:JsonServiceFactoryGet 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.
- Specified by:
getTypesin interfaceJsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService> - Parameters:
version- The JSON protocol version major component identifier- Returns:
- An array of types this service responds to
-
getSentTypes
Description copied from interface:JsonServiceFactoryGet the message type(s) services created by this factory send, if not also listed inJsonServiceFactory.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.
- Specified by:
getSentTypesin interfaceJsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService> - Parameters:
version- The JSON protocol version major component identifier- Returns:
- An array of types this service sends, but does not respond to
-
getSocketService
Description copied from interface:JsonServiceFactoryCreate a JSON service for the given connection. This connection can be a WebSocket or raw socket.- Specified by:
getSocketServicein interfaceJsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService> - 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
public JsonMessageHttpService getHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper, String version) Description copied from interface:JsonServiceFactoryCreate a JSON HTTP service.- Specified by:
getHttpServicein interfaceJsonServiceFactory<JsonMessageHttpService,JsonMessageSocketService> - 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
-