Package ghidra.framework.client

# Class RepositoryAdapter

java.lang.Object
ghidra.framework.client.RepositoryAdapter

All Implemented Interfaces:
  `RemoteAdapterListener`

public class RepositoryAdapter extends Object implements 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

  Constructors
  Constructor
  Description
  `RepositoryAdapter(RepositoryServerAdapter serverAdapter, String name)`
  Construct.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addListener(RemoteAdapterListener listener)`
  Add a listener to this remote adapter
  `boolean`
  `anonymousAccessAllowed()`
  `ItemCheckoutStatus`
  `checkout(String folderPath, String itemName, CheckoutType checkoutType, String projectPath)`
  `void`
  `connect()`
  Attempt to connect to the server.
  `void`
  `connectionStateChanged(Object adapter)`
  Notification callback when server connection state changes.
  `ManagedBufferFileAdapter`
  `createDatabase(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath)`
  `void`
  `createDataFile(String parentPath, String itemName)`
  `void`
  `deleteItem(String parentPath, String itemName, int version)`
  `void`
  `disconnect()`
  `boolean`
  `fileExists(String folderPath, String itemName)`
  `boolean`
  `folderExists(String folderPath)`
  `ItemCheckoutStatus`
  `getCheckout(String parentPath, String itemName, long checkoutId)`
  `ItemCheckoutStatus[]`
  `getCheckouts(String parentPath, String itemName)`
  `RepositoryItem`
  `getItem(String fileID)`
  `RepositoryItem`
  `getItem(String folderPath, String itemName)`
  `int`
  `getItemCount()`
  `RepositoryItem[]`
  `getItemList(String folderPath)`
  `long`
  `getLength(String parentPath, String itemName)`
  `String`
  `getName()`
  Returns repository name
  `int`
  `getOpenFileHandleCount()`
  `RepositoryServerAdapter`
  `getServer()`
  Returns server adapter
  `ServerInfo`
  `getServerInfo()`
  Returns server information
  `String[]`
  `getServerUserList()`
  Returns list of all users known to server.
  `String[]`
  `getSubfolderList(String folderPath)`
  `User`
  `getUser()`
  Returns repository user object.
  `User[]`
  `getUserList()`
  Returns list of repository users.
  `Version[]`
  `getVersions(String parentPath, String itemName)`
  `boolean`
  `hadUnexpectedDisconnect()`
  Returns true if connection recently was lost unexpectedly
  `boolean`
  `hasCheckouts(String parentPath, String itemName)`
  `boolean`
  `isCheckinActive(String parentPath, String itemName)`
  `boolean`
  `isConnected()`
  Returns true if connected.
  `void`
  `moveFolder(String oldParentPath, String newParentPath, String oldFolderName, String newFolderName)`
  `void`
  `moveItem(String oldParentPath, String newParentPath, String oldItemName, String newItemName)`
  `ManagedBufferFileAdapter`
  `openDatabase(String parentPath, String itemName, int version, int minChangeDataVer)`
  `ManagedBufferFileAdapter`
  `openDatabase(String parentPath, String itemName, long checkoutId)`
  `DataFileHandle`
  `openDataFile(String parentPath, String itemName, int version)`
  `void`
  `removeListener(RemoteAdapterListener listener)`
  Remove a listener from this remote adapter
  `void`
  `setFileSystemListener(FileSystemListener fsListener)`
  Set the file system listener associated with the remote repository.
  `void`
  `setUserList(User[] users, boolean anonymousAccessAllowed)`
  Set the list of authorized users for this repository.
  `void`
  `terminateCheckout(String folderPath, String itemName, long checkoutId, boolean notify)`
  `String`
  `toString()`
  `void`
  `updateCheckoutVersion(String parentPath, String itemName, long checkoutId, int checkoutVersion)`
  `boolean`
  `verifyConnection()`
  Verify that the connection is still valid.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### RepositoryAdapter

    public RepositoryAdapter(RepositoryServerAdapter serverAdapter, String name)
    Construct.
    Parameters:
      `serverAdapter` - persistent server adapter
      `name` - repository name

- ## Method Details

  - ### hadUnexpectedDisconnect

    public boolean hadUnexpectedDisconnect()
    Returns true if connection recently was lost unexpectedly

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### setFileSystemListener

    public void setFileSystemListener(FileSystemListener fsListener)
    Set the file system listener associated with the remote repository.
    Parameters:
      `fsListener` - file system listener

  - ### 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` -

  - ### connectionStateChanged

    public void connectionStateChanged(Object adapter)
    Notification callback when server connection state changes.
    Specified by:
      `connectionStateChanged` in interface `RemoteAdapterListener`
    Parameters:
      `adapter` - remote interface adapter (e.g., RepositoryServerAdapter).
    See Also:
      - `RemoteAdapterListener.connectionStateChanged(java.lang.Object)`

  - ### isConnected

    public boolean isConnected()
    Returns true if connected.

  - ### connect

    public void connect() throws RepositoryNotFoundException, IOException
    Attempt to connect to the server.
    Throws:
      `RepositoryNotFoundException` - if named repository does not exist
      `IOException` - if IO error occurs

  - ### getName

    public String getName()
    Returns repository name

  - ### getServer

    public RepositoryServerAdapter getServer()
    Returns server adapter

  - ### getServerInfo

    public ServerInfo getServerInfo()
    Returns server information

  - ### getUser

    public User getUser() throws IOException
    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:
      - `RemoteRepositoryHandle.getUser()`

  - ### anonymousAccessAllowed

    public boolean anonymousAccessAllowed() throws IOException
    Returns:
      true if anonymous access allowed by this repository
    Throws:
      `IOException`

  - ### getUserList

    public User[] getUserList() throws IOException
    Returns list of repository users.
    Throws:
      `IOException`
      `UserAccessException` - user no longer has any permission to use repository.
      `NotConnectedException` - if server/repository connection is down (user already informed)
    See Also:
      - `RemoteRepositoryHandle.getUserList()`

  - ### getServerUserList

    public String[] getServerUserList() throws IOException
    Returns list of all users known to server.
    Throws:
      `IOException`
      `UserAccessException` - user no longer has any permission to use repository.
      `NotConnectedException` - if server/repository connection is down (user already informed)
    See Also:
      - `RemoteRepositoryHandle.getServerUserList()`

  - ### setUserList

    public void setUserList(User[] users, boolean anonymousAccessAllowed) throws IOException
    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`
      `IOException`
      `NotConnectedException` - if server/repository connection is down (user already informed)
    See Also:
      - `RemoteRepositoryHandle.setUserList(User[], boolean)`

  - ### createDatabase

    public ManagedBufferFileAdapter createDatabase(String parentPath, String itemName, int bufferSize, String contentType, String fileID, String projectPath) throws IOException, InvalidNameException
    Throws:
      `IOException`
      `InvalidNameException`
    See Also:
      - `RepositoryHandle.createDatabase(String, String, String, int, String, String)`

  - ### 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

    public void createDataFile(String parentPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### openDataFile

    public DataFileHandle openDataFile(String parentPath, String itemName, int version) throws IOException
    Throws:
      `IOException`

  - ### getSubfolderList

    public String[] getSubfolderList(String folderPath) throws IOException
    Throws:
      `IOException`

  - ### getItemCount

    public int getItemCount() throws IOException
    Throws:
      `IOException`

  - ### getItemList

    public RepositoryItem[] getItemList(String folderPath) throws IOException
    Throws:
      `IOException`

  - ### getItem

    public RepositoryItem getItem(String folderPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### getItem

    public RepositoryItem getItem(String fileID) throws IOException
    Throws:
      `IOException`

  - ### getVersions

    public Version[] getVersions(String parentPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### deleteItem

    public void deleteItem(String parentPath, String itemName, int version) throws IOException
    Throws:
      `IOException`

  - ### moveFolder

    public void moveFolder(String oldParentPath, String newParentPath, String oldFolderName, String newFolderName) throws InvalidNameException, IOException
    Throws:
      `InvalidNameException`
      `IOException`

  - ### moveItem

    public void moveItem(String oldParentPath, String newParentPath, String oldItemName, String newItemName) throws InvalidNameException, IOException
    Throws:
      `InvalidNameException`
      `IOException`

  - ### 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

    public ItemCheckoutStatus[] getCheckouts(String parentPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### folderExists

    public boolean folderExists(String folderPath) throws IOException
    Throws:
      `IOException`

  - ### fileExists

    public boolean fileExists(String folderPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### getLength

    public long getLength(String parentPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### hasCheckouts

    public boolean hasCheckouts(String parentPath, String itemName) throws IOException
    Throws:
      `IOException`

  - ### isCheckinActive

    public boolean isCheckinActive(String parentPath, String itemName) throws IOException
    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()