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
ModifierConstructorDescriptionprotected
GhidraURLQueryTask
(String title, URL ghidraUrl) Construct a Ghidra URL read-only query task. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handleError
(String title, String message, URL url, IOException cause) Handle error which occurs during query operation.protected boolean
isDone()
Determine if the task has completed its executionvoid
processResult
(DomainFile domainFile, URL url, TaskMonitor monitor) Process the specifieddomainFile
query result.void
processResult
(DomainFolder domainFolder, URL url, TaskMonitor monitor) Process the specifieddomainFolder
query result.void
run
(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, setHasProgress
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Task
This 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:
run
in 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:GhidraURLResultHandler
Handle error which occurs during query operation.- Specified by:
handleError
in interfaceGhidraURLResultHandler
- Parameters:
title
- error titlemessage
- error detailurl
- URL which was used for querycause
- cause of error (may be null)
-
processResult
Description copied from interface:GhidraURLResultHandler
Process the specifieddomainFile
query result. Dissemination of thedomainFile
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 thedomainFile
instance will become invalid.- Specified by:
processResult
in interfaceGhidraURLResultHandler
- Parameters:
domainFile
-DomainFile
to which the URL refers.url
- URL which was used to retrieve the specifieddomainFile
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 specifieddomainFolder
query result. Dissemination of thedomainFolder
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 thedomainFolder
instance will become invalid.- Specified by:
processResult
in interfaceGhidraURLResultHandler
- Parameters:
domainFolder
-DomainFolder
to which the URL refers.url
- URL which was used to retrieve the specifieddomainFolder
monitor
- task monitor- Throws:
IOException
- if an IO error occurs
-