Package ghidra.framework.store
Interface FolderItem
- All Known Subinterfaces:
DatabaseItem
,DataFileItem
- All Known Implementing Classes:
LocalDatabaseItem
,LocalDataFile
,LocalFolderItem
,RemoteDatabaseItem
,RemoteFolderItem
,UnknownFolderItem
public interface FolderItem
FolderItem
represents an individual file
contained within a FileSystem and is uniquely identified
by a path string.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Underlying file is a Databasestatic final int
Underlying file is serialized data filestatic final long
Default checkout ID used when a checkout is not applicable.static final int
Default file version number used to indicate the latest/current version.static final int
Underlying file is an unknown/unsupported type. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if unsaved file changes can be recovered.checkout
(CheckoutType checkoutType, String user, String projectPath) Checkout this folder item.void
Clears the checkout data associated with this non-shared file.void
Deletes the item or a specific version.getCheckout
(long checkoutId) Get the checkout status which corresponds to the specified checkout ID.long
Returns the checkoutId for this file.Get all current checkouts for this item.int
Returns the item version which was checked-out.Return The content type name for this item.int
Returns the version of content type.int
Return the latest/current version.Return the file ID if one has been established or nullint
Returns 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.boolean
Returns true if this item is versioned and has one or more checkouts.boolean
Returns true if this item is a checked-out copy from a versioned file system.boolean
Returns true if this item is a checked-out copy with exclusive access from a versioned file system.boolean
Returns true if this item is versioned and has a checkin in-progress.boolean
Returns true if item can be overwritten/deleted.boolean
Return true if this is a versioned item, else falselong
Return The time that this item was last modified.long
length()
Returns the length of this domain file.void
output
(File outputFile, int version, TaskMonitor monitor) Serialize (i.e., pack) this item into the specified outputFile.refresh()
Returns this instance after refresh or null if item no longer existsAssign a new file-ID to this local non-versioned file.void
setCheckout
(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion) Set the checkout data associated with this non-shared file.void
setContentTypeVersion
(int version) Sets the version for the content type.void
setReadOnly
(boolean state) Set the state of the read-only indicator for this non-shared item.void
terminateCheckout
(long checkoutId, boolean notify) Terminates a checkout.void
updateCheckoutVersion
(long checkoutId, int checkoutVersion, String user) Update the checkout version associated with this versioned item.
-
Field Details
-
UNKNOWN_FILE_TYPE
static final int UNKNOWN_FILE_TYPEUnderlying file is an unknown/unsupported type.- See Also:
-
DATABASE_FILE_TYPE
static final int DATABASE_FILE_TYPEUnderlying file is a Database- See Also:
-
DATAFILE_FILE_TYPE
static final int DATAFILE_FILE_TYPEUnderlying file is serialized data file- See Also:
-
DEFAULT_CHECKOUT_ID
static final long DEFAULT_CHECKOUT_IDDefault checkout ID used when a checkout is not applicable.- See Also:
-
LATEST_VERSION
static final int LATEST_VERSIONDefault file version number used to indicate the latest/current version.- See Also:
-
-
Method Details
-
getName
String getName()Return The display name for this item. -
getFileID
String getFileID()Return the file ID if one has been established or null -
resetFileID
Assign a new file-ID to this local non-versioned file. NOTE: This method is only valid for a local non-versioned file-system.- Returns:
- new file-ID
- Throws:
IOException
- thrown if IO or access error occurs
-
length
Returns the length of this domain file. This size is the minimum disk space used for storing this file, but does not account for additional storage space used to tracks changes, etc.- Returns:
- file length
- Throws:
IOException
- thrown if IO or access error occurs
-
getContentType
String getContentType()Return The content type name for this item. -
getParentPath
String getParentPath()Returns the path of the parent folder. -
getPathName
String getPathName()Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item. -
isReadOnly
boolean isReadOnly()Returns true if item can be overwritten/deleted. -
setReadOnly
Set the state of the read-only indicator for this non-shared item.- Parameters:
state
- read-only state- Throws:
IOException
- if an IO error occurs or item is stored on a shared file-system
-
getContentTypeVersion
int getContentTypeVersion()Returns 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. -
setContentTypeVersion
Sets the version for the content type. This will change whenever the domain objects are upgraded.- 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
-
lastModified
long lastModified()Return The time that this item was last modified. -
getCurrentVersion
int getCurrentVersion()Return the latest/current version. -
isCheckedOut
boolean isCheckedOut()Returns true if this item is a checked-out copy from a versioned file system. -
isCheckedOutExclusive
boolean isCheckedOutExclusive()Returns true if this item is a checked-out copy with exclusive access from a versioned file system. -
isVersioned
Return true if this is a versioned item, else false- Throws:
IOException
- thrown if an IO error occurs.
-
getCheckoutId
Returns 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.- Throws:
IOException
- if an IO error occurs
-
getCheckoutVersion
Returns 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.- Throws:
IOException
-
getLocalCheckoutVersion
int getLocalCheckoutVersion()Returns 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. -
setCheckout
void setCheckout(long checkoutId, boolean exclusive, int checkoutVersion, int localVersion) throws IOException Set the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- 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
Clears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- Throws:
IOException
-
delete
Deletes the item or a specific version. If a specific version is specified, it must either be the oldest or latest (i.e., current).- 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.
-
getVersions
Returns list of all available versions or null if item is not versioned.- Throws:
IOException
- thrown if an IO error occurs.
-
checkout
ItemCheckoutStatus checkout(CheckoutType checkoutType, String user, String projectPath) throws IOException Checkout this folder item.- 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
Terminates a checkout. The checkout ID becomes invalid, therefore the associated checkout copy should either be removed or converted to a private file.- 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
-
hasCheckouts
Returns true if this item is versioned and has one or more checkouts.- Throws:
IOException
- if an IO error occurs
-
canRecover
boolean canRecover()Returns true if unsaved file changes can be recovered. -
getCheckout
Get the checkout status which corresponds to the specified checkout ID.- 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
Get all current checkouts for this item.- Returns:
- array of checkouts
- Throws:
IOException
- if an IO error occurs or this item is not versioned
-
isCheckinActive
Returns true if this item is versioned and has a checkin in-progress.- Throws:
IOException
- if an IO error occurs
-
updateCheckoutVersion
Update the checkout version associated with this versioned item.- Parameters:
checkoutId
- id corresponding to an existing checkoutcheckoutVersion
-user
-- Throws:
IOException
- if an IO error occurs.
-
output
void output(File outputFile, int version, TaskMonitor monitor) throws IOException, CancelledException Serialize (i.e., pack) this item into the specified outputFile.- Parameters:
outputFile
- packed output file to be createdversion
- if this item is versioned, specifies the version to be output, otherwise -1 should be specified.monitor
- progress monitor- Throws:
IOException
CancelledException
- if monitor cancels operation
-
refresh
Returns this instance after refresh or null if item no longer exists- Throws:
IOException
-