001package jmri.server.json.route;
002
003import com.fasterxml.jackson.databind.ObjectMapper;
004import jmri.server.json.JsonConnection;
005import jmri.spi.JsonServiceFactory;
006import org.openide.util.lookup.ServiceProvider;
007
008/**
009 * Factory for JSON service providers for handling {@link jmri.Route}s.
010 *
011 * @author Randall Wood
012 */
013@ServiceProvider(service = JsonServiceFactory.class)
014public class JsonRouteServiceFactory implements JsonServiceFactory<JsonRouteHttpService, JsonRouteSocketService> {
015
016    public static final String ROUTE = "route"; // NOI18N
017    public static final String ROUTES = "routes"; // NOI18N
018
019    @Override
020    public String[] getTypes(String version) {
021        return new String[]{ROUTE, ROUTES};
022    }
023
024    @Override
025    public JsonRouteSocketService getSocketService(JsonConnection connection, String version) {
026        return new JsonRouteSocketService(connection);
027    }
028
029    @Override
030    public JsonRouteHttpService getHttpService(ObjectMapper mapper, String version) {
031        return new JsonRouteHttpService(mapper);
032    }
033
034}