Class Configuration

java.lang.Object
ortus.boxlang.runtime.config.Configuration
All Implemented Interfaces:
IConfigSegment

public class Configuration extends Object implements IConfigSegment
The BoxLang configuration object representing the core configuration. This object is responsible for processing the configuration struct and returning a new configuration object based on the overrides. Each segment is processed individually from the initial configuration struct. The configuration object can be converted to a struct for serialization. It also contains the original configuration struct for reference.
See Also:
  • Field Details

    • classGenerationDirectory

      public String classGenerationDirectory
      The directory where the generated classes will be placed The default is the system temp directory + /boxlang
    • debugMode

      public Boolean debugMode
      The debug mode flag which turns on all kinds of debugging information false by default
    • timezone

      public ZoneId timezone
      The Timezone to use for the runtime; Uses the Java Timezone format: America/New_York Uses the default system timezone if not set
    • locale

      public Locale locale
      The default locale to use for the runtime Uses the default system locale if not set
    • invokeImplicitAccessor

      public Boolean invokeImplicitAccessor
      Invoke implicit getters and setters when using the implicit accessor true by default
    • applicationTimeout

      public Duration applicationTimeout
      The application timeout 0 means no timeout and is the default
    • requestTimeout

      public Duration requestTimeout
      The request timeout 0 means no timeout and is the default
    • sessionTimeout

      public Duration sessionTimeout
      The session timeout 30 minutes by default
    • sessionManagement

      public Boolean sessionManagement
      This flag enables/disables session management in the runtime for all applications by default. false by default
    • sessionStorage

      public String sessionStorage
      The default session storage cache. This has to be the name of a registered cache or the keyword "memory" which indicates our internal cache. memory is the default
    • setClientCookies

      public Boolean setClientCookies
      This determines whether to send CFID and CFTOKEN cookies to the client browser. true by default
    • setDomainCookies

      public Boolean setDomainCookies
      Sets CFID and CFTOKEN cookies for a domain (not a host) Required, for applications running on clusters true by default
    • mappings

      public IStruct mappings
      A sorted struct of mappings
    • modulesDirectory

      public List<String> modulesDirectory
      An array of directories where modules are located and loaded from. [ /{boxlang-home}/modules ]
    • logsDirectory

      public String logsDirectory
      The default logs directory for the runtime
    • customTagsDirectory

      public List<String> customTagsDirectory
      An array of directories where custom tags are located and loaded from. [ /{boxlang-home}/customTags ]
    • javaLibraryPaths

      public List<String> javaLibraryPaths
      An array of directories where jar files will be loaded from at runtime.
    • caches

      public IStruct caches
      Cache registrations
    • defaultDatasource

      public String defaultDatasource
      Default datasource registration
    • datasources

      public IStruct datasources
      Global datasource registrations
    • defaultCache

      public CacheConfig defaultCache
      Default cache registration
    • modules

      public IStruct modules
      The modules configuration
    • originalConfig

      public IStruct originalConfig
      The last config struct loaded
    • executors

      public IStruct executors
      A collection of all the registered global executors
  • Constructor Details

    • Configuration

      public Configuration()
  • Method Details

    • process

      public Configuration process(IStruct config)
      Processes a configuration struct and returns a new configuration object based on the overrides. This method makes sure all elements in the incoming configuration struct are processed and applied to the configuration object.
      Specified by:
      process in interface IConfigSegment
      Parameters:
      config - the configuration struct
      Returns:
      The new configuration object based on the core + overrides
    • getRegisteredMappings

      public String[] getRegisteredMappings()
      Get all the mappings back as an array of strings in their length order
      Returns:
      The mappings as an array of strings
    • hasMapping

      public boolean hasMapping(String mapping)
      Verify if a mapping exists
      Parameters:
      mapping - The mapping to verify: /myMapping, please note the leading slash
      Returns:
      True if the mapping exists, false otherwise
    • hasMapping

      public boolean hasMapping(Key mapping)
      Verify if a mapping exists
      Parameters:
      mapping - The mapping to verify: /myMapping, please note the leading slash
      Returns:
      True if the mapping exists, false otherwise
    • registerMapping

      public Configuration registerMapping(String mapping, String path)
      Register a mapping in the runtime configuration
      Parameters:
      mapping - The mapping to register: /myMapping, please note the leading slash
      path - The absolute path to the directory to map to the mapping
      Returns:
      The runtime configuration
      Throws:
      BoxRuntimeException - If the path does not exist
    • registerMapping

      public Configuration registerMapping(Key mapping, String path)
      Register a mapping in the runtime configuration
      Parameters:
      mapping - The mapping to register: /myMapping, please note the leading slash
      path - The absolute path to the directory to map to the mapping
      Returns:
      The runtime configuration
      Throws:
      BoxRuntimeException - If the path does not exist
    • unregisterMapping

      public boolean unregisterMapping(String mapping)
      Unregister a mapping in the runtime configuration
      Parameters:
      mapping - The String mapping to unregister: /myMapping, please note the leading slash
      Returns:
      True if the mapping was removed, false otherwise
    • unregisterMapping

      public boolean unregisterMapping(Key mapping)
      Unregister a mapping in the runtime configuration using a Key
      Parameters:
      mapping - The Key mapping to unregister: /myMapping, please note the leading slash
      Returns:
      True if the mapping was removed, false otherwise
    • getJavaLibraryPaths

      public URL[] getJavaLibraryPaths()
      Get the java library paths as an array of URLs of Jar files This is usually called by the runtime to load all the JARs in the paths to the runtime classloader
      Returns:
      The java library paths as an array of Jar/class URLs
      Throws:
      BoxIOException - If a path is not a valid path
    • validateDatsourceDrivers

      public void validateDatsourceDrivers()
      Helper method to validate datasource drivers configured in the runtime configuration This makes sure all declared drivers are registered with the datasource service
      Throws:
      BoxRuntimeException - If a datasource driver is not registered with the datasource service
    • asStruct

      public IStruct asStruct()
      Returns the configuration as a struct with all the static typed segments and the originalConfig as a segment as well.
      Specified by:
      asStruct in interface IConfigSegment
      Returns:
      A struct representation of the configuration segment