001package jmri.server.json.sensor; 002 003import static jmri.server.json.sensor.JsonSensor.SENSOR; 004import static jmri.server.json.sensor.JsonSensor.SENSORS; 005 006import com.fasterxml.jackson.databind.ObjectMapper; 007import jmri.server.json.JsonConnection; 008import jmri.spi.JsonServiceFactory; 009import org.openide.util.lookup.ServiceProvider; 010 011/** 012 * Factory for JSON services for {@link jmri.Sensor}s. 013 * 014 * @author Randall Wood 015 */ 016@ServiceProvider(service = JsonServiceFactory.class) 017public class JsonSensorServiceFactory implements JsonServiceFactory<JsonSensorHttpService, JsonSensorSocketService> { 018 019 020 @Override 021 public String[] getTypes(String version) { 022 return new String[]{SENSOR, SENSORS}; 023 } 024 025 @Override 026 public JsonSensorSocketService getSocketService(JsonConnection connection, String version) { 027 return new JsonSensorSocketService(connection); 028 } 029 030 @Override 031 public JsonSensorHttpService getHttpService(ObjectMapper mapper, String version) { 032 return new JsonSensorHttpService(mapper); 033 } 034 035}