Package ghidra.features.bsim.query.facade

# Class SimilarFunctionQueryService

java.lang.Object
ghidra.features.bsim.query.facade.SimilarFunctionQueryService

All Implemented Interfaces:
  `AutoCloseable`

public class SimilarFunctionQueryService extends Object implements AutoCloseable
A simple class that allows the user to query a server for functions that match a given set of functions.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimilarFunctionQueryService(Program program)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `changePassword(String username, char[] newPassword)`
  Deprecated.
  `void`
  `close()`
  `protected FunctionDatabase`
  `createDatabase(String urlString)`
  `void`
  `dispose()`
  `QueryNearest`
  `generateQueryNearest(SFQueryInfo queryInfo, TaskMonitor monitor)`
  Given a list of functions to query, prepare the final QueryNearest object which will be marshalled to the server.
  `QueryNearestVector`
  `generateQueryNearestVector(SFOverviewInfo overviewInfo, TaskMonitor monitor)`
  `String`
  `getDatabaseCompatibility()`
  Returns a string explaining the database compatibility between this client and the server.
  `FunctionDatabase.ConnectionType`
  `getDatabaseConnectionType()`
  `DatabaseInformation`
  `getDatabaseInformation()`
  `FunctionDatabase.Status`
  `getDatabaseStatus()`
  `FunctionDatabase.BSimError`
  `getLastError()`
  `LSHVectorFactory`
  `getLSHVectorFactory()`
  `BSimServerInfo`
  `getServerInfo()`
  Return the `server info object` for this database
  `String`
  `getUserName()`
  `void`
  `initializeDatabase(String serverURLString)`
  `ResponseNearestVector`
  `overviewSimilarFunctions(SFOverviewInfo overviewInfo, SFResultsUpdateListener<ResponseNearestVector> listener, TaskMonitor monitor)`
  Query the given server for similar function overview information
  `QueryResponseRecord`
  `queryRaw(BSimQuery<?> query, StagingManager stagingManager, SFResultsUpdateListener<QueryResponseRecord> listener, TaskMonitor monitor)`
  A lower-level (more flexible) query of the database.
  `SFQueryResult`
  `querySimilarFunctions(SFQueryInfo queryInfo, SFResultsUpdateListener<SFQueryResult> listener, TaskMonitor monitor)`
  Query the given server with the parameters provider by `queryInfo`.
  `void`
  `setNumberOfStages(int val)`
  `void`
  `updateProgram(Program newProgram)`

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

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

- ## Constructor Details

  - ### SimilarFunctionQueryService

    public SimilarFunctionQueryService(Program program)

- ## Method Details

  - ### generateQueryNearest

    public QueryNearest generateQueryNearest(SFQueryInfo queryInfo, TaskMonitor monitor) throws QueryDatabaseException
    Given a list of functions to query, prepare the final QueryNearest object which will be marshalled to the server. This involves generating the signatures for each of the function and accumulating their FunctionDescriptions
    Parameters:
      `queryInfo` - is the high-level form of query, with the list of FunctionSymbols and other parameters
      `monitor` - the task monitor
    Returns:
      the QueryNearest object ready for the queryStaged method
    Throws:
      `QueryDatabaseException` - if transferring functions fails

  - ### generateQueryNearestVector

    public QueryNearestVector generateQueryNearestVector(SFOverviewInfo overviewInfo, TaskMonitor monitor) throws QueryDatabaseException
    Throws:
      `QueryDatabaseException`

  - ### changePassword

    @Deprecated public String changePassword(String username, char[] newPassword)
    Deprecated.
    Issue password change request to the server
    Parameters:
      `username` - to change
      `newPassword` - is password data
    Returns:
      null if change was successful, or the error message

  - ### querySimilarFunctions

    public SFQueryResult querySimilarFunctions(SFQueryInfo queryInfo, SFResultsUpdateListener<SFQueryResult> listener, TaskMonitor monitor) throws QueryDatabaseException, CancelledException
    Query the given server with the parameters provider by `queryInfo`.
    Parameters:
      `queryInfo` - a query info object containing the settings for the query
      `listener` - is the listener to be informed of the query status and incremental results coming back, may be null
      `monitor` - the task monitor to use; can be null
    Returns:
      the result object containing the retrieved similar functions; null if the query was cancelled
    Throws:
      `QueryDatabaseException` - if the query execution fails
      `CancelledException` - if the query is cancelled by the user

  - ### overviewSimilarFunctions

    public ResponseNearestVector overviewSimilarFunctions(SFOverviewInfo overviewInfo, SFResultsUpdateListener<ResponseNearestVector> listener, TaskMonitor monitor) throws QueryDatabaseException, CancelledException
    Query the given server for similar function overview information
    Parameters:
      `overviewInfo` - is details of the overview query
      `listener` - is the listener to be informed of the query status and incremental results coming back, may be null
      `monitor` - the task monitor
    Returns:
      the ResponseNearestVector
    Throws:
      `QueryDatabaseException` - if the database connection cannot be established
      `CancelledException` - if the query is cancelled by the user

  - ### queryRaw

    public QueryResponseRecord queryRaw(BSimQuery<?> query, StagingManager stagingManager, SFResultsUpdateListener<QueryResponseRecord> listener, TaskMonitor monitor) throws QueryDatabaseException, CancelledException
    A lower-level (more flexible) query of the database. The query is not staged.
    Parameters:
      `query` - is the raw query information
      `stagingManager` - is how to split up the query, can be null
      `listener` - is the listener to be informed of the query status and incremental results coming back, may be null
      `monitor` - the task monitor
    Returns:
      the raw response record from the database
    Throws:
      `QueryDatabaseException` - if the database connection cannot be established
      `CancelledException` - if the query is cancelled by the user

  - ### dispose

    public void dispose()

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`

  - ### setNumberOfStages

    public void setNumberOfStages(int val)

  - ### updateProgram

    public void updateProgram(Program newProgram)

  - ### getServerInfo

    public BSimServerInfo getServerInfo()
    Return the `server info object` for this database
    Returns:
      the server info object or null if not currently associated with a `FunctionDatabase`.

  - ### getDatabaseStatus

    public FunctionDatabase.Status getDatabaseStatus()

  - ### getDatabaseConnectionType

    public FunctionDatabase.ConnectionType getDatabaseConnectionType()

  - ### getDatabaseInformation

    public DatabaseInformation getDatabaseInformation()

  - ### getUserName

    public String getUserName()

  - ### getLSHVectorFactory

    public LSHVectorFactory getLSHVectorFactory()

  - ### getLastError

    public FunctionDatabase.BSimError getLastError()

  - ### getDatabaseCompatibility

    public String getDatabaseCompatibility()
    Returns a string explaining the database compatibility between this client and the server.
    Returns:
      a string explaining the compatibility, or null if it could not be determined

  - ### createDatabase

    protected FunctionDatabase createDatabase(String urlString) throws MalformedURLException
    Throws:
      `MalformedURLException`

  - ### initializeDatabase

    public void initializeDatabase(String serverURLString) throws QueryDatabaseException
    Throws:
      `QueryDatabaseException`