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
ConstructorsConstructorDescriptionRepositoryAdapter(RepositoryServerAdapter serverAdapter, String name) Construct. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(RemoteAdapterListener listener) Add a listener to this remote adapterbooleancheckout(String folderPath, String itemName, CheckoutType checkoutType, String projectPath) voidconnect()Attempt to connect to the server.voidconnectionStateChanged(Object adapter) Notification callback when server connection state changes.createDatabase(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath) voidcreateDataFile(String parentPath, String itemName) voiddeleteItem(String parentPath, String itemName, int version) voidbooleanfileExists(String folderPath, String itemName) booleanfolderExists(String folderPath) getCheckout(String parentPath, String itemName, long checkoutId) getCheckouts(String parentPath, String itemName) intgetItemList(String folderPath) longgetName()Returns repository nameintReturns 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) booleanReturns true if connection recently was lost unexpectedlybooleanhasCheckouts(String parentPath, String itemName) booleanisCheckinActive(String parentPath, String itemName) booleanReturns true if connected.voidmoveFolder(String oldParentPath, String newParentPath, String oldFolderName, String newFolderName) voidopenDatabase(String parentPath, String itemName, int version, int minChangeDataVer) openDatabase(String parentPath, String itemName, long checkoutId) openDataFile(String parentPath, String itemName, int version) voidremoveListener(RemoteAdapterListener listener) Remove a listener from this remote adaptervoidsetFileSystemListener(FileSystemListener fsListener) Set the file system listener associated with the remote repository.voidsetUserList(User[] users, boolean anonymousAccessAllowed) Set the list of authorized users for this repository.voidterminateCheckout(String folderPath, String itemName, long checkoutId, boolean notify) toString()voidupdateCheckoutVersion(String parentPath, String itemName, long checkoutId, int checkoutVersion) booleanVerify 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:
connectionStateChangedin 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:
IOExceptionUserAccessException- 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:
IOExceptionUserAccessException- 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:
UserAccessExceptionIOExceptionNotConnectedException- 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:
IOExceptionInvalidNameException- 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:
InvalidNameExceptionIOException
-
moveItem
public void moveItem(String oldParentPath, String newParentPath, String oldItemName, String newItemName) throws InvalidNameException, IOException - Throws:
InvalidNameExceptionIOException
-
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()
-