16
16
*/
17
17
package org .neo4j .driver .internal .adaptedbolt ;
18
18
19
- import java .time .Duration ;
20
- import java .util .Map ;
19
+ import java .util .List ;
21
20
import java .util .Objects ;
22
- import java .util .Set ;
23
21
import java .util .concurrent .CompletionStage ;
24
- import java .util .function .Supplier ;
25
- import org .neo4j .bolt .connection .AccessMode ;
26
22
import org .neo4j .bolt .connection .AuthInfo ;
27
- import org .neo4j .bolt .connection .AuthTokens ;
28
23
import org .neo4j .bolt .connection .BoltConnection ;
29
- import org .neo4j .bolt .connection .BoltConnectionState ;
30
24
import org .neo4j .bolt .connection .BoltProtocolVersion ;
31
25
import org .neo4j .bolt .connection .BoltServerAddress ;
32
- import org .neo4j .bolt .connection .DatabaseName ;
33
- import org .neo4j .bolt .connection .NotificationConfig ;
34
- import org .neo4j .bolt .connection .TelemetryApi ;
35
- import org .neo4j .bolt .connection .TransactionType ;
36
- import org .neo4j .driver .Value ;
26
+ import org .neo4j .bolt .connection .message .Message ;
37
27
import org .neo4j .driver .internal .value .BoltValueFactory ;
38
28
39
29
final class AdaptingDriverBoltConnection implements DriverBoltConnection {
@@ -49,141 +39,15 @@ final class AdaptingDriverBoltConnection implements DriverBoltConnection {
49
39
}
50
40
51
41
@ Override
52
- public <T > CompletionStage <T > onLoop (Supplier <T > supplier ) {
53
- return connection .onLoop (supplier );
54
- }
55
-
56
- @ Override
57
- public CompletionStage <DriverBoltConnection > route (
58
- DatabaseName databaseName , String impersonatedUser , Set <String > bookmarks ) {
59
- return connection
60
- .route (databaseName , impersonatedUser , bookmarks )
61
- .exceptionally (errorMapper ::mapAndTrow )
62
- .thenApply (ignored -> this );
63
- }
64
-
65
- @ Override
66
- public CompletionStage <DriverBoltConnection > beginTransaction (
67
- DatabaseName databaseName ,
68
- AccessMode accessMode ,
69
- String impersonatedUser ,
70
- Set <String > bookmarks ,
71
- TransactionType transactionType ,
72
- Duration txTimeout ,
73
- Map <String , Value > txMetadata ,
74
- String txType ,
75
- NotificationConfig notificationConfig ) {
76
- return connection
77
- .beginTransaction (
78
- databaseName ,
79
- accessMode ,
80
- impersonatedUser ,
81
- bookmarks ,
82
- transactionType ,
83
- txTimeout ,
84
- boltValueFactory .toBoltMap (txMetadata ),
85
- txType ,
86
- notificationConfig )
87
- .exceptionally (errorMapper ::mapAndTrow )
88
- .thenApply (ignored -> this );
89
- }
90
-
91
- @ Override
92
- public CompletionStage <DriverBoltConnection > runInAutoCommitTransaction (
93
- DatabaseName databaseName ,
94
- AccessMode accessMode ,
95
- String impersonatedUser ,
96
- Set <String > bookmarks ,
97
- String query ,
98
- Map <String , Value > parameters ,
99
- Duration txTimeout ,
100
- Map <String , Value > txMetadata ,
101
- NotificationConfig notificationConfig ) {
102
- return connection
103
- .runInAutoCommitTransaction (
104
- databaseName ,
105
- accessMode ,
106
- impersonatedUser ,
107
- bookmarks ,
108
- query ,
109
- boltValueFactory .toBoltMap (parameters ),
110
- txTimeout ,
111
- boltValueFactory .toBoltMap (txMetadata ),
112
- notificationConfig )
113
- .exceptionally (errorMapper ::mapAndTrow )
114
- .thenApply (ignored -> this );
115
- }
116
-
117
- @ Override
118
- public CompletionStage <DriverBoltConnection > run (String query , Map <String , Value > parameters ) {
119
- return connection
120
- .run (query , boltValueFactory .toBoltMap (parameters ))
121
- .exceptionally (errorMapper ::mapAndTrow )
122
- .thenApply (ignored -> this );
123
- }
124
-
125
- @ Override
126
- public CompletionStage <DriverBoltConnection > pull (long qid , long request ) {
127
- return connection
128
- .pull (qid , request )
129
- .exceptionally (errorMapper ::mapAndTrow )
130
- .thenApply (ignored -> this );
131
- }
132
-
133
- @ Override
134
- public CompletionStage <DriverBoltConnection > discard (long qid , long number ) {
42
+ public CompletionStage <Void > writeAndFlush (DriverResponseHandler handler , List <Message > messages ) {
135
43
return connection
136
- .discard (qid , number )
137
- .exceptionally (errorMapper ::mapAndTrow )
138
- .thenApply (ignored -> this );
139
- }
140
-
141
- @ Override
142
- public CompletionStage <DriverBoltConnection > commit () {
143
- return connection .commit ().exceptionally (errorMapper ::mapAndTrow ).thenApply (ignored -> this );
144
- }
145
-
146
- @ Override
147
- public CompletionStage <DriverBoltConnection > rollback () {
148
- return connection .rollback ().exceptionally (errorMapper ::mapAndTrow ).thenApply (ignored -> this );
149
- }
150
-
151
- @ Override
152
- public CompletionStage <DriverBoltConnection > reset () {
153
- return connection .reset ().exceptionally (errorMapper ::mapAndTrow ).thenApply (ignored -> this );
154
- }
155
-
156
- @ Override
157
- public CompletionStage <DriverBoltConnection > logoff () {
158
- return connection .logoff ().exceptionally (errorMapper ::mapAndTrow ).thenApply (ignored -> this );
159
- }
160
-
161
- @ Override
162
- public CompletionStage <DriverBoltConnection > logon (Map <String , Value > authMap ) {
163
- return connection
164
- .logon (AuthTokens .custom (boltValueFactory .toBoltMap (authMap )))
165
- .exceptionally (errorMapper ::mapAndTrow )
166
- .thenApply (ignored -> this );
167
- }
168
-
169
- @ Override
170
- public CompletionStage <DriverBoltConnection > telemetry (TelemetryApi telemetryApi ) {
171
- return connection
172
- .telemetry (telemetryApi )
173
- .exceptionally (errorMapper ::mapAndTrow )
174
- .thenApply (ignored -> this );
175
- }
176
-
177
- @ Override
178
- public CompletionStage <DriverBoltConnection > clear () {
179
- return connection .clear ().exceptionally (errorMapper ::mapAndTrow ).thenApply (ignored -> this );
44
+ .writeAndFlush (new AdaptingDriverResponseHandler (handler , errorMapper , boltValueFactory ), messages )
45
+ .exceptionally (errorMapper ::mapAndTrow );
180
46
}
181
47
182
48
@ Override
183
- public CompletionStage <Void > flush (DriverResponseHandler handler ) {
184
- return connection
185
- .flush (new AdaptingDriverResponseHandler (handler , errorMapper , boltValueFactory ))
186
- .exceptionally (errorMapper ::mapAndTrow );
49
+ public CompletionStage <Void > write (List <Message > messages ) {
50
+ return connection .write (messages ).exceptionally (errorMapper ::mapAndTrow );
187
51
}
188
52
189
53
@ Override
@@ -196,11 +60,6 @@ public CompletionStage<Void> close() {
196
60
return connection .close ().exceptionally (errorMapper ::mapAndTrow );
197
61
}
198
62
199
- @ Override
200
- public BoltConnectionState state () {
201
- return connection .state ();
202
- }
203
-
204
63
@ Override
205
64
public CompletionStage <AuthInfo > authData () {
206
65
return connection .authInfo ().exceptionally (errorMapper ::mapAndTrow );
@@ -230,4 +89,9 @@ public boolean telemetrySupported() {
230
89
public boolean serverSideRoutingEnabled () {
231
90
return connection .serverSideRoutingEnabled ();
232
91
}
92
+
93
+ @ Override
94
+ public BoltValueFactory valueFactory () {
95
+ return boltValueFactory ;
96
+ }
233
97
}
0 commit comments