Package ghidra.framework.client
Class RepositoryAdapter
java.lang.Object
ghidra.framework.client.RepositoryAdapter
- All Implemented Interfaces:
RemoteAdapterListener
RepositoryAdapter
provides a persistent wrapper for a remote RepositoryHandle
which may become invalid if the remote connection were to fail. Connection recovery is provided
by any method call which must communicate with the server.-
Constructor Summary
ConstructorDescriptionRepositoryAdapter
(RepositoryServerAdapter serverAdapter, String name) Construct. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(RemoteAdapterListener listener) Add a listener to this remote adapterboolean
checkout
(String folderPath, String itemName, CheckoutType checkoutType, String projectPath) void
connect()
Attempt to connect to the server.void
connectionStateChanged
(Object adapter) Notification callback when server connection state changes.createDatabase
(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath) void
createDataFile
(String parentPath, String itemName) void
deleteItem
(String parentPath, String itemName, int version) void
boolean
fileExists
(String folderPath, String itemName) boolean
folderExists
(String folderPath) getCheckout
(String parentPath, String itemName, long checkoutId) getCheckouts
(String parentPath, String itemName) int
getItemList
(String folderPath) long
getName()
Returns repository nameint
Returns server adapterReturns server informationString[]
Returns list of all users known to server.String[]
getSubfolderList
(String folderPath) getUser()
Returns repository user object.User[]
Returns list of repository users.Version[]
getVersions
(String parentPath, String itemName) boolean
Returns true if connection recently was lost unexpectedlyboolean
hasCheckouts
(String parentPath, String itemName) boolean
isCheckinActive
(String parentPath, String itemName) boolean
Returns true if connected.void
moveFolder
(String oldParentPath, String newParentPath, String oldFolderName, String newFolderName) void
openDatabase
(String parentPath, String itemName, int version, int minChangeDataVer) openDatabase
(String parentPath, String itemName, long checkoutId) openDataFile
(String parentPath, String itemName, int version) void
removeListener
(RemoteAdapterListener listener) Remove a listener from this remote adaptervoid
setFileSystemListener
(FileSystemListener fsListener) Set the file system listener associated with the remote repository.void
setUserList
(User[] users, boolean anonymousAccessAllowed) Set the list of authorized users for this repository.void
terminateCheckout
(String folderPath, String itemName, long checkoutId, boolean notify) toString()
void
updateCheckoutVersion
(String parentPath, String itemName, long checkoutId, int checkoutVersion) boolean
Verify that the connection is still valid.
-
Constructor Details
-
RepositoryAdapter
Construct.- Parameters:
serverAdapter
- persistent server adaptername
- repository name
-
-
Method Details
-
hadUnexpectedDisconnect
public boolean hadUnexpectedDisconnect()Returns true if connection recently was lost unexpectedly -
toString
-
setFileSystemListener
Set the file system listener associated with the remote repository.- Parameters:
fsListener
- file system listener
-
addListener
Add a listener to this remote adapter- Parameters:
listener
-
-
removeListener
Remove a listener from this remote adapter- Parameters:
listener
-
-
connectionStateChanged
Notification callback when server connection state changes.- Specified by:
connectionStateChanged
in interfaceRemoteAdapterListener
- Parameters:
adapter
- remote interface adapter (e.g., RepositoryServerAdapter).- See Also:
-
isConnected
public boolean isConnected()Returns true if connected. -
connect
Attempt to connect to the server.- Throws:
RepositoryNotFoundException
- if named repository does not existIOException
- if IO error occurs
-
getName
Returns repository name -
getServer
Returns server adapter -
getServerInfo
Returns server information -
getUser
Returns repository user object.- Throws:
UserAccessException
- user no longer has any permission to use repository.NotConnectedException
- if server/repository connection is down (user already informed)IOException
- See Also:
-
anonymousAccessAllowed
- Returns:
- true if anonymous access allowed by this repository
- Throws:
IOException
-
getUserList
Returns list of repository users.- Throws:
IOException
UserAccessException
- user no longer has any permission to use repository.NotConnectedException
- if server/repository connection is down (user already informed)- See Also:
-
getServerUserList
Returns list of all users known to server.- Throws:
IOException
UserAccessException
- user no longer has any permission to use repository.NotConnectedException
- if server/repository connection is down (user already informed)- See Also:
-
setUserList
Set the list of authorized users for this repository.- Parameters:
users
- list of user and access permissions.anonymousAccessAllowed
- true to permit anonymous access (also requires anonymous access to be enabled for server)- Throws:
UserAccessException
IOException
NotConnectedException
- if server/repository connection is down (user already informed)- See Also:
-
createDatabase
public ManagedBufferFileAdapter createDatabase(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath) throws IOException, InvalidNameException - Throws:
IOException
InvalidNameException
- See Also:
-
openDatabase
public ManagedBufferFileAdapter openDatabase(String parentPath, String itemName, int version, int minChangeDataVer) throws IOException - Throws:
IOException
-
openDatabase
public ManagedBufferFileAdapter openDatabase(String parentPath, String itemName, long checkoutId) throws IOException - Throws:
IOException
-
createDataFile
- Throws:
IOException
-
openDataFile
public DataFileHandle openDataFile(String parentPath, String itemName, int version) throws IOException - Throws:
IOException
-
getSubfolderList
- Throws:
IOException
-
getItemCount
- Throws:
IOException
-
getItemList
- Throws:
IOException
-
getItem
- Throws:
IOException
-
getItem
- Throws:
IOException
-
getVersions
- Throws:
IOException
-
deleteItem
- Throws:
IOException
-
moveFolder
public void moveFolder(String oldParentPath, String newParentPath, String oldFolderName, String newFolderName) throws InvalidNameException, IOException - Throws:
InvalidNameException
IOException
-
moveItem
public void moveItem(String oldParentPath, String newParentPath, String oldItemName, String newItemName) throws InvalidNameException, IOException - Throws:
InvalidNameException
IOException
-
checkout
public ItemCheckoutStatus checkout(String folderPath, String itemName, CheckoutType checkoutType, String projectPath) throws IOException - Throws:
IOException
-
terminateCheckout
public void terminateCheckout(String folderPath, String itemName, long checkoutId, boolean notify) throws IOException - Throws:
IOException
-
getCheckout
public ItemCheckoutStatus getCheckout(String parentPath, String itemName, long checkoutId) throws IOException - Throws:
IOException
-
getCheckouts
- Throws:
IOException
-
folderExists
- Throws:
IOException
-
fileExists
- Throws:
IOException
-
getLength
- Throws:
IOException
-
hasCheckouts
- Throws:
IOException
-
isCheckinActive
- Throws:
IOException
-
updateCheckoutVersion
public void updateCheckoutVersion(String parentPath, String itemName, long checkoutId, int checkoutVersion) throws IOException - Throws:
IOException
-
verifyConnection
public boolean verifyConnection()Verify that the connection is still valid.- Returns:
- true if the connection is valid; false if the connection needs to be reestablished
-
disconnect
public void disconnect() -
getOpenFileHandleCount
public int getOpenFileHandleCount()
-