Class LocalProperties

java.lang.Object
gda.configuration.properties.LocalProperties

public final class LocalProperties extends Object
A utility singleton class which allows the getting of Java properties from a local source file or standard System properties.
  • Field Details

    • GDA_GIT_LOC

      public static final String GDA_GIT_LOC
      Replaces the gda.root variable.

      The system property which defines the top-level folder holding the various git repositories which make up this gda installation.

      It should not be assumed that the configuration files are relative to this location. This is defined by GDA_CONFIG

      See Also:
    • GDA_DATA

      public static final String GDA_DATA
      Property that sets the top-level directory where data is written to. The actual directory the data writers should use is defined by gda.data.scan.datawriter.datadir. That property may be dynamic and vary as the current visit varies, but the gda.data property should be static at runtime.
      See Also:
    • GDA_DATA_SCAN_DATAWRITER_DATAFORMAT

      public static final String GDA_DATA_SCAN_DATAWRITER_DATAFORMAT
      Name of class in package gda.data.scan.datawriter that is called when ScanDataPoints are available to be written Must support interface DataWriter
      See Also:
    • GDA_VISIT_DIR

      public static final String GDA_VISIT_DIR
      Property used to provide the path of the root of the visit
      See Also:
    • GDA_DATAWRITER_DIR

      public static final String GDA_DATAWRITER_DIR
      Property used to provide the 'default' property to gda.data.PathConstructor (in uk.ac.gda.core). This in turn is used by *many* classes to determine where scan files or images should be written.
      See Also:
    • GDA_DATA_NUMTRACKER

      public static final String GDA_DATA_NUMTRACKER
      The directory in which to keep NumTracker files. (See NumTracker for alternative ways to specify this).
      See Also:
    • GDA_CONFIG

      public static final String GDA_CONFIG
      Property that specifies the GDA configuration folder.
      See Also:
    • GDA_VAR_DIR

      public static final String GDA_VAR_DIR
      The location of a global read-write directory for persistence of information which is continued to be used on the same beamline from version to version of GDA.

      Has been config/var but the recommended location is outside of the configuration directory, at the same level that different GDA installations are located.

      Directory in which gda.data.NumTracker files are stored.

      See Also:
    • GDA_LOGS_DIR

      public static final String GDA_LOGS_DIR
      Property that specifies the folder into which all logs files should be placed.
      See Also:
    • GDA_PROPERTIES_FILE

      public static final String GDA_PROPERTIES_FILE
      Property that specifies a single GDA properties file.
      See Also:
    • GDA_FACTORY_NAME

      public static final String GDA_FACTORY_NAME
      Property that specifies the GDA factory name, e.g. "stnBase" or "i04-1".
      See Also:
    • GDA_DUMMY_MODE_ENABLED

      public static final String GDA_DUMMY_MODE_ENABLED
      Boolean property that indicates whether GDA is using the dummy mode configuration.
      See Also:
    • GDA_MODE

      public static final String GDA_MODE
      Property that specifies the GDA running mode, e.g. "dummy", "live" or any other defined running mode
      See Also:
    • GDA_ACCESS_CONTROL_ENABLED

      public static final String GDA_ACCESS_CONTROL_ENABLED
      Boolean property that indicates whether GDA access control is enabled.
      See Also:
    • GDA_BATON_MANAGEMENT_ENABLED

      public static final String GDA_BATON_MANAGEMENT_ENABLED
      Boolean property that indicates whether GDA baton management is enabled.
      See Also:
    • GDA_SCANNABLEBASE_POLLTIME

      public static final String GDA_SCANNABLEBASE_POLLTIME
      Property that specifies the time in millis between isBusy polls in ScannableBase#waitWhileBusy().
      See Also:
    • GDA_GUI_XML

      public static final String GDA_GUI_XML
      Property that specifies the client-side XML file.
      See Also:
    • GDA_GUI_BEANS_XML

      public static final String GDA_GUI_BEANS_XML
      XML file used by the RCP client.
      See Also:
    • GDA_IMAGES_DISPLAY_CONFIG_FILE

      public static final String GDA_IMAGES_DISPLAY_CONFIG_FILE
      File containing beam centre and beam size values for each zoom level; read by gda.images.camera.BeamDataComponent in uk.ac.gda.px.
      See Also:
    • GDA_IMAGES_SINGLE_BEAM_CENTRE

      public static final String GDA_IMAGES_SINGLE_BEAM_CENTRE
      When reading GDA_IMAGES_DISPLAY_CONFIG_FILE, if this is set to true, the first crosshairX and crosshairY values will be used for all zoom levels.
      See Also:
    • GDA_BEAMLINE_NAME

      public static final String GDA_BEAMLINE_NAME
      Beamline name, e.g. "i02".
      See Also:
    • GDA_IMAGES_HORIZONTAL_DIRECTION

      public static final String GDA_IMAGES_HORIZONTAL_DIRECTION
      The on-screen sample image shows the X axis from left to right, but the image can be flipped. This property indicates which edge of the image is the +ve side - "left" or "right".
      See Also:
    • GDA_PX_SAMPLE_CONTROL_AXIS_ORIENTATION

      public static final String GDA_PX_SAMPLE_CONTROL_AXIS_ORIENTATION
      Property that allows the beamline-specific orientation of the X/Y/Z axes to be specified. It should be a matrix, in the form
      See Also:
    • GDA_PX_SAMPLE_CONTROL_OMEGA_DIRECTION

      public static final String GDA_PX_SAMPLE_CONTROL_OMEGA_DIRECTION
      Property that specifies the direction of a +ve omega rotation when viewed from behind the goniometer, with the beam going from left to right. Should be "clockwise" or "anticlockwise".
      See Also:
    • GDA_PX_SAMPLE_CONTROL_ALLOW_BEAM_AXIS_MOVEMENT

      public static final String GDA_PX_SAMPLE_CONTROL_ALLOW_BEAM_AXIS_MOVEMENT
      Whether beam axis movements should be considered when moving the sample. Should be true or false.
      See Also:
    • GDA_DEF_VISIT

      public static final String GDA_DEF_VISIT
      Default visit number if an ICAT system is not specified; or connection to ICAT fails; or user is a member of staff and has not other available visit ID in the ICAT system.
      See Also:
    • GDA_INSTRUMENT

      public static final String GDA_INSTRUMENT
      The name of the instrument. This property should always be defined.

      If gda.beamline.name is defined, as it should be on all Diamond beamlines, then this property should be considered a synonym for that one and therefore must always be set to the same value. The more general name is intended for when GDA is used outside outside of a beamline.

      See Also:
    • GDA_END_STATION_NAME

      public static final String GDA_END_STATION_NAME
      An optional property giving the end station name, if different to the beamline name, e.g. PEEM or VXMi.
      See Also:
    • GDA_FACILITY

      public static final String GDA_FACILITY
      See Also:
    • DEFAULT_VISIT

      public static final String DEFAULT_VISIT
      This is the default visit that will be used if no default visit is specified by the GDA_DEF_VISIT property.
      See Also:
    • RCP_APP_VISIT

      public static final String RCP_APP_VISIT
      The visit which the current RCP application is running under. This should NOT be set in a java.properties file but set at runtime once the RCP process has identified which value it wishes to use.

      For times when the metadata value is misleading to client-side objects.

      See Also:
    • RCP_APP_USER

      public static final String RCP_APP_USER
      The user name (federalid) which the current RCP application is running under. This should NOT be set in a java.properties file but set at runtime once the RCP process has identified which value it wishes to use.

      For times when the metadata value is misleading to client-side objects.

      See Also:
    • GDA_DATA_NUMTRACKER_EXTENSION

      public static final String GDA_DATA_NUMTRACKER_EXTENSION
      Extension to be used for NumTracker - to keep Nexus and SrsDataFile in step
      See Also:
    • GDA_SCAN_MULTITHREADED_SCANDATA_POINT_PIPElINE_LENGTH

      public static final String GDA_SCAN_MULTITHREADED_SCANDATA_POINT_PIPElINE_LENGTH
      The number of ScanDataPoints that can be in a gda.scan.MultithreadedScanDataPointPipeline before it starts blocking new requests. i.e. the number of points 'behind' the collection completed points can get.
      See Also:
    • GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY

      public static final String GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY
      The number of ScanDataPoints that can be in a gda.scan.MultithreadedScanDataPointPipeline before it starts blocking new requests. i.e. the number of points 'behind' the collection completed points can get.
      See Also:
    • GDA_SCAN_MULTITHREADED_SCANDATA_POINT_PIPElINE_POINTS_TO_COMPUTE_SIMULTANEOUSELY

      public static final String GDA_SCAN_MULTITHREADED_SCANDATA_POINT_PIPElINE_POINTS_TO_COMPUTE_SIMULTANEOUSELY
      The number of threads used by a scan to convert position Callables from PositionCallableProviding Scannables to Object positions.
      See Also:
    • GDA_GUI_FORCE_INTRO

      public static final String GDA_GUI_FORCE_INTRO
      Option to force application window to open with Intro / Welcome screen (default usually false)
      See Also:
    • GDA_GUI_SAVE_RESTORE

      public static final String GDA_GUI_SAVE_RESTORE
      Option to save and restore the GUI state between sessions. Default 'true'. If 'true' the setting to force the Intro/Welcome Screen may have no effect
      See Also:
    • GDA_GUI_START_WIDTH

      public static final String GDA_GUI_START_WIDTH
      Starting width for the GDA application window
      See Also:
    • GDA_GUI_START_HEIGHT

      public static final String GDA_GUI_START_HEIGHT
      Starting height for the GDA application window
      See Also:
    • GDA_GUI_START_MAXIMISE

      public static final String GDA_GUI_START_MAXIMISE
      Maximise the application window at startup
      See Also:
    • GDA_GUI_TITLEBAR_PREFIX

      public static final String GDA_GUI_TITLEBAR_PREFIX
      Prefix for the title of the GDA window
      See Also:
    • GDA_GUI_TITLEBAR_SUFFIX

      public static final String GDA_GUI_TITLEBAR_SUFFIX
      See Also:
    • GDA_GUI_USE_ACTIONS_NEW

      public static final String GDA_GUI_USE_ACTIONS_NEW
      Option to display RCP Workbench default menus (default usually true)
      See Also:
    • GDA_GUI_USE_ACTIONS_RUN

      public static final String GDA_GUI_USE_ACTIONS_RUN
      See Also:
    • GDA_GUI_USE_ACTIONS_PERSPECTIVE_CUSTOM

      public static final String GDA_GUI_USE_ACTIONS_PERSPECTIVE_CUSTOM
      See Also:
    • GDA_GUI_USE_ACTIONS_NEW_EDITOR

      public static final String GDA_GUI_USE_ACTIONS_NEW_EDITOR
      See Also:
    • GDA_GUI_USE_ACTIONS_NEW_WINDOW

      public static final String GDA_GUI_USE_ACTIONS_NEW_WINDOW
      See Also:
    • GDA_GUI_USE_ACTIONS_EXPORT

      public static final String GDA_GUI_USE_ACTIONS_EXPORT
      See Also:
    • GDA_GUI_USE_ACTIONS_IMPORT

      public static final String GDA_GUI_USE_ACTIONS_IMPORT
      See Also:
    • GDA_GUI_USE_PERSPECTIVE_BAR

      public static final String GDA_GUI_USE_PERSPECTIVE_BAR
      Option to display the RCP Perspective bar
      See Also:
    • GDA_GUI_USE_TOOL_BAR

      public static final String GDA_GUI_USE_TOOL_BAR
      Option to display the RCP main tool bar
      See Also:
    • GDA_GUI_STOP_ALL_COMMAND_ID

      public static final String GDA_GUI_STOP_ALL_COMMAND_ID
      Command to execute when "Stop all" button in status line is clicked
      See Also:
    • GDA_GUI_FORCE_LEFT_STOP_ALL

      public static final String GDA_GUI_FORCE_LEFT_STOP_ALL
      Client properties to be checked for locating the STOP ALL button on the status line
      See Also:
    • GDA_GUI_STATUS_HIDE_STOP_ALL

      public static final String GDA_GUI_STATUS_HIDE_STOP_ALL
      See Also:
    • GDA_SCAN_SETS_SCANNUMBER

      public static final String GDA_SCAN_SETS_SCANNUMBER
      See Also:
    • GDA_MESSAGE_BROKER_IMPL

      public static final String GDA_MESSAGE_BROKER_IMPL
      See Also:
    • GDA_MESSAGE_BROKER_URI

      public static final String GDA_MESSAGE_BROKER_URI
      See Also:
    • GDA_ACTIVEMQ_BROKER_URI

      public static final String GDA_ACTIVEMQ_BROKER_URI
      See Also:
    • GDA_SHOW_VISIT_NAME_AS_DATA_FOLDER_NAME

      public static final String GDA_SHOW_VISIT_NAME_AS_DATA_FOLDER_NAME
      Option to display visit name as data folder name in Data Project
      See Also:
    • GDA_SERVER_HOST

      public static final String GDA_SERVER_HOST
      Location of the server status port
      See Also:
    • GDA_SERVER_STATUS_PORT

      public static final String GDA_SERVER_STATUS_PORT
      Port number on which client can obtain status information from the GDA server
      See Also:
    • GDA_SERVER_SCAN_PRINT_SUPPRESS_HEADER

      public static final String GDA_SERVER_SCAN_PRINT_SUPPRESS_HEADER
      See Also:
    • GDA_SERVER_STATUS_PORT_DEFAULT

      public static final int GDA_SERVER_STATUS_PORT_DEFAULT
      Default value for GDA_SERVER_STATUS_PORT
      See Also:
    • GDA_DATASERVER_HOST

      public static final String GDA_DATASERVER_HOST
      Property for setting where there is a dataserver running that can access the SWMR files and provide remote datasets
      See Also:
    • GDA_DATASERVER_PORT

      public static final String GDA_DATASERVER_PORT
      Property for setting which port has a dataserver running that can access the SWMR files and provide remote datasets
      See Also:
    • GDA_INITIAL_LENGTH_UNITS

      public static final String GDA_INITIAL_LENGTH_UNITS
      Property to set the initial length units for fields (xStart, fastAxisStep etc) in the Mapping GUI
      See Also:
    • GDA_CHECK_USER_VISIT_VALID

      public static final String GDA_CHECK_USER_VISIT_VALID
      Control whether client should be closed automatically when user session expires
      See Also:
    • GDA_PERSISTENCE_SERVICE_ENABLED

      public static final String GDA_PERSISTENCE_SERVICE_ENABLED
      Property to choose whether to use the persistence service or file base persistence
      See Also:
  • Method Details

    • getActiveMQBrokerURI

      @Deprecated(since="GDA 9.33", forRemoval=true) public static String getActiveMQBrokerURI()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • setActiveMQBrokerURI

      @Deprecated(since="GDA 9.33", forRemoval=true) public static void setActiveMQBrokerURI(String brokerURI)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getBrokerURI

      public static String getBrokerURI()
    • setBrokerURI

      public static void setBrokerURI(String brokerURI)
    • clearBrokerURI

      public static void clearBrokerURI()
    • unsetActiveMQBrokerURI

      public static void unsetActiveMQBrokerURI()
      Use to undo forceActiveMQEmbeddedBroker() between unit tests i.e. call from @org.junit.AfterClass annotated tearDownClass method.
    • forceActiveMQEmbeddedBroker

      public static void forceActiveMQEmbeddedBroker()
      For unit tests i.e. call from @org.junit.BeforeClass annotated setUpClass method. Undo with unsetActiveMQBrokerURI() (or setActiveMQBrokerURI(String)).
    • isScanSetsScanNumber

      public static boolean isScanSetsScanNumber()
    • setScanSetsScanNumber

      public static void setScanSetsScanNumber(boolean enable)
    • setProperties

      public static void setProperties(PropertiesConfig properties)
    • dumpProperties

      public static void dumpProperties()
    • get

      public static String get(String propertyName)
      Get a string property value using a specified key string with windows path separator "\\" being replaced by "/".
      Parameters:
      propertyName - the key specified to fetch the string value
      Returns:
      the property value to return to the caller
    • check

      public static boolean check(String propertyName)
      Get a boolean property value using a specified key string. No default is specified and "false" is returned if no key is found.
      Parameters:
      propertyName - the key specified to fetch the boolean value
      Returns:
      the property value to return to the caller. Returns false if key is not found.
    • check

      public static boolean check(String propertyName, boolean defaultCheck)
      Get a boolean property value using a specified key string.
      Parameters:
      propertyName - the key specified to fetch the boolean value
      defaultCheck - the default value to return if the key is not found
      Returns:
      the property value to return to the caller
    • getInt

      public static int getInt(String propertyName, int defaultValue)
      Get an integer property value using a specified key string.
      Parameters:
      propertyName - the key specified to fetch the integer value
      defaultValue - the default value to return if the key is not found
      Returns:
      the property value to return to the caller
    • getDouble

      public static double getDouble(String propertyName, double defaultValue)
      Get a double property value using a specified key string.
      Parameters:
      propertyName - the key specified to fetch the double value
      defaultValue - the default value to return if the key is not found
      Returns:
      the property value to return to the caller
    • get

      public static String get(String propertyName, String defaultValue)
      Get a string property value using a specified key string.
      Parameters:
      propertyName - the key specified to fetch the string value
      defaultValue - the default value to return if the key is not found
      Returns:
      the property value to return to the caller
    • getPath

      public static String getPath(String name, String defaultValue)
      Get a file path property value using a specified key string.
      Parameters:
      name - the key specified to fetch the file path value
      defaultValue - the default value to return if the key is not found
      Returns:
      the property value to return to the caller
    • set

      public static void set(String propertyName, String value)
      Assign a string property value to a specified key string.
      Parameters:
      propertyName - the key specified to assign to the value
      value - the string value to assign to the specified key
    • set

      public static void set(String propertyName, boolean value)
      Assign a string property value to a specified key string.
      Parameters:
      propertyName - the key specified to assign to the value
      value - the string value to assign to the specified key
    • isDummyModeEnabled

      public static boolean isDummyModeEnabled()
      Determines whether GDA is using the dummy mode configuration.
      Returns:
      true if GDA is using the dummy mode configuration; false otherwise. False is default to make dummy mode the exception.
    • isAccessControlEnabled

      public static boolean isAccessControlEnabled()
      Determines whether access control is enabled.
      Returns:
      true if access control is enabled; false otherwise. False is default to keep original behaviour.
    • isBatonManagementEnabled

      public static boolean isBatonManagementEnabled()
      Determines whether baton management is enabled.
      Returns:
      true if baton management is enabled; false otherwise. False is default to keep original behaviour.
    • canShareBaton

      public static boolean canShareBaton()
      Returns:
      true if with the same user and visit ID can share the baton. False by default.
    • useReducedGUI

      public static boolean useReducedGUI()
      Returns:
      true if the client should use the reduced gui when the baton control is enabled and another client on a different visit holds the baton. True by default.
    • getParentGitDir

      public static String getParentGitDir()
      Returns:
      String
    • getConfigDir

      public static String getConfigDir()
      Returns:
      String
    • getVarDir

      public static String getVarDir()
      If the property gda.var is not defined, then it is assumed that there is a var dir inside the config directory (where var was previously recommended to be placed)
      See Also:
    • getBaseDataDir

      public static String getBaseDataDir()
      Returns:
      String
      See Also:
    • isPersistenceServiceAvailable

      public static boolean isPersistenceServiceAvailable()
      Returns:
      if the persistence service is available
    • stringToIntList

      public static List<Integer> stringToIntList(String s)
      Parameters:
      s -
      Returns:
      list of integers from a csv string e.g. 1,2 yields [1,2] returns null if property
    • getAsIntList

      public static List<Integer> getAsIntList(String propertyName)
      Parameters:
      propertyName -
      Returns:
      Value of a property as a list of integers e.g. a value of 1 2 3 returns [1,2,3]. DO NOT USE commas
    • getAsIntList

      public static List<Integer> getAsIntList(String propertyName, Integer[] defaultValue)
      Parameters:
      propertyName -
      defaultValue - The list of default values to return if the propertyName does not exist
      Returns:
      Value of a property as a list of integers e.g. a value of 1 2 3 returns [1,2,3]. DO NOT USE commas
    • getAsInt

      public static int getAsInt(String propertyName)
      Get the value of the named property as an int value.

      This method will throw NullPointerException if the property is undefined. To avoid this, call getAsInt(String, int) instead.

      Parameters:
      propertyName - the property to find
      Returns:
      the value of the named property, as an int
      Throws:
      NullPointerException - if the named property is not defined
      NumberFormatException - if the named property is defined but cannot be parsed as an int
    • getAsInt

      public static int getAsInt(String propertyName, int defaultValue)
      Get the value of the named property as an int value. If the property is not defined, the given default value is returned.
      Parameters:
      propertyName - the property to find
      defaultValue - the value to return if the propertyName is not defined
      Returns:
      the value of the named property, as an int
      Throws:
      NumberFormatException - if the named property is defined but cannot be parsed as an int
    • contains

      public static boolean contains(String propertyName)
    • clearProperty

      public static void clearProperty(String key)
      Remove a property from the configuration
      Parameters:
      key -
    • checkForObsoleteProperties

      public static void checkForObsoleteProperties()
    • getStringArray

      public static String[] getStringArray(String propertyName)
    • getKeysByRegexp

      public static List<String> getKeysByRegexp(String regex)
      Returns a list of property keys matching a regular expression
      Parameters:
      regex - the regular expression to match
      Returns:
      a List of keys
    • getFirstKeyByRegexp

      public static String getFirstKeyByRegexp(String regex, String defaultKey)
      Returns the first property key matching a regular expression
      Parameters:
      regex - the regular expression to match
      defaultKey - the default value if no key is found
      Returns:
      a the first key that matches String, otherwise the defaultKey