Package ghidra.features.bsim.query

# Class BSimClientFactory

java.lang.Object
ghidra.features.bsim.query.BSimClientFactory

public class BSimClientFactory extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BSimClientFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static FunctionDatabase`
  `buildClient(BSimServerInfo bsimServerInfo, boolean async)`
  Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase).
  `static FunctionDatabase`
  `buildClient(URL bsimURL, boolean async)`
  Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase).
  `static URL`
  `buildURL(String urlString)`
  Build a root URL for connecting to a BSim database.
  `static void`
  `checkBSimServerURL(URL url)`
  Validate BSim DB URL.
  `static URL`
  `deriveBSimURL(String urlString)`
  Construct the root URL to a specific BSim repository given a "related" URL.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BSimClientFactory

    public BSimClientFactory()

- ## Method Details

  - ### buildURL

    public static URL buildURL(String urlString) throws MalformedURLException
    Build a root URL for connecting to a BSim database. 1) A valid protocol must be provided. 2) There must be a path of exactly 1 element, which names the specific repository Acceptable protocols are postgresql:// https://, (or possibly http://) file:/
    Parameters:
      `urlString` - the URL to build
    Returns:
      the parsed URL object
    Throws:
      `MalformedURLException` - if the URL string cannot be parsed

  - ### checkBSimServerURL

    public static void checkBSimServerURL(URL url) throws MalformedURLException
    Validate BSim DB URL. Acceptable protocols are postgresql:// https://, (or possibly http://) file:/
    Parameters:
      `url` - BSim DB URL
    Throws:
      `MalformedURLException` - if the URL string is not a support BSim DB URL

  - ### deriveBSimURL

    public static URL deriveBSimURL(String urlString) throws IllegalArgumentException, MalformedURLException
    Construct the root URL to a specific BSim repository given a "related" URL. The root URL will have an explicit protocol, a hostname + other mods (the authority), and 1 level of path this first level path indicates the particular repository being referenced on the host. The "related" URL -url- can be an explicitly provided URL pointing to the BSim repository, possibly with additional path levels, which are simply stripped from the final root URL. Alternately -url- can reference a ghidra server, as indicated by the "ghidra" protocol. In this case the true BSim URL is derived from ghidra URL in some way
    Parameters:
      `urlString` - is the "related" URL
    Returns:
      the root BSim URL
    Throws:
      `MalformedURLException` - if the given URL string cannot be parsed
      `IllegalArgumentException` - if local ghidra URL is specified

  - ### buildClient

    public static FunctionDatabase buildClient(BSimServerInfo bsimServerInfo, boolean async)
    Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase). Returned instance must be `closed` when done using it to prevent depletion of database connections.
    Parameters:
      `bsimServerInfo` - BSim server details
      `async` - true if database commits should be asynchronous
    Returns:
      the database client

  - ### buildClient

    public static FunctionDatabase buildClient(URL bsimURL, boolean async) throws MalformedURLException
    Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase). Returned instance must be `closed` when done using it to prevent depletion of database connections.
    Parameters:
      `bsimURL` - URL supplied by the user
      `async` - true if database commits should be synchronous
    Returns:
      the database client
    Throws:
      `MalformedURLException` - if there's a problem creating the elastic database