Package ghidra.framework.protocol.ghidra
Class GhidraURLQueryTask
java.lang.Object
ghidra.util.task.Task
ghidra.framework.protocol.ghidra.GhidraURLQueryTask
- All Implemented Interfaces:
GhidraURLResultHandler,MonitoredRunnable
- Direct Known Subclasses:
AcceptUrlContentTask,ContentTypeQueryTask
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).
-
Field Summary
Fields inherited from class ghidra.util.task.Task
taskMonitor, waitForTaskCompleted -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGhidraURLQueryTask(String title, URL ghidraUrl) Construct a Ghidra URL read-only query task. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleError(String title, String message, URL url, IOException cause) Handle error which occurs during query operation.protected booleanisDone()Determine if the task has completed its executionvoidprocessResult(DomainFile domainFile, URL url, TaskMonitor monitor) Process the specifieddomainFilequery result.voidprocessResult(DomainFolder domainFolder, URL url, TaskMonitor monitor) Process the specifieddomainFolderquery result.voidrun(TaskMonitor monitor) This is the method that will be called to do the workMethods inherited from class ghidra.util.task.Task
addTaskListener, canCancel, cancel, getStatusTextAlignment, getTaskTitle, getWaitForTaskCompleted, hasProgress, isCancelled, isModal, monitoredRun, notifyTaskListeners, setHasProgressMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.framework.protocol.ghidra.GhidraURLResultHandler
handleUnauthorizedAccess
-
Constructor Details
-
GhidraURLQueryTask
Construct a Ghidra URL read-only query task.- Parameters:
title- task dialog titleghidraUrl- Ghidra URL (local or remote)- Throws:
IllegalArgumentException- if specified URL is not a Ghidra URL (seeGhidraURL).
-
-
Method Details
-
isDone
protected boolean isDone()Determine if the task has completed its execution- Returns:
- true if done executing else false
-
run
Description copied from class:TaskThis is the method that will be called to do the workNote: 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)orSwing.runNow(Runnable)to schedule the Runnable inside of the AWT Event Thread.- Specified by:
runin classTask- Parameters:
monitor- The TaskMonitor that will monitor the executing Task- Throws:
CancelledException- if the task is cancelled. Subclasses can trigger this exception by callingTaskMonitor.checkCancelled(). This allows them to break out of the current work stack.
-
handleError
Description copied from interface:GhidraURLResultHandlerHandle error which occurs during query operation.- Specified by:
handleErrorin interfaceGhidraURLResultHandler- Parameters:
title- error titlemessage- error detailurl- URL which was used for querycause- cause of error (may be null)
-
processResult
Description copied from interface:GhidraURLResultHandlerProcess the specifieddomainFilequery result. Dissemination of thedomainFileinstance 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 thedomainFileinstance will become invalid.- Specified by:
processResultin interfaceGhidraURLResultHandler- Parameters:
domainFile-DomainFileto which the URL refers.url- URL which was used to retrieve the specifieddomainFilemonitor- 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:GhidraURLResultHandlerProcess the specifieddomainFolderquery result. Dissemination of thedomainFolderinstance 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 thedomainFolderinstance will become invalid.- Specified by:
processResultin interfaceGhidraURLResultHandler- Parameters:
domainFolder-DomainFolderto which the URL refers.url- URL which was used to retrieve the specifieddomainFoldermonitor- task monitor- Throws:
IOException- if an IO error occurs
-