Communication with a RAD instance is provided through the Connection class. There are various factory interfaces to get different types of connections to a RAD instance. Each mechanism returns a Connection instance which provides a standard interface to interact with RAD. The connection can be closed with the close() method.
Implicit authentication is performed against your user id and most RAD tasks you request with this connection are performed with the privileges available to your user account.
Example 3-15 Creating a Local Connectionimport com.oracle.solaris.rad.connect.Connection; Connection con = Connection.connectUnix(); //do something with con
When connecting to a remote instance, there is no implicit authentication, so the connection is not useful until authentication is performed. The com.oracle.solaris.rad.client package provides a utility class (RadPamHandler) which may be used to perform a PAM login. If you supply a locale, username and password, authentication proceeds in a non-interactive fashion. If locale is null, then "C" is used.
Here is an example for Remote Connection to a TCP instance on port 7777
Example 3-16 Remote Connection to a TCP instance on port 7777import com.oracle.solaris.rad.client.RadPamHandler; import com.oracle.solaris.rad.connect.Connection; Connection con = Connection.connectTCP("henry", 7777); System.out.println("Connected: " + con.toString()); RadPamHandler hdl = new RadPamHandler(con); hdl.login("C", "user", "password"); // First argument is locale con.close();