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
`DefaultLocalGhidraProtocolConnector` provides support for the Ghidra URL protocol which specifies a local Ghidra project without extension. This connector is responsible for producing a suitable `ProjectLocator` for accessing the project files.

- ## Field Summary

  ### Fields inherited from class ghidra.framework.protocol.ghidra.GhidraProtocolConnector

  `folderItemName, folderPath, itemPath, repositoryAdapter, repositoryName, repositoryServerAdapter, statusCode, url`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `checkHostInfo()`
  Presence of a host specification within URL will be verified
  `GhidraURLConnection.StatusCode`
  `connect(boolean readOnlyAccess)`
  Connect to the resource specified by the associated URL.
  `protected void`
  `connect(RepositoryAdapter repository)`
  Utilized a cached connection via the specified repository adapter.
  `ProjectLocator`
  `getLocalProjectLocator()`
  Get the ProjectLocator associated with a local project URL.
  `String`
  `getRepositoryName()`
  Gets the repository name associated with the URL.
  `protected URL`
  `getRepositoryRootGhidraURL()`
  Get the URL associated with the repository/project root folder.
  `boolean`
  `isReadOnly()`
  Determines the read-only nature of a connected resource
  `protected String`
  `parseItemPath()`
  Parse item path name from URL and establish initial values for folderPath and folderItemName.

  ### Methods inherited from class ghidra.framework.protocol.ghidra.GhidraProtocolConnector

  `checkProtocol, checkUserInfo, getFolderItemName, getFolderPath, getRepositoryAdapter, getRepositoryServerAdapter, getStatusCode, initFolderItemPath, resolveItemPath`

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

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

- ## Method Details

  - ### checkHostInfo

    protected void checkHostInfo() throws MalformedURLException
    Description copied from class: `GhidraProtocolConnector`
    Presence of a host specification within URL will be verified
    Overrides:
      `checkHostInfo` in class `GhidraProtocolConnector`
    Throws:
      `MalformedURLException` - if URL is missing proper host specification

  - ### getRepositoryName

    public String getRepositoryName()
    Description copied from class: `GhidraProtocolConnector`
    Gets the repository name associated with the URL. If a local URL is used this will correspond to the project name.
    Overrides:
      `getRepositoryName` in class `GhidraProtocolConnector`
    Returns:
      the repository name or null if URL does not identify a specific repository

  - ### parseItemPath

    protected String parseItemPath() throws MalformedURLException
    Description copied from class: `GhidraProtocolConnector`
    Parse item path name from URL and establish initial values for folderPath and folderItemName.
    Overrides:
      `parseItemPath` in class `GhidraProtocolConnector`
    Returns:
      original item path from URL or null if not specified
    Throws:
      `MalformedURLException` - if URL is invalid

  - ### connect

    protected void connect(RepositoryAdapter repository) throws IOException
    Description copied from class: `GhidraProtocolConnector`
    Utilized 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 status code should be established based upon the availability of the URL referenced repository resource (i.e., folder or file).
    Overrides:
      `connect` in class `GhidraProtocolConnector`
    Parameters:
      `repository` - existing connected repository adapter
    Throws:
      `IOException` - if an IO error occurs

  - ### getLocalProjectLocator

    public ProjectLocator getLocalProjectLocator()
    Get the ProjectLocator associated with a local project URL.
    Returns:
      project locator object or null if URL supplies a RepositoryAdapter and/or RepositoryServerAdapter.

  - ### getRepositoryRootGhidraURL

    protected URL getRepositoryRootGhidraURL()
    Description copied from class: `GhidraProtocolConnector`
    Get the URL associated with the repository/project root folder. This will be used as a key to its corresponding transient project data.
    Specified by:
      `getRepositoryRootGhidraURL` in class `GhidraProtocolConnector`
    Returns:
      root folder URL

  - ### isReadOnly

    public boolean isReadOnly() throws NotConnectedException
    Description copied from class: `GhidraProtocolConnector`
    Determines the read-only nature of a connected resource
    Specified by:
      `isReadOnly` in class `GhidraProtocolConnector`
    Returns:
      true if read-only, false if write access allowed
    Throws:
      `NotConnectedException` - if connect has not yet been performed

  - ### connect

    public GhidraURLConnection.StatusCode connect(boolean readOnlyAccess) throws IOException
    Description copied from class: `GhidraProtocolConnector`
    Connect 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:
      `connect` in class `GhidraProtocolConnector`
    Parameters:
      `readOnlyAccess` - if resource should be requested for write access.
    Returns:
      connection status code
    Throws:
      `IOException` - if a connection error occurs