Package ghidra.framework.protocol.ghidra
Class GhidraURL
java.lang.Object
ghidra.framework.protocol.ghidra.GhidraURL
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDisplayString
(URL url) Generate preferred display string for Ghidra URLs.static URL
getNormalizedURL
(URL url) Get a normalized URL which eliminates use of host names and additional URL refs which may prevent direct comparison.static String
getProjectLocation
(URL localProjectURL) Get the project location path which corresponds to the specified local project URL.static String
getProjectName
(URL localProjectURL) Get the project name which corresponds to the specified local project URL.static ProjectLocator
getProjectStorageLocator
(URL localProjectURL) Get the project locator which corresponds to the specified local project URL.static boolean
isLocalProjectURL
(URL url) Determine if the specified URL is a local project URL.static boolean
isServerRepositoryURL
(URL url) Determine if the specified URL is any type of server "repository" URL.static boolean
isServerURL
(URL url) Determine if the specified URL is any type of server URL.static boolean
localProjectExists
(URL url) Determine if the specified URL refers to a local project and it exists.static URL
Create a local project URL for a specified project marker file.static URL
Create a URL which refers to Ghidra Server repository and its root folderstatic URL
Create a URL which refers to Ghidra Server repository content.static URL
makeURL
(String host, int port, String repositoryName, String repositoryPath, String fileName, String ref) Create a URL which refers to Ghidra Server repository content.static URL
Create a URL which refers to a local Ghidra projectstatic URL
Create a Ghidra URL from a string form of Ghidra URL or local project path.
-
Field Details
-
PROTOCOL
- See Also:
-
MARKER_FILE_EXTENSION
- See Also:
-
PROJECT_DIRECTORY_EXTENSION
- See Also:
-
-
Method Details
-
localProjectExists
Determine if the specified URL refers to a local project and it exists.- Parameters:
url
-- Returns:
- true if specified URL refers to a local project and it exists.
-
isLocalProjectURL
Determine if the specified URL is a local project URL. No checking is performed as to the existence of the project.- Parameters:
url
-- Returns:
- true if specified URL refers to a local project (ghidra:/path/projectName...)
-
getProjectName
Get the project name which corresponds to the specified local project URL.- Parameters:
localProjectURL
- local Ghidra project URL- Returns:
- project name
- Throws:
IllegalArgumentException
- URL is not a valid local project URL
-
getProjectLocation
Get the project location path which corresponds to the specified local project URL.- Parameters:
localProjectURL
- local Ghidra project URL- Returns:
- project location path
- Throws:
IllegalArgumentException
- URL is not a valid local project URL
-
getProjectStorageLocator
Get the project locator which corresponds to the specified local project URL.- Parameters:
localProjectURL
- local Ghidra project URL- Returns:
- project locator
- Throws:
IllegalArgumentException
- URL is not a valid local project URL
-
isServerRepositoryURL
Determine if the specified URL is any type of server "repository" URL. No checking is performed as to the existence of the server or repository.- Parameters:
url
-- Returns:
- true if specified URL refers to a Ghidra server repository (ghidra://host/repositoryNAME/path...)
-
isServerURL
Determine if the specified URL is any type of server URL. No checking is performed as to the existence of the server or repository.- Parameters:
url
-- Returns:
- true if specified URL refers to a Ghidra server repository (ghidra://host/repositoryNAME/path...)
-
toURL
Create a Ghidra URL from a string form of Ghidra URL or local project path. This method can consume strings produced by the getDisplayString method.- Parameters:
projectPathOrURL
- project path (<absolute-directory>/<project-name>)- Returns:
- local Ghidra project URL
- Throws:
IllegalArgumentException
- invalid path or URL specified- See Also:
-
getNormalizedURL
Get a normalized URL which eliminates use of host names and additional URL refs which may prevent direct comparison.- Parameters:
url
-- Returns:
- normalized url
-
getDisplayString
Generate preferred display string for Ghidra URLs. Form can be parsed by the toURL method.- Parameters:
url
-- Returns:
- See Also:
-
makeURL
Create a local project URL for a specified project marker file.- Parameters:
projectMarkerFile
- project marker file- Returns:
- local project URL
-
makeURL
Create a URL which refers to a local Ghidra project- Parameters:
dirPath
- absolute path of project location directoryprojectName
- name of project- Returns:
- local Ghidra project URL
-
makeURL
Create a URL which refers to Ghidra Server repository content. Path may correspond to either a file or folder.- Parameters:
host
- server host name/addressport
- optional server port (a value <= 0 refers to the default port)repositoryName
- repository namerepositoryPath
- absolute folder or file path within repository. Folder paths should end with a '/' character.- Returns:
- Ghidra Server repository content URL
-
makeURL
public static URL makeURL(String host, int port, String repositoryName, String repositoryPath, String fileName, String ref) Create a URL which refers to Ghidra Server repository content. Path may correspond to either a file or folder.- Parameters:
host
- server host name/addressport
- optional server port (a value <= 0 refers to the default port)repositoryName
- repository namerepositoryPath
- absolute folder path within repository.fileName
- name of a file contained within the specified repository/pathref
- optional URL ref or null Folder paths should end with a '/' character.- Returns:
- Ghidra Server repository content URL
-
makeURL
Create a URL which refers to Ghidra Server repository and its root folder- Parameters:
host
- server host name/addressport
- optional server port (a value <= 0 refers to the default port)repositoryName
- repository name- Returns:
- Ghidra Server repository URL
-