@haxall/haxall
    Preparing search index...

    Class PathEnv

    PathEnv is a simple implementation of a Fantom environment which uses a search path to resolve files.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    type$: Type

    Methods

    • Add a function to be called on VM shutdown. Throw NotImmutableErr if the function is not immutable. Default implementation delegates to parent.

      Parameters

      • hook: () => void

      Returns void

    • Microprocessor architecture name as one of the following constants:

      • "x86"
      • "x86_64"
      • "ppc"
      • "sparc"
      • "ia64"
      • "ia64_32"
      • "aarch64"

      Returns string

    • Get the command line arguments used to run the fan process as an immutable List of strings. Default implementation delegates to parent.

      Returns List<string>

    • Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:

      this < that   =>  <0
      this == that => 0
      this > that => >0

      This method may also be accessed via the < <= <=> >= and > shortcut operators. If not overridden the default implementation compares the toStr representations. Also see docLang.

      Examples:

      3.compare(8)  =>  -1
      8.compare(3) => 1
      8.compare(8) => 0
      3 <=> 8 => -1 // shortcut for 3.compare(8)

      Parameters

      Returns number

    • Compile a script file into a pod and return the first public type declared in the script file. If the file has been previously compiled and hasn't changed, then a cached type is returned. If the script contains errors then the first CompilerErr found is thrown. The options available:

      • logLevel: the default LogLevel to use for logging the compilation process and errors
      • log: the compiler.CompilerLog | compiler::CompilerLog to use for logging the compilation process and errors
      • logOut: an output stream to capture logging
      • force: pass true to not use caching, always forces a recompile

      Parameters

      Returns Type

    • Compile a script file into a pod and return the JS source code of resulting pod. If the script contains errors then the first CompilerErr found is thrown. The options available:

      • podName: the name of pod created for script
      • logLevel: the default LogLevel to use for logging the compilation process and errors
      • log: the compiler.CompilerLog | compiler::CompilerLog to use for logging the compilation process and errors
      • logOut: an output stream to capture logging

      Parameters

      Returns string

    • Lookup a configuration property for given pod/key pair. If not found then return def. Default implementation routes to props using max age of one minute:

      props(pod, `config.props`, 1min).get(key, def)
      

      Also see Pod.config and docLang::Env.

      Parameters

      • pod: Pod
      • key: string
      • Optionaldef: string

      Returns string

    • Poll for a platform dependent map of diagnostics name/value pairs for the current state of the VM. Java platforms return key values from the java.lang.management interface. Default implementation delegates to parent.

      Returns Map<string, JsObj>

    • Compare this object to the specified for equality. This method may be accessed via the == and != shortcut operators. If not overridden the default implementation compares for reference equality using the === operator. If this method is overridden, then hash() must also be overridden such that any two objects which return true for equals() must return the same value for hash(). This method must accept null and return false.

      Parameters

      Returns boolean

    • Standard error output stream. Default implementation delegates to parent.

      Returns OutStream

    • Terminate the current virtual machine. Default implementation delegates to parent.

      Parameters

      • Optionalstatus: number

      Returns void

    • Search path for all versions of given file.

      Parameters

      Returns List<File>

    • Search path for all "lib/fan/*.pod" files.

      Returns List<string>

    • Search path for given file.

      Parameters

      • uri: Uri
      • Optionalchecked: boolean

      Returns File

    • Resolve the pod file for the given pod name. If the name cannot be resolved to a pod, return null. The default implementation routes to findFile to look in "lib/fan" directory.

      Parameters

      • podName: string

      Returns File

    • Run the garbage collector. No guarantee is made to what the VM will actually do. Default implementation delegates to parent.

      Returns void

    • Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.

      Returns number

    • Get the home directory of Fantom installation. Default implementation delegates to parent.

      Returns File

    • Get the local host name of the machine running the virtual machine process. Default implementation delegates to parent.

      Returns string

    • Return the default hash code of Obj.hash for the specified object regardless of whether the object has overridden the hash method. If null then return 0.

      Parameters

      Returns number

    • Standard input stream. Default implementation delegates to parent.

      Returns InStream

    • Lookup all the matching values for a pod indexed key. If no matches are found return the empty list. Indexed props are declared in your pod's build script, and coalesced into a master index by the current environment. See docLang for details.

      Parameters

      • key: string

      Returns List<string>

    • Get listing of all keys mapped by indexed props. The values of each key may be resolved by the index method. See docLang for details. NOTE: Java runtime only

      Returns List<string>

    • Return list of all pod names that define the given key. NOTE: Java runtime only

      Parameters

      • key: string

      Returns List<string>

    • Return if this Obj is immutable and safe to share between threads:

      • an instance of a const class
      • the result of toImmutable on List, Map, or Buf
      • a Func object may or may not be immutable - see sys::Func.
      • other instances are assumed mutable and return false

      Returns boolean

    • Get the Java VM Version as a single integer (8, 9, etc.). If the runtime is not java, return 0.

      Returns number

    • Lookup a localized property for the specified pod/key pair. The following rules are used for resolution:

      1. props(pod, locale/{locale}.props)
      2. props(pod, locale/{lang}.props)
      3. props(pod, locale/en.props)
      4. Fallback to pod::key unless def specified

      Where {locale} is Locale.toStr and {lang} is Locale.lang. The maxAge parameter is set to Duration.maxVal (cached for life of the VM).

      Also see Pod.locale and docLang::Localization.

      Parameters

      • pod: Pod
      • key: string
      • Optionaldef: string
      • Optionallocale: Locale

      Returns string

    • Get the main method which was used to run this Fantom VM. Return null if VM was booted outside of a Fantom main method. Default implementation delegates to parent.

      Returns Method

    • Operating system name as one of the following constants:

      • "win32"
      • "macosx"
      • "linux"
      • "aix"
      • "solaris"
      • "hpux"
      • "qnx"

      Returns string

    • Standard output stream. Default implementation delegates to parent.

      Returns OutStream

    • Get the parent environment or null if this is the bootstrap environment. Many virtual methods delegate to their parent by default.

      Returns Env

    • Search path of directories in priority order. The last item in the path is always the sys::Env.homeDir

      Returns List<File>

    • Name of the host platform as a string formatted as "-". See os and arch.

      Returns string

    • Prompt the user to enter a command line from standard input. This method routes to util::Console.prompt.

      Parameters

      • Optionalmsg: string

      Returns string

    • Prompt the user to enter a password from standard input with echo disabled. This method routes to util::Console.promptPassword.

      Parameters

      • Optionalmsg: string

      Returns string

    • Return a merged key/value map of all the prop files found using the following resolution rules:

      1. Env.findAllFiles: "etc/{pod}/{uri}"
      2. Pods indexed with sys.envProps: "/{pod}/uri"
      3. Pod.files: "/{uri}"

      The uri must be relative. Note that props such as locale files can be bundled into a pod for deployment and searched by adding an indexed prop with the key "sys.envProps" and the pod name as the value. This feature does not support "config.props".

      The files are parsed using InStream.readProps and merged according to their priority order. If the file is defined as a resource in the pod itself, then it is treated as lowest priority. The first file returned by findAllFiles is treated as highest priority and overwrites any key-value pairs defined at a lower priority.

      The map is cached so that subsequent calls for the same path don't require accessing the file system again. The maxAge parameter specifies the tolerance accepted before a cache refresh is performed to check if any of the files have been modified.

      Also see Pod.props and docLang::Env.

      Parameters

      Returns Map<string, string>

    • Remove a shutdown hook function which was added by addShutdownHook. Remove true if hook had been previously added and was unregistered, false otherwise. Default implementation delegates to parent.

      Parameters

      • hook: () => void

      Returns boolean

    • Virtual machine runtime as one of the following constants:

      • "java"
      • "dotnet"
      • "js"

      Returns string

    • Temp directory is always under workDir.

      Returns File

    • Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:

      • if type is const, return this
      • if already an immutable List, Map, Buf, or Func return this
      • if a List, then attempt to perform a deep clone by calling toImmutable on all items
      • if a Map, then attempt to perform a deep clone by calling toImmutable on all values (keys are already immutable)
      • some Funcs can be made immutable - see sys::Func
      • if a Buf create immutable copy, see sys::Buf
      • any other object throws NotImmutableErr

      Returns Readonly<this>

    • Return a string representation of this object.

      Returns string

    • Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:

      a->x        a.trap("x", null)
      a->x() a.trap("x", null)
      a->x = b a.trap("x", [b])
      a->x(b) a.trap("x", [b])
      a->x(b, c) a.trap("x", [b, c])

      The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.

      Parameters

      Returns JsObj

    • Get the Type instance which represents this object's class. Also seeType.of or Pod.of.

      Returns Type

    • Get the user name of the user account used to run the virtual machine process. Default implementation delegates to parent.

      Returns string

    • Get the environment variables as a case insensitive, immutable map of Str name/value pairs. The environment map is initialized from the following sources from lowest priority to highest priority:

      1. shell environment variables
      2. Java system properties (Java VM only obviously)
      3. props in "fan.props" prefixed with "env."

      Returns Map<string, string>

    • This method called whenever an it-block is applied to an object. The default implementation calls the function with this, and then returns this.

      Parameters

      • f: (arg0: this) => void

      Returns this

    • Working directory is always first item in path.

      Returns File

    • Get the current runtime environment

      Returns Env

    • Write x.toStr to standard output followed by newline. If x is null then print "null". If no argument is provided then print an empty line.

      Parameters

      Returns void

    • Constructor initializes the search path using the FAN_ENV_PATH environment variable (see sys::Env.vars).

      Parameters

      • ...args: unknown[]

      Returns PathEnv