001package jmri.server.json.power; 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 * 010 * @author Randall Wood Copyright 2016, 2018 011 */ 012@ServiceProvider(service = JsonServiceFactory.class) 013public class JsonPowerServiceFactory implements JsonServiceFactory<JsonPowerHttpService, JsonPowerSocketService> { 014 015 /** 016 * Token for type and name for power status messages. 017 * 018 * {@value #POWER} 019 */ 020 public static final String POWER = "power"; 021 022 @Override 023 public String[] getTypes(String version) { 024 return new String[]{POWER}; 025 } 026 027 @Override 028 public JsonPowerSocketService getSocketService(JsonConnection connection, String version) { 029 return new JsonPowerSocketService(connection); 030 } 031 032 @Override 033 public JsonPowerHttpService getHttpService(ObjectMapper mapper, String version) { 034 return new JsonPowerHttpService(mapper); 035 } 036 037}