Package ghidra.framework.store.local
Class MangledLocalFileSystem
- java.lang.Object
-
- ghidra.framework.store.local.LocalFileSystem
-
- ghidra.framework.store.local.MangledLocalFileSystem
-
- All Implemented Interfaces:
FileSystem
public class MangledLocalFileSystem extends LocalFileSystem
MangledLocalFileSystem
implements the legacy project data storage scheme which utilizes a simplified name mangling which provides case-sensitive file-naming with support for spaces. Project folder hierarchy maps directly to the actual storage hierarchy.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ghidra.framework.store.local.LocalFileSystem
LocalFileSystem.ItemStorage
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_NAME_LENGTH
-
Fields inherited from class ghidra.framework.store.local.LocalFileSystem
HIDDEN_DIR_PREFIX, HIDDEN_DIR_PREFIX_CHAR, HIDDEN_ITEM_PREFIX, isVersioned, listeners, readOnly, root
-
Fields inherited from interface ghidra.framework.store.FileSystem
SEPARATOR, SEPARATOR_CHAR
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LocalFileSystem.ItemStorage
allocateItemStorage(java.lang.String folderPath, java.lang.String itemName)
Allocate a new storage locationvoid
convertToIndexedLocalFileSystem()
Convert this mangled filesystem to an indexed filesystem.void
createFolder(java.lang.String parentPath, java.lang.String folderName)
Creates a new subfolder within the specified parent folder.protected void
deallocateItemStorage(java.lang.String folderPath, java.lang.String itemName)
Deallocate item storagevoid
deleteFolder(java.lang.String folderPath)
Delete the specified folder.protected LocalFileSystem.ItemStorage
findItemStorage(java.lang.String folderPath, java.lang.String itemName)
Find an existing storage locationboolean
folderExists(java.lang.String folderPath)
Returns true if the folder specified by the path exists.java.lang.String[]
getFolderNames(java.lang.String folderPath)
Return a list of subfolders (by name) that are stored within the specified folder path.int
getItemCount()
Returns the number of folder items contained within this file-system.protected java.lang.String[]
getItemNames(java.lang.String folderPath, boolean includeHiddenFiles)
int
getMaxNameLength()
boolean
migrationInProgress()
void
moveFolder(java.lang.String parentPath, java.lang.String folderName, java.lang.String newParentPath)
Move the specified folder to the path specified by newFolderPath.void
renameFolder(java.lang.String parentPath, java.lang.String folderName, java.lang.String newFolderName)
Renames the specified folder to a new name.-
Methods inherited from class ghidra.framework.store.local.LocalFileSystem
addFileSystemListener, cleanupAfterConstruction, createDatabase, createDatabase, createDataFile, createFile, createTemporaryDatabase, deleteEmptyVersionedFolders, dispose, escapeHiddenDirPrefixChars, fileExists, fileIdChanged, getItem, getItem, getItemNames, getLocalFileSystem, getName, getParentPath, getPath, getUserName, isHiddenDirName, isOnline, isReadOnly, isRefreshRequired, isShared, isValidNameCharacter, isVersioned, itemDeleted, log, moveItem, removeFileSystemListener, setAssociatedRepositoryLogger, setValidationRequired, testValidName, unescapeHiddenDirPrefixChars
-
-
-
-
Field Detail
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMaxNameLength
public int getMaxNameLength()
- Specified by:
getMaxNameLength
in classLocalFileSystem
-
findItemStorage
protected LocalFileSystem.ItemStorage findItemStorage(java.lang.String folderPath, java.lang.String itemName) throws java.io.FileNotFoundException
Find an existing storage location- Specified by:
findItemStorage
in classLocalFileSystem
- Parameters:
folderPath
-itemName
-- Returns:
- storage location. A non-null value does not guarantee that the associated item actually exists.
- Throws:
java.io.FileNotFoundException
-
allocateItemStorage
protected LocalFileSystem.ItemStorage allocateItemStorage(java.lang.String folderPath, java.lang.String itemName) throws java.io.IOException, InvalidNameException
Allocate a new storage location- Specified by:
allocateItemStorage
in classLocalFileSystem
- Parameters:
folderPath
-itemName
-- Returns:
- storage location
- Throws:
DuplicateFileException
- if item path has previously been allocatedjava.io.IOException
- if invalid path/item name specifiedInvalidNameException
- if folderPath or itemName contains invalid characters
-
deallocateItemStorage
protected void deallocateItemStorage(java.lang.String folderPath, java.lang.String itemName)
Deallocate item storage- Specified by:
deallocateItemStorage
in classLocalFileSystem
- Parameters:
folderPath
-itemName
-
-
getItemCount
public int getItemCount()
Description copied from interface:FileSystem
Returns the number of folder items contained within this file-system.
-
getItemNames
protected java.lang.String[] getItemNames(java.lang.String folderPath, boolean includeHiddenFiles) throws java.io.IOException
- Specified by:
getItemNames
in classLocalFileSystem
- Throws:
java.io.IOException
-
getFolderNames
public java.lang.String[] getFolderNames(java.lang.String folderPath) throws java.io.IOException
Description copied from interface:FileSystem
Return a list of subfolders (by name) that are stored within the specified folder path.- Throws:
java.io.FileNotFoundException
- if folder path does not exist.java.io.IOException
- if IO error occurs.
-
createFolder
public void createFolder(java.lang.String parentPath, java.lang.String folderName) throws InvalidNameException, java.io.IOException
Description copied from interface:FileSystem
Creates a new subfolder within the specified parent folder.- Parameters:
parentPath
- folder path of parentfolderName
- name of new subfolder- Throws:
InvalidNameException
- if the name does not have all alphanumericsDuplicateFileException
- if a folder exists with this namejava.io.IOException
- thrown if an IO error occurs.
-
deleteFolder
public void deleteFolder(java.lang.String folderPath) throws java.io.IOException
Description copied from interface:FileSystem
Delete the specified folder.- Parameters:
folderPath
- path of folder to be deleted- Throws:
FolderNotEmptyException
- Thrown if the folder is not empty.java.io.FileNotFoundException
- if there is no folder with the given path name.java.io.IOException
- if error occured during delete.
-
moveFolder
public void moveFolder(java.lang.String parentPath, java.lang.String folderName, java.lang.String newParentPath) throws InvalidNameException, java.io.IOException
Description copied from interface:FileSystem
Move the specified folder to the path specified by newFolderPath. The moved folder must not be an ancestor of the new Parent.- Parameters:
parentPath
- path of parent folder that the moving folder currently resides in.folderName
- name of the folder within the parentPath to be moved.newParentPath
- path to where the folder is to be moved.- Throws:
InvalidNameException
- if the new FolderPath contains an illegal file name.java.io.FileNotFoundException
- if the moved folder does not exist.DuplicateFileException
- if folder with the same name exists within the new parent folderFileInUseException
- if any file within this folder or its decendents are in-use or checked-outjava.io.IOException
- if an IO error occurs.
-
renameFolder
public void renameFolder(java.lang.String parentPath, java.lang.String folderName, java.lang.String newFolderName) throws InvalidNameException, java.io.IOException
Description copied from interface:FileSystem
Renames the specified folder to a new name.- Parameters:
parentPath
- the parent folder of the folder to be renamed.folderName
- the current name of the folder to be renamed.newFolderName
- the name the folder to be renamed to.- Throws:
InvalidNameException
- if the new FolderName contains an illegal file name.java.io.FileNotFoundException
- if the folder to be renamed does not exist.DuplicateFileException
- if folder with the new name already exists.FileInUseException
- if any file within this folder or its decendents are in-use or checked-outjava.io.IOException
- if an IO error occurs.
-
folderExists
public boolean folderExists(java.lang.String folderPath)
Description copied from interface:FileSystem
Returns true if the folder specified by the path exists.- Specified by:
folderExists
in interfaceFileSystem
- Specified by:
folderExists
in classLocalFileSystem
- Parameters:
folderPath
- the name of the folder to check for existence.- Returns:
- true if the folder exists.
-
migrationInProgress
public boolean migrationInProgress()
- Overrides:
migrationInProgress
in classLocalFileSystem
-
convertToIndexedLocalFileSystem
public void convertToIndexedLocalFileSystem() throws java.io.IOException
Convert this mangled filesystem to an indexed filesystem. This instance should be discarded and not used once the conversion has completed.- Throws:
java.io.IOException
-
-