Class IRODSConnection

java.lang.Object
org.irods.irods4j.high_level.connection.IRODSConnection
All Implemented Interfaces:
AutoCloseable

public class IRODSConnection extends Object implements AutoCloseable
A class designed to ease the management of a connection to an iRODS server.
Since:
0.1.0
  • Constructor Details

    • IRODSConnection

      public IRODSConnection()
      Initializes a newly created iRODS connection using default connection options. See IRODSApi.ConnectionOptions for details regarding the default connection options. No connection is established at this time.
      Since:
      0.1.0
    • IRODSConnection

      public IRODSConnection(IRODSApi.ConnectionOptions options)
      Initializes a newly created iRODS connection using custom connection options. No connection is established at this time.
      Since:
      0.1.0
  • Method Details

    • connect

      public void connect(String host, int port, QualifiedUsername clientUser) throws Exception
      Connects to an iRODS server. This operation only establishes a connection. No authentication is performed.
      Parameters:
      host - The hostname or IP address of the iRODS server.
      port - The port number of the iRODS server.
      clientUser - The iRODS user to connect as.
      Throws:
      IllegalArgumentException - If any of the constructor requirements is violated.
      IRODSException - If the iRODS server experiences an error.
      Exception
      Since:
      0.1.0
    • connect

      public void connect(String host, int port, QualifiedUsername proxyUser, QualifiedUsername clientUser) throws Exception
      Connects to an iRODS server. The connection will represent a proxied connection. The proxy user provides the connection to the server. All API operations honor the permissions of the client user. This form of connect is most useful in situations where rodsadmin credentials are available and the application is presenting as a server. This operation only establishes a connection. No authentication is performed.
      Parameters:
      host - The hostname or IP address of the iRODS server.
      port - The port number of the iRODS server.
      proxyUser - The iRODS user acting as the proxy.
      clientUser - The iRODS user being proxied.
      Throws:
      IllegalArgumentException - If any of the constructor requirements is violated.
      IRODSException - If the iRODS server experiences an error.
      Exception
      Since:
      0.1.0
    • connect

      public void connect() throws Exception
      Reconnects to an iRODS server using existing connection information. This method is only useful following a call to disconnect. Invoking this method before connect is undefined.
      Throws:
      IllegalArgumentException - If any of the requirements is violated.
      IRODSException - If the iRODS server experiences an error.
      Exception - If an error occurs.
      Since:
      0.1.0
    • authenticate

      public void authenticate(AuthPlugin authPlugin, String password) throws Exception
      Performs authentication.
      Parameters:
      authPlugin - The authentication plugin to use.
      password - The password of the proxy user (if defined), or the client user.
      Throws:
      Exception - If an error occurs.
      Since:
      0.1.0
    • isConnected

      public boolean isConnected()
      Returns true if the connection is active.
      Since:
      0.1.0
    • getRcComm

      public IRODSApi.RcComm getRcComm()
      Returns a handle to the underlying IRODSApi.RcComm.
      Throws:
      IllegalStateException - If no connection has been established with the server.
      Since:
      0.1.0
    • release

      public IRODSApi.RcComm release()
      Returns the underlying handle and releases ownership. getRcComm will throw an exception following this call.
      Since:
      0.1.0
    • disconnect

      public void disconnect() throws IOException
      Disconnects from an iRODS server. Use of the class instance
      Throws:
      IOException - If a network error occurs.
      Since:
      0.1.0
    • close

      public void close() throws Exception
      Enables try-with-resources pattern. Prefer disconnect.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
      Since:
      0.1.0