Package ghidra.framework.client
Class RepositoryServerAdapter
- java.lang.Object
-
- ghidra.framework.client.RepositoryServerAdapter
-
public class RepositoryServerAdapter extends java.lang.Object
RepositoryServerAdapter
provides a persistent wrapper for aRepositoryServerHandle
which may become invalid if the remote connection were to fail.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RepositoryServerAdapter(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 void
addListener(RemoteAdapterListener listener)
Add a listener to this remote adapterboolean
anonymousAccessAllowed()
boolean
canSetPassword()
Returns true if this server allows the user to change their password.boolean
connect()
Attempt to connect or re-connect to the server.RepositoryAdapter
createRepository(java.lang.String name)
Create a new repository on the server.void
deleteRepository(java.lang.String name)
Delete a repository.void
disconnect()
Force disconnect with serverjava.lang.String[]
getAllUsers()
Returns a list of all known users.RepositoryAdapter
getRepository(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.ServerInfo
getServerInfo()
Returns server information.java.lang.String
getUser()
Returns user's server login identityboolean
isCancelled()
Returns true if the connection was cancelled by the user.boolean
isConnected()
Returns true if connected.boolean
isReadOnly()
void
removeListener(RemoteAdapterListener listener)
Remove a listener from this remote adapterboolean
setPassword(char[] saltedSHA256PasswordHash)
Set the simple password for the user.java.lang.String
toString()
-
-
-
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:
toString
in 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 NotConnectedException
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(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:
DuplicateNameException
UserAccessException
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
ghidra.framework.remote.RemoteRepositoryServerHandle#createRepository(java.lang.String, long)
-
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, NotConnectedException
Delete a repository.- Parameters:
name
- repository name.- Throws:
UserAccessException
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.deleteRepository(java.lang.String)
-
getRepositoryNames
public java.lang.String[] getRepositoryNames() throws java.io.IOException, NotConnectedException
Returns a list of all repository names defined to the server.- Throws:
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.getRepositoryNames()
-
anonymousAccessAllowed
public boolean anonymousAccessAllowed() throws java.io.IOException, NotConnectedException
- Throws:
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.anonymousAccessAllowed()
-
isReadOnly
public boolean isReadOnly() throws java.io.IOException, NotConnectedException
- Throws:
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.isReadOnly()
-
getUser
public java.lang.String getUser()
Returns user's server login identity
-
getAllUsers
public java.lang.String[] getAllUsers() throws java.io.IOException, NotConnectedException
Returns a list of all known users.- Throws:
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.getAllUsers()
-
setPassword
public boolean setPassword(char[] saltedSHA256PasswordHash) throws java.io.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:
java.io.IOException
- if user data can't be written to fileNotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.setPassword(char[])
-
canSetPassword
public boolean canSetPassword()
Returns true if this server allows the user to change their password.- Throws:
java.io.IOException
NotConnectedException
- if server connection is down (user already informed)- See Also:
RepositoryServerHandle.canSetPassword()
-
getServerInfo
public ServerInfo getServerInfo()
Returns server information. May be null if using fixed RepositoryServerHandle.
-
disconnect
public void disconnect()
Force disconnect with server
-
-