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