Package ghidra.framework.client
Class RepositoryServerAdapter
- java.lang.Object
-
- ghidra.framework.client.RepositoryServerAdapter
-
public class RepositoryServerAdapter extends java.lang.ObjectRepositoryServerAdapterprovides a persistent wrapper for aRepositoryServerHandlewhich may become invalid if the remote connection were to fail.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRepositoryServerAdapter(RepositoryServerHandle serverHandle, java.lang.String serverInfoString)Construct a repository server interface adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(RemoteAdapterListener listener)Add a listener to this remote adapterbooleananonymousAccessAllowed()booleancanSetPassword()Returns true if this server allows the user to change their password.booleanconnect()Attempt to connect or re-connect to the server.RepositoryAdaptercreateRepository(java.lang.String name)Create a new repository on the server.voiddeleteRepository(java.lang.String name)Delete a repository.voiddisconnect()Force disconnect with serverjava.lang.String[]getAllUsers()Returns a list of all known users.RepositoryAdaptergetRepository(java.lang.String name)Get a handle to an existing repository.java.lang.String[]getRepositoryNames()Returns a list of all repository names defined to the server.ServerInfogetServerInfo()Returns server information.java.lang.StringgetUser()Returns user's server login identitybooleanisCancelled()Returns true if the connection was cancelled by the user.booleanisConnected()Returns true if connected.booleanisReadOnly()voidremoveListener(RemoteAdapterListener listener)Remove a listener from this remote adapterbooleansetPassword(char[] saltedSHA256PasswordHash)Set the simple password for the user.java.lang.StringtoString()
-
-
-
Constructor Detail
-
RepositoryServerAdapter
protected RepositoryServerAdapter(RepositoryServerHandle serverHandle, java.lang.String serverInfoString)
Construct a repository server interface adapter.- Parameters:
serverHandle- associated server handle (reconnect not supported)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
addListener
public void addListener(RemoteAdapterListener listener)
Add a listener to this remote adapter- Parameters:
listener-
-
removeListener
public void removeListener(RemoteAdapterListener listener)
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
-
isConnected
public boolean isConnected()
Returns true if connected.
-
connect
public boolean connect() throws NotConnectedExceptionAttempt 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(java.lang.String name) throws DuplicateNameException, UserAccessException, java.io.IOException, NotConnectedException
Create a new repository on the server.- Parameters:
name- repository name.- Returns:
- handle to new repository.
- Throws:
DuplicateNameExceptionUserAccessExceptionjava.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.createRepository(String)
-
getRepository
public RepositoryAdapter getRepository(java.lang.String name)
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(java.lang.String name) throws UserAccessException, java.io.IOException, NotConnectedExceptionDelete a repository.- Parameters:
name- repository name.- Throws:
UserAccessExceptionjava.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.deleteRepository(java.lang.String)
-
getRepositoryNames
public java.lang.String[] getRepositoryNames() throws java.io.IOException, NotConnectedExceptionReturns a list of all repository names defined to the server.- Throws:
java.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.getRepositoryNames()
-
anonymousAccessAllowed
public boolean anonymousAccessAllowed() throws java.io.IOException, NotConnectedException- Returns:
- true if server allows anonymous access. Individual repositories must grant anonymous access separately.
- Throws:
java.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.anonymousAccessAllowed()
-
isReadOnly
public boolean isReadOnly() throws java.io.IOException, NotConnectedException- Returns:
- true if user has restricted read-only access to server (e.g., anonymous user)
- Throws:
java.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.isReadOnly()
-
getUser
public java.lang.String getUser()
Returns user's server login identity
-
getAllUsers
public java.lang.String[] getAllUsers() throws java.io.IOException, NotConnectedExceptionReturns a list of all known users.- Throws:
java.io.IOExceptionNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.getAllUsers()
-
setPassword
public boolean setPassword(char[] saltedSHA256PasswordHash) throws java.io.IOException, NotConnectedExceptionSet the simple password for the user.- Parameters:
saltedSHA256PasswordHash- hex character representation of salted SHA256 hash of the password- Returns:
- true if password changed
- Throws:
java.io.IOException- if user data can't be written to fileNotConnectedException- if server connection is down (user already informed)- See Also:
RemoteRepositoryServerHandle.setPassword(char[]),HashUtilities.getSaltedHash("SHA-256", char[])
-
canSetPassword
public boolean canSetPassword()
Returns true if this server allows the user to change their password.
-
getServerInfo
public ServerInfo getServerInfo()
Returns server information. May be null if using fixed RepositoryServerHandle.
-
disconnect
public void disconnect()
Force disconnect with server
-
-