001package jmri.server.json.operations;
002
003import static jmri.server.json.JSON.ENGINES;
004import static jmri.server.json.operations.JsonOperations.CAR;
005import static jmri.server.json.operations.JsonOperations.CARS;
006import static jmri.server.json.operations.JsonOperations.CAR_TYPE;
007import static jmri.server.json.operations.JsonOperations.ENGINE;
008import static jmri.server.json.operations.JsonOperations.KERNEL;
009import static jmri.server.json.operations.JsonOperations.LOCATION;
010import static jmri.server.json.operations.JsonOperations.LOCATIONS;
011import static jmri.server.json.operations.JsonOperations.ROLLING_STOCK;
012import static jmri.server.json.operations.JsonOperations.TRACK;
013import static jmri.server.json.operations.JsonOperations.TRAIN;
014import static jmri.server.json.operations.JsonOperations.TRAINS;
015
016import com.fasterxml.jackson.databind.ObjectMapper;
017import jmri.server.json.JsonConnection;
018import jmri.spi.JsonServiceFactory;
019import org.openide.util.lookup.ServiceProvider;
020
021/**
022 * Service factory for the JSON Operations services.
023 *
024 * @author Randall Wood Copyright 2016, 2018
025 */
026@ServiceProvider(service = JsonServiceFactory.class)
027public class JsonOperationsServiceFactory implements JsonServiceFactory<JsonOperationsHttpService, JsonOperationsSocketService> {
028
029    @Override
030    public String[] getTypes(String version) {
031        return new String[]{CAR, CARS, CAR_TYPE, ENGINE, ENGINES, KERNEL, LOCATION, LOCATIONS, ROLLING_STOCK, TRACK, TRAIN, TRAINS};
032    }
033
034    @Override
035    public JsonOperationsSocketService getSocketService(JsonConnection connection, String version) {
036        return new JsonOperationsSocketService(connection);
037    }
038
039    @Override
040    public JsonOperationsHttpService getHttpService(ObjectMapper mapper, String version) {
041        return new JsonOperationsHttpService(mapper);
042    }
043
044}