Package ghidra.framework.client
Class RepositoryServerAdapter
java.lang.Object
ghidra.framework.client.RepositoryServerAdapter
RepositoryServerAdapter
provides a persistent wrapper for a
RepositoryServerHandle
which may become invalid if the
remote connection were to fail.-
Constructor Summary
ModifierConstructorDescriptionprotected
RepositoryServerAdapter
(RepositoryServerHandle serverHandle, String serverInfoString) Construct a repository server interface adapter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(RemoteAdapterListener listener) Add a listener to this remote adapterboolean
boolean
Returns true if this server allows the user to change their password.boolean
connect()
Attempt to connect or re-connect to the server.createRepository
(String name) Create a new repository on the server.void
deleteRepository
(String name) Delete a repository.void
Force disconnect with serverString[]
Returns a list of all known users.Returns the last error associated with a failed connection attempt.getRepository
(String name) Get a handle to an existing repository.String[]
Returns a list of all repository names defined to the server.Returns server information.getUser()
Returns user's server login identityboolean
Returns true if the connection was cancelled by the user.boolean
Returns true if connected.boolean
void
removeListener
(RemoteAdapterListener listener) Remove a listener from this remote adapterboolean
setPassword
(char[] saltedSHA256PasswordHash) Set the simple password for the user.toString()
-
Constructor Details
-
RepositoryServerAdapter
Construct a repository server interface adapter.- Parameters:
serverHandle
- associated server handle (reconnect not supported)
-
-
Method Details
-
toString
-
addListener
Add a listener to this remote adapter- Parameters:
listener
-
-
removeListener
Remove a listener from this remote adapter- Parameters:
listener
-
-
isCancelled
public boolean isCancelled()Returns true if the connection was cancelled by the user.- Returns:
- try if cancelled by user
-
getLastConnectError
Returns the last error associated with a failed connection attempt.- Returns:
- last connect error or null
-
isConnected
public boolean isConnected()Returns true if connected. -
connect
Attempt to connect or re-connect to the server.- Returns:
- true if connect successful, false if cancelled by user
- Throws:
NotConnectedException
- if connect failed (error will be displayed to user)
-
createRepository
public RepositoryAdapter createRepository(String name) throws DuplicateNameException, UserAccessException, IOException, NotConnectedException Create a new repository on the server.- Parameters:
name
- repository name.- Returns:
- handle to new repository.
- Throws:
DuplicateNameException
UserAccessException
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
getRepository
Get a handle to an existing repository. The repository adapter is initially disconnected - the connect() method or another repository action method must be invoked to establish a repository connection.- Parameters:
name
- repository name.- Returns:
- repository handle or null if repository not found.
-
deleteRepository
public void deleteRepository(String name) throws UserAccessException, IOException, NotConnectedException Delete a repository.- Parameters:
name
- repository name.- Throws:
UserAccessException
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
getRepositoryNames
Returns a list of all repository names defined to the server.- Throws:
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
anonymousAccessAllowed
- Returns:
- true if server allows anonymous access. Individual repositories must grant anonymous access separately.
- Throws:
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
isReadOnly
- Returns:
- true if user has restricted read-only access to server (e.g., anonymous user)
- Throws:
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
getUser
Returns user's server login identity -
getAllUsers
Returns a list of all known users.- Throws:
IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
-
setPassword
public boolean setPassword(char[] saltedSHA256PasswordHash) throws IOException, NotConnectedException Set the simple password for the user.- Parameters:
saltedSHA256PasswordHash
- hex character representation of salted SHA256 hash of the password- Returns:
- true if password changed
- Throws:
IOException
- if user data can't be written to fileNotConnectedException
- if server connection is down (user already informed)- See Also:
-
canSetPassword
public boolean canSetPassword()Returns true if this server allows the user to change their password.- See Also:
-
getServerInfo
Returns server information. May be null if using fixed RepositoryServerHandle. -
disconnect
public void disconnect()Force disconnect with server
-