Class GhidraURLQueryTask

java.lang.Object
ghidra.util.task.Task
ghidra.framework.protocol.ghidra.GhidraURLQueryTask
All Implemented Interfaces:
GhidraURLResultHandler, MonitoredRunnable
Direct Known Subclasses:
AcceptUrlContentTask, ContentTypeQueryTask

public abstract class GhidraURLQueryTask extends Task implements GhidraURLResultHandler
GhidraURLQueryTask provides an abstract Task which performs remote Ghidra repository and read-only local project queries for processing either a DomainFile or DomainFolder that a Ghidra URL may reference.

All implementations of this Task should override one or both of the processing methods processResult(DomainFile, URL, TaskMonitor) and processResult(DomainFolder, URL, TaskMonitor). For any process method not overriden the default behavior is reporting Unsupported Content.

If handleError(String, String, URL, IOException) is not overriden all errors are reported via Msg.showError(Object, java.awt.Component, String, Object).

  • Constructor Details

    • GhidraURLQueryTask

      protected GhidraURLQueryTask(String title, URL ghidraUrl)
      Construct a Ghidra URL read-only query task.
      Parameters:
      title - task dialog title
      ghidraUrl - Ghidra URL (local or remote)
      Throws:
      IllegalArgumentException - if specified URL is not a Ghidra URL (see GhidraURL).
  • Method Details

    • isDone

      protected boolean isDone()
      Determine if the task has completed its execution
      Returns:
      true if done executing else false
    • run

      public void run(TaskMonitor monitor) throws CancelledException
      Description copied from class: Task
      This is the method that will be called to do the work

      Note: The run(TaskMonitor) method should not make any calls directly on Swing components, as these calls are not thread safe. Place Swing calls in a Runnable, then call Swing.runLater(Runnable) or Swing.runNow(Runnable)to schedule the Runnable inside of the AWT Event Thread.

      Specified by:
      run in class Task
      Parameters:
      monitor - The TaskMonitor that will monitor the executing Task
      Throws:
      CancelledException - if the task is cancelled. Subclasses can trigger this exception by calling TaskMonitor.checkCancelled(). This allows them to break out of the current work stack.
    • handleError

      public void handleError(String title, String message, URL url, IOException cause)
      Description copied from interface: GhidraURLResultHandler
      Handle error which occurs during query operation.
      Specified by:
      handleError in interface GhidraURLResultHandler
      Parameters:
      title - error title
      message - error detail
      url - URL which was used for query
      cause - cause of error (may be null)
    • processResult

      public void processResult(DomainFile domainFile, URL url, TaskMonitor monitor) throws IOException
      Description copied from interface: GhidraURLResultHandler
      Process the specified domainFile query result. Dissemination of the domainFile instance should be restricted and any use of it completed before the call to this method returns. Upon return from this method call the underlying connection will be closed and at which time the domainFile instance will become invalid.
      Specified by:
      processResult in interface GhidraURLResultHandler
      Parameters:
      domainFile - DomainFile to which the URL refers.
      url - URL which was used to retrieve the specified domainFile
      monitor - task monitor
      Throws:
      IOException - if an IO error occurs
    • processResult

      public void processResult(DomainFolder domainFolder, URL url, TaskMonitor monitor) throws IOException
      Description copied from interface: GhidraURLResultHandler
      Process the specified domainFolder query result. Dissemination of the domainFolder instance should be restricted and any use of it completed before the call to this method returns. Upon return from this method call the underlying connection will be closed and at which time the domainFolder instance will become invalid.
      Specified by:
      processResult in interface GhidraURLResultHandler
      Parameters:
      domainFolder - DomainFolder to which the URL refers.
      url - URL which was used to retrieve the specified domainFolder
      monitor - task monitor
      Throws:
      IOException - if an IO error occurs