Class IRODSConnection
java.lang.Object
org.irods.irods4j.high_level.connection.IRODSConnection
- All Implemented Interfaces:
AutoCloseable
A class designed to ease the management of a connection to an iRODS server.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a newly created iRODS connection using default connection options.Initializes a newly created iRODS connection using custom connection options. -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(String authScheme, String password) Performs authentication.voidclose()Enables try-with-resources pattern.voidconnect()Reconnects to an iRODS server using existing connection information.voidconnect(String host, int port, QualifiedUsername clientUser) Connects to an iRODS server.voidconnect(String host, int port, QualifiedUsername proxyUser, QualifiedUsername clientUser) Connects to an iRODS server.voidDisconnects from an iRODS server.Returns a handle to the underlyingIRODSApi.RcComm.booleanReturnstrueif the connection is active.release()Returns the underlying handle and releases ownership.
-
Constructor Details
-
IRODSConnection
public IRODSConnection()Initializes a newly created iRODS connection using default connection options. SeeIRODSApi.ConnectionOptionsfor details regarding the default connection options. No connection is established at this time.- Since:
- 0.1.0
-
IRODSConnection
Initializes a newly created iRODS connection using custom connection options. No connection is established at this time.- Since:
- 0.1.0
-
-
Method Details
-
connect
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 ofconnectis 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
Reconnects to an iRODS server using existing connection information. This method is only useful following a call todisconnect. Invoking this method beforeconnectis 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
Performs authentication.- Parameters:
authScheme- The authentication scheme 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()Returnstrueif the connection is active.- Since:
- 0.1.0
-
getRcComm
Returns a handle to the underlyingIRODSApi.RcComm.- Throws:
IllegalStateException- If no connection has been established with the server.- Since:
- 0.1.0
-
release
Returns the underlying handle and releases ownership.getRcCommwill throw an exception following this call.- Since:
- 0.1.0
-
disconnect
Disconnects from an iRODS server. Use of the class instance- Throws:
IOException- If a network error occurs.- Since:
- 0.1.0
-
close
Enables try-with-resources pattern. Preferdisconnect.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- Since:
- 0.1.0
-