Interface IClientContext

All Known Subinterfaces:
IGraphicalClientContext
All Known Implementing Classes:
AbstractClientContext, HeadlessClientContext

public interface IClientContext
This important interface represents a client context for scripting. Client contexts are provided to JEB scripts at execution time.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Convenience method used to close the main project (if any), that is, the first project of the first engines context managed by the JEB back-end.
    Get the input arguments provided to this client context.
    Get the JEB base directory.
    Get the primary JEB engines context.
    Convenience method used to retrieve the main project (if any), that is, the first project of the first engines context managed by the JEB back-end.
    long
    Get the theoretical maximum amount of memory that JEB can allocate and use.
    long
    Retrieve the process id of the Java VM executing JEB.
    Get the JEB program directory.
    Get the JEB back-end software version.
    Retrieve a reference to the transient store provided by this context.
    long
    Get the amount of memory currently used by JEB.
    open(String path)
    Convenience method used to create a JEB project (or retrieve the current project if one is opened), load a file artifact into the project, process it, and return the resulting top-level unit.
  • Method Details

    • getArguments

      String[] getArguments()
      Get the input arguments provided to this client context. The returned array depends on how the context was instantiated and called.
      Returns:
      an array (possibly empty) or null if arguments are irrelevant in the current context
    • getBaseDirectory

      String getBaseDirectory()
      Get the JEB base directory.
      Returns:
      the base directory
    • getProgramDirectory

      String getProgramDirectory()
      Get the JEB program directory. Typically, this is the bin/ sub-directory located within JEB installation folder.
      Returns:
      the program directory
    • getSoftwareVersion

      Version getSoftwareVersion()
      Get the JEB back-end software version.
      Returns:
      the software version
    • getUsedMemory

      long getUsedMemory()
      Get the amount of memory currently used by JEB.
      Returns:
      used memory in bytes
    • getMaxMemory

      long getMaxMemory()
      Get the theoretical maximum amount of memory that JEB can allocate and use.
      Returns:
      total theoretical memory that JEB could use, in bytes
    • getProcessId

      long getProcessId()
      Retrieve the process id of the Java VM executing JEB.
      Returns:
      JEB's PID
    • getEnginesContext

      IEnginesContext getEnginesContext()
      Get the primary JEB engines context.
      Returns:
      the primary engines context, possibly null if none was initialized
    • getMainProject

      IRuntimeProject getMainProject()
      Convenience method used to retrieve the main project (if any), that is, the first project of the first engines context managed by the JEB back-end. If no project is opened, this method will return null.
      Returns:
      the main project or null
    • closeMainProject

      boolean closeMainProject()
      Convenience method used to close the main project (if any), that is, the first project of the first engines context managed by the JEB back-end. If no project is opened, this method will return false.
      Returns:
      success indicator
    • open

      IUnit open(String path) throws IOException
      Convenience method used to create a JEB project (or retrieve the current project if one is opened), load a file artifact into the project, process it, and return the resulting top-level unit.

      If the input file is a JDB2 saved project, that project is opened and returned. The method will throw IllegalStateException if a project is already opened.

      Parameters:
      path - input file to be analyzed, or an existing project saved as a JDB2 database (*.jdb2)
      Returns:
      the top-level unit yielded from the analysis of the provided artifact; if the input path was a JDB2 project, the top-level unit of the first project's artifact is returned
      Throws:
      IOException - on IO error
    • getTransientStore

      Map<Object,Object> getTransientStore()
      Retrieve a reference to the transient store provided by this context. Clients may use this map to store context-level global objects. The store and its objects are not persisted with a project JDB2 database.

      Interface specifications for implementations:
      - Null keys are forbidden, null values are allowed
      - Insertion, retrieval and deletion are thread-safe
      - Iterating is not thread-safe
      - The insertion order is not guaranteed during iteration

      Returns:
      a non-null read-write map