author | hannesw |
Tue, 10 Sep 2019 15:30:23 +0200 | |
changeset 58071 | 8a066d872553 |
parent 55448 | 0f141453b9e0 |
permissions | -rw-r--r-- |
34338 | 1 |
/* |
55448
0f141453b9e0
8226518: Typo in the ConnectionBuilder javadoc examples
lancea
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
34338 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
package javax.sql; |
|
26 |
||
27 |
import java.sql.SQLException; |
|
28 |
import java.sql.ShardingKey; |
|
29 |
||
30 |
/** |
|
31 |
* A builder created from a {@code XADataSource} object, |
|
32 |
* used to establish a connection to the database that the |
|
33 |
* {@code data source} object represents. The connection |
|
34 |
* properties that were specified for the {@code data source} are used as the |
|
35 |
* default values by the {@code XAConnectionBuilder}. |
|
36 |
* <p>The following example illustrates the use of {@code XAConnectionBuilder} |
|
37 |
* to create a {@link XAConnection}: |
|
38 |
* |
|
39 |
* <pre>{@code |
|
35277 | 40 |
* XADataSource ds = new MyXADataSource(); |
34338 | 41 |
* ShardingKey superShardingKey = ds.createShardingKeyBuilder() |
42 |
* .subkey("EASTERN_REGION", JDBCType.VARCHAR) |
|
43 |
* .build(); |
|
44 |
* ShardingKey shardingKey = ds.createShardingKeyBuilder() |
|
45 |
* .subkey("PITTSBURGH_BRANCH", JDBCType.VARCHAR) |
|
46 |
* .build(); |
|
47 |
* XAConnection con = ds.createXAConnectionBuilder() |
|
48 |
* .user("rafa") |
|
49 |
* .password("tennis") |
|
55448
0f141453b9e0
8226518: Typo in the ConnectionBuilder javadoc examples
lancea
parents:
47216
diff
changeset
|
50 |
* .shardingKey(shardingKey) |
0f141453b9e0
8226518: Typo in the ConnectionBuilder javadoc examples
lancea
parents:
47216
diff
changeset
|
51 |
* .superShardingKey(superShardingKey) |
34338 | 52 |
* .build(); |
53 |
* }</pre> |
|
54 |
* |
|
35277 | 55 |
* @since 9 |
34338 | 56 |
* |
57 |
*/ |
|
58 |
public interface XAConnectionBuilder { |
|
59 |
||
60 |
/** |
|
61 |
* Specifies the username to be used when creating a connection |
|
62 |
* |
|
63 |
* @param username the database user on whose behalf the connection is being |
|
64 |
* made |
|
65 |
* @return the same {@code XAConnectionBuilder} instance |
|
66 |
*/ |
|
67 |
XAConnectionBuilder user(String username); |
|
68 |
||
69 |
/** |
|
70 |
* Specifies the password to be used when creating a connection |
|
71 |
* |
|
72 |
* @param password the password to use for this connection. May be {@code null} |
|
73 |
* @return the same {@code XAConnectionBuilder} instance |
|
74 |
*/ |
|
75 |
XAConnectionBuilder password(String password); |
|
76 |
||
77 |
/** |
|
78 |
* Specifies a {@code shardingKey} to be used when creating a connection |
|
79 |
* |
|
80 |
* @param shardingKey the ShardingKey. May be {@code null} |
|
81 |
* @return the same {@code XAConnectionBuilder} instance |
|
82 |
* @see java.sql.ShardingKey |
|
83 |
* @see java.sql.ShardingKeyBuilder |
|
84 |
*/ |
|
85 |
XAConnectionBuilder shardingKey(ShardingKey shardingKey); |
|
86 |
||
87 |
/** |
|
88 |
* Specifies a {@code superShardingKey} to be used when creating a connection |
|
89 |
* |
|
90 |
* @param superShardingKey the SuperShardingKey. May be {@code null} |
|
91 |
* @return the same {@code XAConnectionBuilder} instance |
|
92 |
* @see java.sql.ShardingKey |
|
93 |
* @see java.sql.ShardingKeyBuilder |
|
94 |
*/ |
|
95 |
XAConnectionBuilder superShardingKey(ShardingKey superShardingKey); |
|
96 |
||
97 |
/** |
|
98 |
* Returns an instance of the object defined by this builder. |
|
99 |
* |
|
100 |
* @return The built object |
|
101 |
* @throws java.sql.SQLException If an error occurs building the object |
|
102 |
*/ |
|
103 |
XAConnection build() throws SQLException; |
|
104 |
||
105 |
} |