|
19 | 19 | package org.neo4j.driver;
|
20 | 20 |
|
21 | 21 | import java.util.concurrent.CompletionStage;
|
22 |
| -import java.util.function.Consumer; |
23 | 22 |
|
24 | 23 | import org.neo4j.driver.async.AsyncSession;
|
25 | 24 | import org.neo4j.driver.exceptions.ClientException;
|
26 |
| -import org.neo4j.driver.internal.SessionParameters; |
| 25 | +import org.neo4j.driver.internal.SessionConfig; |
27 | 26 | import org.neo4j.driver.reactive.RxSession;
|
28 | 27 | import org.neo4j.driver.types.TypeSystem;
|
29 | 28 | import org.neo4j.driver.util.Experimental;
|
@@ -74,83 +73,88 @@ public interface Driver extends AutoCloseable
|
74 | 73 | boolean isEncrypted();
|
75 | 74 |
|
76 | 75 | /**
|
77 |
| - * Create a new general purpose {@link Session} with default {@link SessionParameters session parameters}. |
| 76 | + * Create a new general purpose {@link Session} with default {@link SessionConfig session configuration}. |
78 | 77 | * <p>
|
79 |
| - * Alias to {@link #session(Consumer)}}. |
| 78 | + * Alias to {@link #session(SessionConfig)}}. |
80 | 79 | *
|
81 | 80 | * @return a new {@link Session} object.
|
82 | 81 | */
|
83 | 82 | Session session();
|
84 | 83 |
|
85 | 84 | /**
|
86 |
| - * Create a new {@link Session} with a specified {@link SessionParametersTemplate}. |
87 |
| - * @param templateConsumer specifies how the session parameter shall be built for this session. |
| 85 | + * Create a new {@link Session} with a specified {@link SessionConfig session configuration}. |
| 86 | + * Use {@link SessionConfig#forDatabase(String)} to obtain a general purpose session configuration for the specified database. |
| 87 | + * @param sessionConfig specifies session configurations for this session. |
88 | 88 | * @return a new {@link Session} object.
|
89 |
| - * @see SessionParameters |
| 89 | + * @see SessionConfig |
90 | 90 | */
|
91 |
| - Session session( Consumer<SessionParametersTemplate> templateConsumer ); |
92 |
| - /** |
93 |
| - * Close all the resources assigned to this driver, including open connections and IO threads. |
94 |
| - * <p> |
95 |
| - * This operation works the same way as {@link #closeAsync()} but blocks until all resources are closed. |
96 |
| - */ |
97 |
| - @Override |
98 |
| - void close(); |
99 |
| - |
100 |
| - /** |
101 |
| - * Close all the resources assigned to this driver, including open connections and IO threads. |
102 |
| - * <p> |
103 |
| - * This operation is asynchronous and returns a {@link CompletionStage}. This stage is completed with |
104 |
| - * {@code null} when all resources are closed. It is completed exceptionally if termination fails. |
105 |
| - * |
106 |
| - * @return a {@link CompletionStage completion stage} that represents the asynchronous close. |
107 |
| - */ |
108 |
| - CompletionStage<Void> closeAsync(); |
| 91 | + Session session( SessionConfig sessionConfig ); |
109 | 92 |
|
110 | 93 | /**
|
111 |
| - * Returns the driver metrics if metrics reporting is enabled via {@link Config.ConfigBuilder#withDriverMetrics()}. |
112 |
| - * Otherwise a {@link ClientException} will be thrown. |
113 |
| - * @return the driver metrics if enabled. |
114 |
| - * @throws ClientException if the driver metrics reporting is not enabled. |
115 |
| - */ |
116 |
| - Metrics metrics(); |
117 |
| - |
118 |
| - /** |
119 |
| - * Create a new general purpose {@link RxSession} with default {@link SessionParameters session parameters}. |
| 94 | + * Create a new general purpose {@link RxSession} with default {@link SessionConfig session configuration}. |
120 | 95 | * The {@link RxSession} provides a reactive way to run queries and process results.
|
121 | 96 | * <p>
|
122 |
| - * Alias to {@link #rxSession(Consumer)}}. |
| 97 | + * Alias to {@link #rxSession(SessionConfig)}}. |
123 | 98 | *
|
124 | 99 | * @return @return a new {@link RxSession} object.
|
125 | 100 | */
|
126 | 101 | RxSession rxSession();
|
127 | 102 |
|
128 | 103 | /**
|
129 |
| - * Create a new {@link RxSession} with a specified {@link SessionParametersTemplate}. |
| 104 | + * Create a new {@link RxSession} with a specified {@link SessionConfig session configuration}. |
| 105 | + * Use {@link SessionConfig#forDatabase(String)} to obtain a general purpose session configuration for the specified database. |
130 | 106 | * The {@link RxSession} provides a reactive way to run queries and process results.
|
131 |
| - * @param templateConsumer used to customize the session parameters. |
| 107 | + * @param sessionConfig used to customize the session. |
132 | 108 | * @return @return a new {@link RxSession} object.
|
133 | 109 | */
|
134 |
| - RxSession rxSession( Consumer<SessionParametersTemplate> templateConsumer ); |
| 110 | + RxSession rxSession( SessionConfig sessionConfig ); |
135 | 111 |
|
136 | 112 | /**
|
137 |
| - * Create a new general purpose {@link AsyncSession} with default {@link SessionParameters session parameters}. |
| 113 | + * Create a new general purpose {@link AsyncSession} with default {@link SessionConfig session configuration}. |
138 | 114 | * The {@link AsyncSession} provides an asynchronous way to run queries and process results.
|
139 | 115 | * <p>
|
140 |
| - * Alias to {@link #asyncSession(Consumer)}}. |
| 116 | + * Alias to {@link #asyncSession(SessionConfig)}}. |
141 | 117 | *
|
142 | 118 | * @return @return a new {@link AsyncSession} object.
|
143 | 119 | */
|
144 | 120 | AsyncSession asyncSession();
|
145 | 121 |
|
146 | 122 | /**
|
147 |
| - * Create a new {@link AsyncSession} with a specified {@link SessionParametersTemplate}. |
| 123 | + * Create a new {@link AsyncSession} with a specified {@link SessionConfig session configuration}. |
| 124 | + * Use {@link SessionConfig#forDatabase(String)} to obtain a general purpose session configuration for the specified database. |
148 | 125 | * The {@link AsyncSession} provides an asynchronous way to run queries and process results.
|
149 | 126 | *
|
150 |
| - * @param templateConsumer used to customize the session parameters. |
| 127 | + * @param sessionConfig used to customize the session. |
151 | 128 | * @return a new {@link AsyncSession} object.
|
152 | 129 | */
|
153 |
| - AsyncSession asyncSession( Consumer<SessionParametersTemplate> templateConsumer ); |
| 130 | + AsyncSession asyncSession( SessionConfig sessionConfig ); |
| 131 | + |
| 132 | + /** |
| 133 | + * Close all the resources assigned to this driver, including open connections and IO threads. |
| 134 | + * <p> |
| 135 | + * This operation works the same way as {@link #closeAsync()} but blocks until all resources are closed. |
| 136 | + */ |
| 137 | + @Override |
| 138 | + void close(); |
| 139 | + |
| 140 | + /** |
| 141 | + * Close all the resources assigned to this driver, including open connections and IO threads. |
| 142 | + * <p> |
| 143 | + * This operation is asynchronous and returns a {@link CompletionStage}. This stage is completed with |
| 144 | + * {@code null} when all resources are closed. It is completed exceptionally if termination fails. |
| 145 | + * |
| 146 | + * @return a {@link CompletionStage completion stage} that represents the asynchronous close. |
| 147 | + */ |
| 148 | + CompletionStage<Void> closeAsync(); |
| 149 | + |
| 150 | + /** |
| 151 | + * Returns the driver metrics if metrics reporting is enabled via {@link Config.ConfigBuilder#withDriverMetrics()}. |
| 152 | + * Otherwise a {@link ClientException} will be thrown. |
| 153 | + * @return the driver metrics if enabled. |
| 154 | + * @throws ClientException if the driver metrics reporting is not enabled. |
| 155 | + */ |
| 156 | + @Experimental |
| 157 | + Metrics metrics(); |
154 | 158 |
|
155 | 159 | /**
|
156 | 160 | * This will return the type system supported by the driver.
|
|
0 commit comments