package jalview.rest; import java.net.BindException; import java.util.HashMap; import java.util.Map; public class API extends RestHandler { private static final String MY_PATH = "api"; private static final String MY_NAME = "Jalview API"; private static Map statusMap = new HashMap<>(); private static Map requestMap = new HashMap<>(); private static Map objectMap = new HashMap<>(); private static API instance = null; public static API getInstance() throws BindException { synchronized (API.class) { if (instance == null) { instance = new API(); } } return instance; } private API() throws BindException { super(); } private boolean init = false; @Override protected void init() throws BindException { if (init) return; super.init(MY_PATH); // add endpoints here addEndpoint(new FetchSequencesEndpoint(this)); addEndpoint(new InputAlignmentEndpoint(this)); addEndpoint(new HighlightSequenceEndpoint(this)); addEndpoint(new SelectSequencesEndpoint(this)); addEndpoint(new GetCrossReferencesEndpoint(this)); addEndpoint(new HighlightGenomicRangeEndpoint(this)); setPath(MY_PATH); this.registerHandler(); init = true; } /* * Shared methods below here */ @Override public String getPath() { return MY_PATH; } protected static Map getStatusMap() { return statusMap; } protected static Map getRequestMap() { return requestMap; } protected static Map getObjectMap() { return objectMap; } }