Package ghidra.framework.store
Interface FolderItem
-
- All Known Subinterfaces:
DatabaseItem,DataFileItem
- All Known Implementing Classes:
LocalDatabaseItem,LocalDataFile,LocalFolderItem,RemoteDatabaseItem,RemoteFolderItem,UnknownFolderItem
public interface FolderItemFolderItemrepresents an individual file contained within a FileSystem and is uniquely identified by a path string.
-
-
Field Summary
Fields Modifier and Type Field Description static intDATABASE_FILE_TYPEUnderlying file is a Databasestatic intDATAFILE_FILE_TYPEUnderlying file is serialized data filestatic longDEFAULT_CHECKOUT_IDDefault checkout ID used when a checkout is not applicable.static intLATEST_VERSIONDefault file version number used to indicate the latest/current version.static intUNKNOWN_FILE_TYPEUnderlying file is an unknown/unsupported type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanRecover()Returns true if unsaved file changes can be recovered.ItemCheckoutStatuscheckout(CheckoutType checkoutType, java.lang.String user, java.lang.String projectPath)Checkout this folder item.voidclearCheckout()Clears the checkout data associated with this non-shared file.voiddelete(int version, java.lang.String user)Deletes the item or a specific version.ItemCheckoutStatusgetCheckout(long checkoutId)Get the checkout status which corresponds to the specified checkout ID.longgetCheckoutId()Returns the checkoutId for this file.ItemCheckoutStatus[]getCheckouts()Get all current checkouts for this item.intgetCheckoutVersion()Returns the item version which was checked-out.java.lang.StringgetContentType()Return The content type name for this item.intgetContentTypeVersion()Returns the version of content type.intgetCurrentVersion()Return the latest/current version.java.lang.StringgetFileID()Return the file ID if one has been established or nullintgetLocalCheckoutVersion()Returns the local item version at the time the checkout was completed.java.lang.StringgetName()Return The display name for this item.java.lang.StringgetParentPath()Returns the path of the parent folder.java.lang.StringgetPathName()Return The concatenation of the pathname and the basename which can be used to uniquely identify a folder item.Version[]getVersions()Returns list of all available versions or null if item is not versioned.booleanhasCheckouts()Returns true if this item is versioned and has one or more checkouts.booleanisCheckedOut()Returns true if this item is a checked-out copy from a versioned file system.booleanisCheckedOutExclusive()Returns true if this item is a checked-out copy with exclusive access from a versioned file system.booleanisCheckinActive()Returns true if this item is versioned and has a checkin in-progress.booleanisReadOnly()Returns true if item can be overwritten/deleted.booleanisVersioned()Return true if this is a versioned item, else falselonglastModified()Return The time that this item was last modified.longlength()Returns the length of this domain file.voidoutput(java.io.File outputFile, int version, TaskMonitor monitor)Serialize (i.e., pack) this item into the specified outputFile.FolderItemrefresh()Returns this instance after refresh or null if item no longer existsjava.lang.StringresetFileID()Assign 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.voidupdateCheckoutVersion(long checkoutId, int checkoutVersion, java.lang.String user)Update the checkout version associated with this versioned item.
-
-
-
Field Detail
-
UNKNOWN_FILE_TYPE
static final int UNKNOWN_FILE_TYPE
Underlying file is an unknown/unsupported type.- See Also:
- Constant Field Values
-
DATABASE_FILE_TYPE
static final int DATABASE_FILE_TYPE
Underlying file is a Database- See Also:
- Constant Field Values
-
DATAFILE_FILE_TYPE
static final int DATAFILE_FILE_TYPE
Underlying file is serialized data file- See Also:
- Constant Field Values
-
DEFAULT_CHECKOUT_ID
static final long DEFAULT_CHECKOUT_ID
Default checkout ID used when a checkout is not applicable.- See Also:
- Constant Field Values
-
LATEST_VERSION
static final int LATEST_VERSION
Default file version number used to indicate the latest/current version.- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
java.lang.String getName()
Return The display name for this item.
-
getFileID
java.lang.String getFileID() throws java.io.IOExceptionReturn the file ID if one has been established or null- Throws:
java.io.IOException- thrown if IO or access error occurs
-
resetFileID
java.lang.String resetFileID() throws java.io.IOExceptionAssign 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:
java.io.IOException- thrown if IO or access error occurs
-
length
long length() throws java.io.IOExceptionReturns 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:
java.io.IOException- thrown if IO or access error occurs
-
getContentType
java.lang.String getContentType()
Return The content type name for this item.
-
getParentPath
java.lang.String getParentPath()
Returns the path of the parent folder.
-
getPathName
java.lang.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
void setReadOnly(boolean state) throws java.io.IOExceptionSet the state of the read-only indicator for this non-shared item.- Parameters:
state- read-only state- Throws:
java.io.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
void setContentTypeVersion(int version) throws java.io.IOExceptionSets 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:
java.io.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
boolean isVersioned() throws java.io.IOExceptionReturn true if this is a versioned item, else false- Throws:
java.io.IOException- thrown if an IO error occurs.
-
getCheckoutId
long getCheckoutId() throws java.io.IOExceptionReturns 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:
java.io.IOException- if an IO error occurs
-
getCheckoutVersion
int getCheckoutVersion() throws java.io.IOExceptionReturns 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:
java.io.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 java.io.IOExceptionSet 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:
java.io.IOException- if an IO error occurs or item is stored on a shared file-system
-
clearCheckout
void clearCheckout() throws java.io.IOExceptionClears the checkout data associated with this non-shared file. NOTE: This method is only valid for a local non-versioned file-system.- Throws:
java.io.IOException
-
delete
void delete(int version, java.lang.String user) throws java.io.IOExceptionDeletes 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:
java.io.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
Version[] getVersions() throws java.io.IOException
Returns list of all available versions or null if item is not versioned.- Throws:
java.io.IOException- thrown if an IO error occurs.
-
checkout
ItemCheckoutStatus checkout(CheckoutType checkoutType, java.lang.String user, java.lang.String projectPath) throws java.io.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:
java.io.IOException- if an IO error occurs or this item is not versioned
-
terminateCheckout
void terminateCheckout(long checkoutId, boolean notify) throws java.io.IOExceptionTerminates 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:
java.io.IOException- if an IO error occurs or this item is not versioned
-
hasCheckouts
boolean hasCheckouts() throws java.io.IOExceptionReturns true if this item is versioned and has one or more checkouts.- Throws:
java.io.IOException- if an IO error occurs
-
canRecover
boolean canRecover()
Returns true if unsaved file changes can be recovered.
-
getCheckout
ItemCheckoutStatus getCheckout(long checkoutId) throws java.io.IOException
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:
java.io.IOException- if an IO error occurs or this item is not versioned
-
getCheckouts
ItemCheckoutStatus[] getCheckouts() throws java.io.IOException
Get all current checkouts for this item.- Returns:
- array of checkouts
- Throws:
java.io.IOException- if an IO error occurs or this item is not versioned
-
isCheckinActive
boolean isCheckinActive() throws java.io.IOExceptionReturns true if this item is versioned and has a checkin in-progress.- Throws:
java.io.IOException- if an IO error occurs
-
updateCheckoutVersion
void updateCheckoutVersion(long checkoutId, int checkoutVersion, java.lang.String user) throws java.io.IOExceptionUpdate the checkout version associated with this versioned item.- Parameters:
checkoutId- id corresponding to an existing checkoutcheckoutVersion-user-- Throws:
java.io.IOException- if an IO error occurs.
-
output
void output(java.io.File outputFile, int version, TaskMonitor monitor) throws java.io.IOException, CancelledExceptionSerialize (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:
java.io.IOExceptionCancelledException- if monitor cancels operation
-
refresh
FolderItem refresh() throws java.io.IOException
Returns this instance after refresh or null if item no longer exists- Throws:
java.io.IOException
-
-