Class Preference


public class Preference extends AbstractPreferenceInitializer
Class used to initialize default preference values.
Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Whether the Designer's editor endpoints - the external-browser Designer page, ?panel=, the Panel Editor's WebSocket - answer a client on another computer (EB-3, ruled 2026-10-13: default off).
    The bind address.
    int
    String caching.
    int
    String caching.
    int
    String caching.
    static final int
    The default length of the port ranges, ten ports: 2800-2809 and 4800-4809.
    The domain name.
    boolean
    Tracing.
    External web server URL, including protocol and potential port number.
    The PKCS#12 KeyStore file name.
    The password to use for the KeyStore.
    static final String
    System property overriding the bind address for this JVM only, never saved, e.g.
    static final String
    System property overriding the HTTP port for this JVM only, never saved: 0 lets the operating system pick a free port (P-D-1/P-D-2 of CC-SURVEY-PORT-2800).
    static final String
    System property overriding the HTTPS port for this JVM only, never saved: -1 for no HTTPS, 0 for a free port the operating system picks.
    boolean
    ToS accepted.
    The ToS URI.
    boolean
    Flag to use Gzip compression.
    int
    The first port of the HTTP port range (the key wsPort, which held the single port until CC-FIX-PORT-RANGE-A: a workspace that stored a port keeps it as the start of its range).
    int
    The last port of the HTTP port range.
    int
    The offset in the port ranges this workspace bound last, -1 for none: tried first at the next start (R-D-4, sticky per workspace).
    int
    The first port of the HTTPS port range (the key wsSecurePort).
    int
    The last port of the HTTPS port range.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construction of the class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates the port configurations from the preferences, at the start of the ranges (or the override).
    createPortConfigs(int offset)
    Creates the port configurations of one offset of the port ranges: HTTP wsPort+offset and HTTPS wsSecurePort+offset.
    Gets the bind address in effect: the override, else the preference.
    static Preference
    Gets the instance.
    int
    Gets the number of offsets of the port ranges: HTTP and HTTPS move together, so the shorter range bounds them (R-D-2).
    Gets the ID of this workspace, created and saved on first use: the key of its port claim and of its entry in the registry of live iiziGo (CC-FIX-PORT-RANGE-A).
    void
    Initializes the preferences store for all the terminal preferences.
    static boolean
    Tells whether the bind address is overridden for this JVM (PROP_BIND).
    static boolean
    Tells whether the HTTP port is overridden for this JVM (PROP_PORT): the port range is then not used.
    void
    rememberOffset(int offset)
    Remembers the offset this workspace bound, tried first at its next start (R-D-4); -1 forgets it.
    void
    Saves a "page" to the store.
  • Field Details

    • PROP_PORT

      public static final String PROP_PORT
      System property overriding the HTTP port for this JVM only, never saved: 0 lets the operating system pick a free port (P-D-1/P-D-2 of CC-SURVEY-PORT-2800). Set, it bypasses the port range entirely - no sticky port, no claim (CC-FIX-PORT-RANGE-A). The UI harness of com.iizigo.term.tests sets it to 0.
      See Also:
    • PROP_SECURE_PORT

      public static final String PROP_SECURE_PORT
      System property overriding the HTTPS port for this JVM only, never saved: -1 for no HTTPS, 0 for a free port the operating system picks. Read only with PROP_PORT.
      See Also:
    • PROP_BIND

      public static final String PROP_BIND
      System property overriding the bind address for this JVM only, never saved, e.g. 127.0.0.1.
      See Also:
    • DEFAULT_RANGE

      public static final int DEFAULT_RANGE
      The default length of the port ranges, ten ports: 2800-2809 and 4800-4809.
      See Also:
    • extServerURL

      public String extServerURL
      External web server URL, including protocol and potential port number.

      This setting must be set if the retrieval of the local host name e.g. does not include the domain DNS suffix, or that the name is known on external nets differently than on the internal network. This host name is typically used for the OAuth 2.0 authentication callback URL's.

    • bindAddress

      public String bindAddress
      The bind address.
    • wsPort

      public int wsPort
      The first port of the HTTP port range (the key wsPort, which held the single port until CC-FIX-PORT-RANGE-A: a workspace that stored a port keeps it as the start of its range).
    • wsPortEnd

      public int wsPortEnd
      The last port of the HTTP port range.
    • wsSecurePort

      public int wsSecurePort
      The first port of the HTTPS port range (the key wsSecurePort).
    • wsSecurePortEnd

      public int wsSecurePortEnd
      The last port of the HTTPS port range.
    • wsPortOffsetLast

      public int wsPortOffsetLast
      The offset in the port ranges this workspace bound last, -1 for none: tried first at the next start (R-D-4, sticky per workspace).
    • allowRemoteDesigner

      public boolean allowRemoteDesigner
      Whether the Designer's editor endpoints - the external-browser Designer page, ?panel=, the Panel Editor's WebSocket - answer a client on another computer (EB-3, ruled 2026-10-13: default off).
    • useGzip

      public boolean useGzip
      Flag to use Gzip compression.
    • cacheCount

      public int cacheCount
      String caching.
    • cacheMin

      public int cacheMin
      String caching.
    • cacheMax

      public int cacheMax
      String caching.
    • doVerboseTrace

      public boolean doVerboseTrace
      Tracing.
    • keyStore

      public String keyStore
      The PKCS#12 KeyStore file name.
    • password

      public String password
      The password to use for the KeyStore.
    • tosURI

      public String tosURI
      The ToS URI.
    • tosAccepted

      public boolean tosAccepted
      ToS accepted.
    • domainName

      public String domainName
      The domain name.
  • Constructor Details

    • Preference

      public Preference()
      Construction of the class.
  • Method Details

    • getInstance

      public static Preference getInstance()
      Gets the instance.
      Returns:
      The single instance of the preferences.
    • isPortOverridden

      public static boolean isPortOverridden()
      Tells whether the HTTP port is overridden for this JVM (PROP_PORT): the port range is then not used.
      Returns:
      true when -Dcom.iizigo.webserver.port is set.
    • isBindOverridden

      public static boolean isBindOverridden()
      Tells whether the bind address is overridden for this JVM (PROP_BIND).
      Returns:
      true when -Dcom.iizigo.webserver.bind is set.
    • getEffectiveBindAddress

      public String getEffectiveBindAddress()
      Gets the bind address in effect: the override, else the preference.
      Returns:
      The bind address, null or empty for all interfaces.
    • getOffsetCount

      public int getOffsetCount()
      Gets the number of offsets of the port ranges: HTTP and HTTPS move together, so the shorter range bounds them (R-D-2).
      Returns:
      The count, at least 1.
    • createPortConfigs

      public PortConfig[] createPortConfigs()
      Creates the port configurations from the preferences, at the start of the ranges (or the override).
      Returns:
      The port configurations.
    • createPortConfigs

      public PortConfig[] createPortConfigs(int offset)
      Creates the port configurations of one offset of the port ranges: HTTP wsPort+offset and HTTPS wsSecurePort+offset. With PROP_PORT set, the overrides are used instead and the offset is ignored: HTTP on that port, HTTPS on PROP_SECURE_PORT (none for -1; the start of the HTTPS range when not set).
      Parameters:
      offset - The offset, 0 for the start of the ranges.
      Returns:
      The port configurations.
    • getWorkspaceId

      public String getWorkspaceId()
      Gets the ID of this workspace, created and saved on first use: the key of its port claim and of its entry in the registry of live iiziGo (CC-FIX-PORT-RANGE-A).
      Returns:
      The ID.
    • rememberOffset

      public void rememberOffset(int offset)
      Remembers the offset this workspace bound, tried first at its next start (R-D-4); -1 forgets it.
      Parameters:
      offset - The offset, -1 for none.
    • initializeDefaultPreferences

      public void initializeDefaultPreferences()
      Initializes the preferences store for all the terminal preferences.
      Specified by:
      initializeDefaultPreferences in class AbstractPreferenceInitializer
      See Also:
    • saveToStore

      public void saveToStore()
      Saves a "page" to the store.