Package ghidra.framework.protocol.ghidra
Class DefaultLocalGhidraProtocolConnector
- java.lang.Object
-
- ghidra.framework.protocol.ghidra.GhidraProtocolConnector
-
- ghidra.framework.protocol.ghidra.DefaultLocalGhidraProtocolConnector
-
public class DefaultLocalGhidraProtocolConnector extends GhidraProtocolConnector
DefaultLocalGhidraProtocolConnectorprovides support for the Ghidra URL protocol which specifies a local Ghidra project without extension. This connector is responsible for producing a suitableProjectLocatorfor accessing the project files.
-
-
Field Summary
-
Fields inherited from class ghidra.framework.protocol.ghidra.GhidraProtocolConnector
folderItemName, folderPath, itemPath, repositoryAdapter, repositoryName, repositoryServerAdapter, responseCode, url
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckHostInfo()Presence of a host specification within URL will be verifiedintconnect(boolean readOnlyAccess)Connect to the resource specified by the associated URL.protected voidconnect(RepositoryAdapter repository)Utilized a cached connection via the specified repository adapter.ProjectLocatorgetLocalProjectLocator()Get the ProjectLocator associated with a local project URL.protected java.net.URLgetRepositoryRootGhidraURL()Get the URL associated with the repository/project root folder.booleanisReadOnly()Determines the read-only nature of a connected resourceprotected java.lang.StringparseItemPath()Parse item path name from URL and establish initial values for folderPath and folderItemName.protected java.lang.StringparseRepositoryName()Parse repository name from URL-
Methods inherited from class ghidra.framework.protocol.ghidra.GhidraProtocolConnector
checkProtocol, checkUserInfo, getFolderItemName, getFolderPath, getRepositoryAdapter, getRepositoryName, getRepositoryServerAdapter, getResponseCode, resolveItemPath
-
-
-
-
Method Detail
-
checkHostInfo
protected void checkHostInfo() throws java.net.MalformedURLExceptionDescription copied from class:GhidraProtocolConnectorPresence of a host specification within URL will be verified- Overrides:
checkHostInfoin classGhidraProtocolConnector- Throws:
java.net.MalformedURLException- if URL is missing proper host specification
-
parseRepositoryName
protected java.lang.String parseRepositoryName() throws java.net.MalformedURLExceptionDescription copied from class:GhidraProtocolConnectorParse repository name from URL- Overrides:
parseRepositoryNamein classGhidraProtocolConnector- Returns:
- repository name or null if not specified
- Throws:
java.net.MalformedURLException- if URL is invalid
-
parseItemPath
protected java.lang.String parseItemPath() throws java.net.MalformedURLExceptionDescription copied from class:GhidraProtocolConnectorParse item path name from URL and establish initial values for folderPath and folderItemName.- Overrides:
parseItemPathin classGhidraProtocolConnector- Returns:
- original item path from URL or null if not specified
- Throws:
java.net.MalformedURLException- if URL is invalid
-
connect
protected void connect(RepositoryAdapter repository) throws java.io.IOException
Description copied from class:GhidraProtocolConnectorUtilized a cached connection via the specified repository adapter. This method may only be invoked if not yet connected and the associated URL corresponds to a repository (getRepositoryName() != null). The connection response code should be established based upon the availability of the URL referenced repository resource (i.e., folder or file).- Overrides:
connectin classGhidraProtocolConnector- Parameters:
repository- existing connected repository adapter- Throws:
java.io.IOException
-
getLocalProjectLocator
public ProjectLocator getLocalProjectLocator()
Get the ProjectLocator associated with a local project URL.- Returns:
- project locator object or null if URL supplies a a RepositoryAdapter and/or RepositoryServerAdapter.
-
getRepositoryRootGhidraURL
protected java.net.URL getRepositoryRootGhidraURL()
Description copied from class:GhidraProtocolConnectorGet the URL associated with the repository/project root folder. This will be used as a key to its corresponding transient project data.- Specified by:
getRepositoryRootGhidraURLin classGhidraProtocolConnector- Returns:
- root folder URL
-
isReadOnly
public boolean isReadOnly() throws NotConnectedExceptionDescription copied from class:GhidraProtocolConnectorDetermines the read-only nature of a connected resource- Specified by:
isReadOnlyin classGhidraProtocolConnector- Returns:
- true if read-only, false if write access allowed
- Throws:
NotConnectedException- if connect has not yet been performed
-
connect
public int connect(boolean readOnlyAccess) throws java.io.IOExceptionDescription copied from class:GhidraProtocolConnectorConnect to the resource specified by the associated URL. This method should only be invoked once, a second attempt may result in an IOException.- Specified by:
connectin classGhidraProtocolConnector- Parameters:
readOnlyAccess- if resource should be requested for write access.- Returns:
- connection response code @see
GhidraURLConnection - Throws:
java.io.IOException- if a connection error occurs
-
-