Package ghidra.features.bsim.query
Class BSimClientFactory
java.lang.Object
ghidra.features.bsim.query.BSimClientFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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
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.
-
Constructor Details
-
BSimClientFactory
public BSimClientFactory()
-
-
Method Details
-
buildURL
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
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 parsedIllegalArgumentException
- if local ghidra URL is specified
-
buildClient
Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase). Returned instance must beclosed
when done using it to prevent depletion of database connections.- Parameters:
bsimServerInfo
- BSim server detailsasync
- true if database commits should be asynchronous- Returns:
- the database client
-
buildClient
Given the URL for a BSim server construct the appropriate BSim client object (implementing FunctionDatabase). Returned instance must beclosed
when done using it to prevent depletion of database connections.- Parameters:
bsimURL
- URL supplied by the userasync
- true if database commits should be synchronous- Returns:
- the database client
- Throws:
MalformedURLException
- if there's a problem creating the elastic database
-