Class RepositoryAdapter

  • All Implemented Interfaces:
    RemoteAdapterListener

    public class RepositoryAdapter
    extends java.lang.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 Detail

      • RepositoryAdapter

        public RepositoryAdapter​(RepositoryServerAdapter serverAdapter,
                                 java.lang.String name)
        Construct.
        Parameters:
        serverAdapter - persistent server adapter
        name - repository name
    • Method Detail

      • hadUnexpectedDisconnect

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.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 -
      • isConnected

        public boolean isConnected()
        Returns true if connected.
      • connect

        public void connect()
                     throws java.io.IOException
        Attempt to connect to the server.
        Throws:
        java.io.IOException
      • getName

        public java.lang.String getName()
        Returns repository name
      • getServerInfo

        public ServerInfo getServerInfo()
        Returns server information
      • anonymousAccessAllowed

        public boolean anonymousAccessAllowed()
                                       throws java.io.IOException
        Returns:
        true if anonymous access allowed by this repository
        Throws:
        java.io.IOException
      • setUserList

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

        public ManagedBufferFileAdapter openDatabase​(java.lang.String parentPath,
                                                     java.lang.String itemName,
                                                     int version,
                                                     int minChangeDataVer)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • openDatabase

        public ManagedBufferFileAdapter openDatabase​(java.lang.String parentPath,
                                                     java.lang.String itemName,
                                                     long checkoutId)
                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • createDataFile

        public void createDataFile​(java.lang.String parentPath,
                                   java.lang.String itemName)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • openDataFile

        public DataFileHandle openDataFile​(java.lang.String parentPath,
                                           java.lang.String itemName,
                                           int version)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • getSubfolderList

        public java.lang.String[] getSubfolderList​(java.lang.String folderPath)
                                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getItemCount

        public int getItemCount()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getItemList

        public RepositoryItem[] getItemList​(java.lang.String folderPath)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getItem

        public RepositoryItem getItem​(java.lang.String folderPath,
                                      java.lang.String itemName)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getItem

        public RepositoryItem getItem​(java.lang.String fileID)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getVersions

        public Version[] getVersions​(java.lang.String parentPath,
                                     java.lang.String itemName)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • deleteItem

        public void deleteItem​(java.lang.String parentPath,
                               java.lang.String itemName,
                               int version)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • moveFolder

        public void moveFolder​(java.lang.String oldParentPath,
                               java.lang.String newParentPath,
                               java.lang.String oldFolderName,
                               java.lang.String newFolderName)
                        throws InvalidNameException,
                               java.io.IOException
        Throws:
        InvalidNameException
        java.io.IOException
      • moveItem

        public void moveItem​(java.lang.String oldParentPath,
                             java.lang.String newParentPath,
                             java.lang.String oldItemName,
                             java.lang.String newItemName)
                      throws InvalidNameException,
                             java.io.IOException
        Throws:
        InvalidNameException
        java.io.IOException
      • checkout

        public ItemCheckoutStatus checkout​(java.lang.String folderPath,
                                           java.lang.String itemName,
                                           CheckoutType checkoutType,
                                           java.lang.String projectPath)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • terminateCheckout

        public void terminateCheckout​(java.lang.String folderPath,
                                      java.lang.String itemName,
                                      long checkoutId,
                                      boolean notify)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • getCheckout

        public ItemCheckoutStatus getCheckout​(java.lang.String parentPath,
                                              java.lang.String itemName,
                                              long checkoutId)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • getCheckouts

        public ItemCheckoutStatus[] getCheckouts​(java.lang.String parentPath,
                                                 java.lang.String itemName)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • folderExists

        public boolean folderExists​(java.lang.String folderPath)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • fileExists

        public boolean fileExists​(java.lang.String folderPath,
                                  java.lang.String itemName)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getLength

        public long getLength​(java.lang.String parentPath,
                              java.lang.String itemName)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • hasCheckouts

        public boolean hasCheckouts​(java.lang.String parentPath,
                                    java.lang.String itemName)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • isCheckinActive

        public boolean isCheckinActive​(java.lang.String parentPath,
                                       java.lang.String itemName)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • updateCheckoutVersion

        public void updateCheckoutVersion​(java.lang.String parentPath,
                                          java.lang.String itemName,
                                          long checkoutId,
                                          int checkoutVersion)
                                   throws java.io.IOException
        Throws:
        java.io.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()