001package jmri.server.json.message;
002
003import com.fasterxml.jackson.databind.ObjectMapper;
004import jmri.server.json.JSON;
005import jmri.server.json.JsonConnection;
006import jmri.spi.JsonServiceFactory;
007import org.openide.util.lookup.ServiceProvider;
008
009/**
010 * Service factory for the JSON messaging service.
011 *
012 * @author Randall Wood Copyright 2017
013 */
014@ServiceProvider(service = JsonServiceFactory.class)
015public class JsonMessageServiceFactory implements JsonServiceFactory<JsonMessageHttpService, JsonMessageSocketService> {
016
017    @Override
018    public String[] getTypes(String version) {
019        return new String[]{JSON.HELLO, JsonMessage.CLIENT};
020    }
021
022    @Override
023    public String[] getSentTypes(String version) {
024        return new String[]{JsonMessage.MESSAGE};
025    }
026
027    @Override
028    public JsonMessageSocketService getSocketService(JsonConnection connection, String version) {
029        return new JsonMessageSocketService(connection);
030    }
031
032    @Override
033    public JsonMessageHttpService getHttpService(ObjectMapper mapper, String version) {
034        return new JsonMessageHttpService(mapper);
035    }
036
037}