Package jline.api.sym

Class SymEngines

java.lang.Object
jline.api.sym.SymEngines

public class SymEngines extends Object
Resolves the symbolic backend to use, and owns the container that serves it.

Resolution order, the same in MATLAB (SAGE.m) and Python (line_solver.api.sym):

  1. an explicit URL, from solver options or the requested argument;
  2. the LINE_SAGE_URL environment variable;
  3. a line-sage-rest service already listening on a conventional port;
  4. a container started here from a locally present image;
  5. nothing, in which case the caller falls back to whatever native algebra it has, or reports that no backend is configured.

Step 3 verifies identity through /api/v1/info rather than trusting the port: every imperialqore line-*-rest service listens on 8080 by convention, so a health probe alone would happily accept the LQNS service.

The container started in step 4 is reused for the life of the JVM and stopped by a shutdown hook. It is bound to an ephemeral host port, so several JVMs, or a JVM alongside a hand-started service, do not collide.

Copyright (c) 2012-2026, Imperial College London All rights reserved.
  • Field Details

    • DOCKER_IMAGE

      public static final String DOCKER_IMAGE
      Image serving the symbolic REST API.
      See Also:
    • DOCKER_IMAGE_CANDIDATES

      public static final String[] DOCKER_IMAGE_CANDIDATES
      Fallback tags, tried in order after DOCKER_IMAGE.
    • URL_ENV

      public static final String URL_ENV
      Environment variable naming a service to use.
      See Also:
    • PROBE_PORTS

      public static final int[] PROBE_PORTS
      Ports probed for an already running service, in order.
    • STARTUP_TIMEOUT_SECONDS

      public static final int STARTUP_TIMEOUT_SECONDS
      Seconds to wait for a container to report healthy.
      See Also:
  • Method Details

    • resolve

      public static SymEngine resolve()
      Resolves an engine with the default request, i.e. "auto".
      Returns:
      an engine, or null if no backend could be resolved
    • resolve

      public static SymEngine resolve(String requested)
      Resolves an engine.
      Parameters:
      requested - "" or "auto" to search, a URL to use a specific service, "none" to disable the backend, or an image name to start
      Returns:
      an engine, or null if no backend could be resolved
    • findImage

      public static String findImage()
      Returns:
      the first locally present image tag, or null if none is
    • stopContainer

      public static void stopContainer()
      Stops the container started by this JVM, if any.