Package ghidra.framework.store.local
Class LocalFolderItem
java.lang.Object
ghidra.framework.store.local.LocalFolderItem
- All Implemented Interfaces:
FolderItem
- Direct Known Subclasses:
LocalDatabaseItem,LocalDataFile,UnknownFolderItem
LocalFolderItem provides an abstract implementation of a folder
item which resides on a local file-system. An item is defined by a property file
and generally has a hidden data directory which contains the actual data file(s).
An item may be either private or shared (i.e., versioned) as defined by the associated file-system. A shared item utilizes a CheckoutManager and HistoryManager for tracking version control data related to this item.
-
Field Summary
Fields inherited from interface ghidra.framework.store.FolderItem
DATABASE_FILE_TYPE, DATAFILE_FILE_TYPE, DEFAULT_CHECKOUT_ID, LATEST_VERSION, UNKNOWN_FILE_TYPE -
Method Summary
Modifier and TypeMethodDescriptioncheckout(CheckoutType checkoutType, String user, String projectPath) Checkout this folder item.voidClears the checkout data associated with this non-shared file.voidDeletes the item or a specific version.booleangetCheckout(long checkoutId) Get the checkout status which corresponds to the specified checkout ID.longReturns the checkoutId for this file.Get all current checkouts for this item.intReturns the item version which was checked-out.Return The content type name for this item.intReturns the version of content type.Return the file ID if one has been established or nullintReturns the local item version at the time the checkout was completed.getName()Return The display name for this item.Returns the path of the parent folder.Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.Version[]Returns list of all available versions or null if item is not versioned.booleanReturns true if this item is versioned and has one or more checkouts.booleanReturns true if this item is a checked-out copy from a versioned file system.booleanReturns true if this item is a checked-out copy with exclusive access from a versioned file system.booleanReturns true if this item is versioned and has a checkin in-progress.booleanReturns true if item can be overwritten/deleted.booleanReturn true if this is a versioned item, else falselongReturn The time that this item was last modified.refresh()Returns this instance after refresh or null if item no longer existsAssign a new file-ID to this local non-versioned file.voidsetCheckout(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion) Set the checkout data associated with this non-shared file.voidsetContentTypeVersion(int version) Sets the version for the content type.voidsetReadOnly(boolean state) Set the state of the read-only indicator for this non-shared item.voidterminateCheckout(long checkoutId, boolean notify) Terminates a checkout.abstract voidupdateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) Update this non-versioned item with the latest version of the specified versioned item.abstract voidupdateCheckout(FolderItem item, int checkoutVersion) Update this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem.voidupdateCheckoutVersion(long checkoutId, int checkoutVersion, String user) Update the checkout version associated with this versioned item.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.framework.store.FolderItem
canRecover, getCurrentVersion, length, output
-
Method Details
-
refresh
Description copied from interface:FolderItemReturns this instance after refresh or null if item no longer exists- Specified by:
refreshin interfaceFolderItem- Throws:
IOException
-
delete
Description copied from interface:FolderItemDeletes the item or a specific version. If a specific version is specified, it must either be the oldest or latest (i.e., current).- Specified by:
deletein interfaceFolderItem- Parameters:
version- specific version to be deleted, or -1 to remove all versions.user- user name- Throws:
IOException- if an IO error occurs, including the inability to delete a version because this item is checked-out, the user does not have permission, or the specified version is not the oldest or latest.- See Also:
-
getContentType
Description copied from interface:FolderItemReturn The content type name for this item.- Specified by:
getContentTypein interfaceFolderItem- See Also:
-
getFileID
Description copied from interface:FolderItemReturn the file ID if one has been established or null- Specified by:
getFileIDin interfaceFolderItem- See Also:
-
resetFileID
Description copied from interface:FolderItemAssign a new file-ID to this local non-versioned file. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
resetFileIDin interfaceFolderItem- Returns:
- new file-ID
- Throws:
IOException- thrown if IO or access error occurs- See Also:
-
getName
Description copied from interface:FolderItemReturn The display name for this item.- Specified by:
getNamein interfaceFolderItem- See Also:
-
getParentPath
Description copied from interface:FolderItemReturns the path of the parent folder.- Specified by:
getParentPathin interfaceFolderItem- See Also:
-
getPathName
Description copied from interface:FolderItemReturn The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.- Specified by:
getPathNamein interfaceFolderItem- See Also:
-
isCheckedOut
public boolean isCheckedOut()Description copied from interface:FolderItemReturns true if this item is a checked-out copy from a versioned file system.- Specified by:
isCheckedOutin interfaceFolderItem- See Also:
-
isCheckedOutExclusive
public boolean isCheckedOutExclusive()Description copied from interface:FolderItemReturns true if this item is a checked-out copy with exclusive access from a versioned file system.- Specified by:
isCheckedOutExclusivein interfaceFolderItem
-
isVersioned
Description copied from interface:FolderItemReturn true if this is a versioned item, else false- Specified by:
isVersionedin interfaceFolderItem- Throws:
IOException- thrown if an IO error occurs.- See Also:
-
getVersions
Description copied from interface:FolderItemReturns list of all available versions or null if item is not versioned.- Specified by:
getVersionsin interfaceFolderItem- Throws:
IOException- thrown if an IO error occurs.- See Also:
-
lastModified
public long lastModified()Description copied from interface:FolderItemReturn The time that this item was last modified.- Specified by:
lastModifiedin interfaceFolderItem- See Also:
-
isReadOnly
public boolean isReadOnly()Description copied from interface:FolderItemReturns true if item can be overwritten/deleted.- Specified by:
isReadOnlyin interfaceFolderItem- See Also:
-
setReadOnly
Description copied from interface:FolderItemSet the state of the read-only indicator for this non-shared item.- Specified by:
setReadOnlyin interfaceFolderItem- Parameters:
state- read-only state- Throws:
IOException- if an IO error occurs or item is stored on a shared file-system- See Also:
-
getContentTypeVersion
public int getContentTypeVersion()Description copied from interface:FolderItemReturns the version of content type. Note this is the version of the structure/storage for the content type, Not the users version of their data.- Specified by:
getContentTypeVersionin interfaceFolderItem
-
setContentTypeVersion
Description copied from interface:FolderItemSets the version for the content type. This will change whenever the domain objects are upgraded.- Specified by:
setContentTypeVersionin interfaceFolderItem- Parameters:
version- the new version for the content type.- Throws:
IOException- if an IO error occurs or item is stored on a shared file-system
-
checkout
public ItemCheckoutStatus checkout(CheckoutType checkoutType, String user, String projectPath) throws IOException Description copied from interface:FolderItemCheckout this folder item.- Specified by:
checkoutin interfaceFolderItem- Parameters:
checkoutType- type of checkoutuser- user requesting checkoutprojectPath- path of project where checkout was made- Returns:
- checkout status or null if exclusive checkout request failed
- Throws:
IOException- if an IO error occurs or this item is not versioned
-
terminateCheckout
Description copied from interface:FolderItemTerminates a checkout. The checkout ID becomes invalid, therefore the associated checkout copy should either be removed or converted to a private file.- Specified by:
terminateCheckoutin interfaceFolderItem- Parameters:
checkoutId- checkout IDnotify- if true item change notification will be sent- Throws:
IOException- if an IO error occurs or this item is not versioned
-
getCheckout
Description copied from interface:FolderItemGet the checkout status which corresponds to the specified checkout ID.- Specified by:
getCheckoutin interfaceFolderItem- Parameters:
checkoutId- checkout ID- Returns:
- checkout status or null if checkout ID not found.
- Throws:
IOException- if an IO error occurs or this item is not versioned
-
getCheckouts
Description copied from interface:FolderItemGet all current checkouts for this item.- Specified by:
getCheckoutsin interfaceFolderItem- Returns:
- array of checkouts
- Throws:
IOException- if an IO error occurs or this item is not versioned
-
getCheckoutId
public long getCheckoutId()Description copied from interface:FolderItemReturns the checkoutId for this file. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
getCheckoutIdin interfaceFolderItem
-
getCheckoutVersion
Description copied from interface:FolderItemReturns the item version which was checked-out. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
getCheckoutVersionin interfaceFolderItem- Throws:
IOException
-
getLocalCheckoutVersion
public int getLocalCheckoutVersion()Description copied from interface:FolderItemReturns the local item version at the time the checkout was completed. A value of -1 indicates a private item. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
getLocalCheckoutVersionin interfaceFolderItem
-
setCheckout
public void setCheckout(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion) throws IOException Description copied from interface:FolderItemSet the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
setCheckoutin interfaceFolderItem- Parameters:
checkoutId- checkout ID (provided by ItemCheckoutStatus).exclusive- true if checkout is exclusivecheckoutVersion- the item version which was checked-out (provided by ItemCheckoutStatus).localVersion- the local item version at the time the checkout was completed.- Throws:
IOException- if an IO error occurs or item is stored on a shared file-system
-
clearCheckout
Description copied from interface:FolderItemClears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- Specified by:
clearCheckoutin interfaceFolderItem- Throws:
IOException
-
hasCheckouts
public boolean hasCheckouts()Description copied from interface:FolderItemReturns true if this item is versioned and has one or more checkouts.- Specified by:
hasCheckoutsin interfaceFolderItem
-
isCheckinActive
public boolean isCheckinActive()Description copied from interface:FolderItemReturns true if this item is versioned and has a checkin in-progress.- Specified by:
isCheckinActivein interfaceFolderItem
-
equals
-
updateCheckout
public abstract void updateCheckout(FolderItem versionedFolderItem, boolean updateItem, TaskMonitor monitor) throws IOException, CancelledException Update this non-versioned item with the latest version of the specified versioned item.- Parameters:
versionedFolderItem- versioned item which corresponds to this non-versioned item.updateItem- if true this items content is updated using the versionedFolderItemmonitor- progress monitor for update- Throws:
IOException- if this file is not a checked-out non-versioned file or an IO error occurs.CancelledException- if monitor cancels operation
-
updateCheckout
Update this non-versioned item with the contents of the specified item which must be within the same non-versioned fileSystem. If successful, the specified item will be removed after its content has been moved into this item.- Parameters:
item-checkoutVersion-- Throws:
IOException- if this file is not a checked-out non-versioned file or an IO error occurs.
-
updateCheckoutVersion
public void updateCheckoutVersion(long checkoutId, int checkoutVersion, String user) throws IOException Description copied from interface:FolderItemUpdate the checkout version associated with this versioned item.- Specified by:
updateCheckoutVersionin interfaceFolderItem- Parameters:
checkoutId- id corresponding to an existing checkoutcheckoutVersion-user-- Throws:
IOException- if an IO error occurs.
-