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) voidcreateTextDataFile(String parentPath, String itemName, String fileID, String contentType, String textData, String comment) 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()Get the associated repository nameintGet the associated server adapterReturns associated server informationString[]Returns list of all user names known to server.String[]getSubfolderList(String folderPath) getUser()Returns repository connected user object.User[]Returns list of repository users with repository access permissionVersion[]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- 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.- Returns:
- true if connected.
-
connect
Attempt to connect to the server.- Throws:
RepositoryNotFoundException- if named repository does not existIOException- if IO error occurs
-
getName
Get the associated repository name- Returns:
- repository name
-
getServer
Get the associated server adapter- Returns:
- server adapter
-
getServerInfo
Returns associated server information- Returns:
- server information
-
getUser
Returns repository connected user object.- Returns:
- connected user object
- Throws:
UserAccessException- user no longer has any permission to use repository.NotConnectedException- if server/repository connection is down (user already informed)IOException- if an IO error occurs- See Also:
-
anonymousAccessAllowed
- Returns:
- true if anonymous access allowed by this repository
- Throws:
IOException- if an IO error occurs
-
getUserList
Returns list of repository users with repository access permission- Returns:
- return users with repository access permission
- Throws:
UserAccessException- user no longer has any permission to use repository.NotConnectedException- if server/repository connection is down (user already informed)IOException- if an IO error occurs- See Also:
-
getServerUserList
Returns list of all user names known to server.- Returns:
- list of all user names known to server.
- Throws:
UserAccessException- user no longer has any permission to use repository.NotConnectedException- if server/repository connection is down (user already informed)IOException- if an IO error occurs- 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- user is not a repository AdminIOException- if an IO error occursNotConnectedException- if server/repository connection is down (user already informed)- See Also:
-
createTextDataFile
public void createTextDataFile(String parentPath, String itemName, String fileID, String contentType, String textData, String comment) throws IOException, InvalidNameException - Throws:
IOExceptionInvalidNameException
-
createDatabase
public ManagedBufferFileAdapter createDatabase(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath) throws IOException, InvalidNameException - Throws:
IOExceptionInvalidNameException
-
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()
-