Skip to content

Commit ef9bcf3

Browse files
author
mpv1989
committed
Add property for protocol
1 parent ad828c9 commit ef9bcf3

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ The driver is configured with some default values:
138138
<tr><td>arangodb.password</td><td>Basic Authentication Password</td><td></td></tr>
139139
<tr><td>arangodb.useSsl</td><td>use SSL connection</td><td>false</td></tr>
140140
<tr><td>arangodb.chunksize</td><td>VelocyStream Chunk content-size(bytes)</td><td>30000</td></tr>
141-
<tr><td>arangodb.connections.max</td><td>max number of connections</td><td>1</td></tr>
141+
<tr><td>arangodb.connections.max</td><td>max number of connections</td><td>1 VST, 20 HTTP</td></tr>
142+
<tr><td>arangodb.protocol</td><td>used network protocol</td><td>VST</td></tr>
142143
</table>
143144

144145
To customize the configuration the parameters can be changed in the code...

src/main/java/com/arangodb/ArangoDB.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public Builder loadProperties(final InputStream in) throws ArangoDBException {
126126
useSsl = loadUseSsl(properties, useSsl);
127127
chunksize = loadChunkSize(properties, chunksize);
128128
maxConnections = loadMaxConnections(properties, maxConnections);
129+
protocol = loadProtocol(properties, protocol);
129130
} catch (final IOException e) {
130131
throw new ArangoDBException(e);
131132
}

src/main/java/com/arangodb/internal/ArangoDBConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package com.arangodb.internal;
2222

23+
import com.arangodb.Protocol;
24+
2325
/**
2426
* @author Mark - mark at arangodb.com
2527
*
@@ -39,6 +41,7 @@ public class ArangoDBConstants {
3941
public static final int CHUNK_DEFAULT_CONTENT_SIZE = 30000;
4042
public static final int MAX_CONNECTIONS_VST_DEFAULT = 1;
4143
public static final int MAX_CONNECTIONS_HTTP_DEFAULT = 20;
44+
public static final Protocol DEFAULT_NETWORK_PROTOCOL = Protocol.VST;
4245

4346
public static final String PATH_API_DOCUMENT = "/_api/document";
4447
public static final String PATH_API_COLLECTION = "/_api/collection";

src/main/java/com/arangodb/internal/InternalArangoDB.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Properties;
2828

2929
import com.arangodb.ArangoDBException;
30+
import com.arangodb.Protocol;
3031
import com.arangodb.entity.LogLevelEntity;
3132
import com.arangodb.entity.ServerRole;
3233
import com.arangodb.entity.UserEntity;
@@ -62,6 +63,7 @@ public class InternalArangoDB<E extends ArangoExecutor, R, C extends Connection>
6263
private static final String PROPERTY_KEY_USE_SSL = "arangodb.usessl";
6364
private static final String PROPERTY_KEY_V_STREAM_CHUNK_CONTENT_SIZE = "arangodb.chunksize";
6465
private static final String PROPERTY_KEY_MAX_CONNECTIONS = "arangodb.connections.max";
66+
private static final String PROPERTY_KEY_PROTOCOL = "arangodb.protocol";
6567
protected static final String DEFAULT_PROPERTY_FILE = "/arangodb.properties";
6668

6769
public InternalArangoDB(final E executor, final ArangoSerialization util) {
@@ -122,6 +124,12 @@ protected static Integer loadMaxConnections(final Properties properties, final I
122124
ArangoDBConstants.MAX_CONNECTIONS_VST_DEFAULT));
123125
}
124126

127+
protected static Protocol loadProtocol(final Properties properties, final Protocol currentValue) {
128+
return Protocol.valueOf(
129+
getProperty(properties, PROPERTY_KEY_PROTOCOL, currentValue, ArangoDBConstants.DEFAULT_NETWORK_PROTOCOL)
130+
.toUpperCase());
131+
}
132+
125133
private static <T> String getProperty(
126134
final Properties properties,
127135
final String key,

0 commit comments

Comments
 (0)