|
31 | 31 | import reactor.core.publisher.Mono; |
32 | 32 |
|
33 | 33 | import javax.sql.DataSource; |
| 34 | +import java.time.Duration; |
34 | 35 |
|
35 | 36 | /** |
36 | 37 | * <p> |
|
48 | 49 | * </p> |
49 | 50 | * <h3 id="required_options">Required Options</h3><p> |
50 | 51 | * This implementation requires the following options for connection creation: |
51 | | - * </p><ul> |
52 | | - * <li>{@link ConnectionFactoryOptions#DRIVER}</li> |
53 | | - * <li>{@link ConnectionFactoryOptions#HOST}</li> |
54 | | - * </ul> |
| 52 | + * </p><dl> |
| 53 | + * <dt>{@link ConnectionFactoryOptions#DRIVER}</dt> |
| 54 | + * <dd>Must have the value "oracle"</dd> |
| 55 | + * <dt>{@link ConnectionFactoryOptions#HOST}</dt> |
| 56 | + * <dd>IP address or hostname of an Oracle Database</dd> |
| 57 | + * </dl> |
55 | 58 | * <h3 id="supported_options">Supported Options</h3><p> |
56 | 59 | * This implementation supports the following options for connection creation: |
57 | | - * </p><ul> |
58 | | - * <li>{@link ConnectionFactoryOptions#PORT}</li> |
59 | | - * <li>{@link ConnectionFactoryOptions#DATABASE}</li> |
60 | | - * <li>{@link ConnectionFactoryOptions#USER}</li> |
61 | | - * <li>{@link ConnectionFactoryOptions#PASSWORD}</li> |
62 | | - * <li>{@link ConnectionFactoryOptions#CONNECT_TIMEOUT}</li> |
63 | | - * <li>{@link ConnectionFactoryOptions#SSL}</li> |
64 | | - * </ul><p> |
65 | | - * A value set for {@code CONNECT_TIMEOUT} will be rounded up to the nearest |
66 | | - * whole second. When a value is set, any connection request that exceeds the |
67 | | - * specified duration of seconds will automatically be cancelled. The |
68 | | - * cancellation will result in an {@code onError} signal delivering an |
69 | | - * {@link io.r2dbc.spi.R2dbcTimeoutException} to a connection {@code |
70 | | - * Subscriber}. |
71 | | - * </p><p> |
72 | | - * A value of {@code true} set for {@code SSL} will configure the Oracle |
73 | | - * JDBC Driver to connect using the TCPS protocol (ie: SSL/TLS). |
74 | | - * </p> |
| 60 | + * </p><dl> |
| 61 | + * <dt>{@link ConnectionFactoryOptions#PORT}</dt> |
| 62 | + * <dd>Port number of an Oracle Database</dd> |
| 63 | + * <dt>{@link ConnectionFactoryOptions#DATABASE}</dt> |
| 64 | + * <dd>Service name (not an SID) of an Oracle Database</dd> |
| 65 | + * <dt>{@link ConnectionFactoryOptions#USER}</dt> |
| 66 | + * <dd>Name of an Oracle Database user</dd> |
| 67 | + * <dt>{@link ConnectionFactoryOptions#PASSWORD}</dt> |
| 68 | + * <dd> |
| 69 | + * Password of an Oracle Database user. The value may be an instance |
| 70 | + * of a mutable {@link CharSequence}, such {@link java.nio.CharBuffer}, |
| 71 | + * that may be cleared after creating an instance of |
| 72 | + * {@code OracleConnectionFactoryImpl}. |
| 73 | + * </dd> |
| 74 | + * <dt>{@link ConnectionFactoryOptions#CONNECT_TIMEOUT}</dt> |
| 75 | + * <dd> |
| 76 | + * Maximum wait time when requesting a {@code Connection}. If the |
| 77 | + * duration expires, a {@code Connection} {@code Subscriber} receives |
| 78 | + * {@code onError} with an {@link io.r2dbc.spi.R2dbcTimeoutException}. |
| 79 | + * The duration is rounded up to the nearest whole second. The query |
| 80 | + * section of an R2DBC URL may provide a value in the format specified by |
| 81 | + * {@link Duration#parse(CharSequence)}. |
| 82 | + * </dd> |
| 83 | + * <dt>{@link ConnectionFactoryOptions#SSL}</dt> |
| 84 | + * <dd> |
| 85 | + * If set to {@code true}, the driver connects to Oracle Database using |
| 86 | + * TCPS (ie: SSL/TLS). |
| 87 | + * </dd> |
| 88 | + * </dl> |
75 | 89 | * |
76 | 90 | * @author harayuanwang, michael-a-mcmahon |
77 | 91 | * @since 0.1.0 |
@@ -121,14 +135,19 @@ final class OracleConnectionFactoryImpl implements ConnectionFactory { |
121 | 135 | * </p> |
122 | 136 | * |
123 | 137 | * @param options Options applied when opening a connection to a database. |
| 138 | + * |
124 | 139 | * @throws IllegalArgumentException If the value of a required option is |
125 | 140 | * null. |
| 141 | + * |
126 | 142 | * @throws IllegalStateException If the value of a required option is not |
127 | 143 | * specified. |
| 144 | + * |
| 145 | + * @throws IllegalArgumentException If the {@code oracle-net-descriptor} |
| 146 | + * {@code Option} is provided with any other options that might have |
| 147 | + * conflicting values, such as {@link ConnectionFactoryOptions#HOST}. |
128 | 148 | */ |
129 | 149 | OracleConnectionFactoryImpl(ConnectionFactoryOptions options) { |
130 | 150 | OracleR2dbcExceptions.requireNonNull(options, "options is null."); |
131 | | - |
132 | 151 | adapter = ReactiveJdbcAdapter.getOracleAdapter(); |
133 | 152 | dataSource = adapter.createDataSource(options); |
134 | 153 | } |
|
0 commit comments