Skip to content

Commit 6413880

Browse files
committed
Add 5.15 compatibility
1 parent 3c915ab commit 6413880

33 files changed

+3636
-2
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apply plugin: 'java-library'
2+
apply plugin: 'me.champeau.mrjar'
3+
4+
description = 'Neo4j Graph Data Science :: Neo4j Kernel Adapter 5.15'
5+
6+
group = 'org.neo4j.gds'
7+
8+
// for all 5.x versions
9+
if (ver.'neo4j'.startsWith('5.')) {
10+
sourceSets {
11+
main {
12+
java {
13+
srcDirs = ['src/main/java17']
14+
}
15+
}
16+
}
17+
18+
dependencies {
19+
annotationProcessor project(':annotations')
20+
annotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables'
21+
annotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.15'
22+
23+
compileOnly project(':annotations')
24+
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion'
25+
compileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables'
26+
compileOnly group: 'org.neo4j', name: 'annotations', version: neos.'5.15'
27+
compileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.15'
28+
compileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.15'
29+
compileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.15'
30+
31+
implementation project(':neo4j-kernel-adapter-api')
32+
implementation project(':neo4j-kernel-adapter-5-common')
33+
}
34+
} else {
35+
multiRelease {
36+
targetVersions 11, 17
37+
}
38+
39+
if (!project.hasProperty('no-forbidden-apis')) {
40+
forbiddenApisJava17 {
41+
exclude('**')
42+
}
43+
}
44+
45+
dependencies {
46+
annotationProcessor group: 'org.neo4j', name: 'annotations', version: ver.'neo4j'
47+
48+
compileOnly project(':annotations')
49+
compileOnly group: 'org.neo4j', name: 'annotations', version: ver.'neo4j'
50+
51+
implementation project(':neo4j-kernel-adapter-api')
52+
53+
java17AnnotationProcessor project(':annotations')
54+
java17AnnotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables'
55+
java17AnnotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.15'
56+
57+
java17CompileOnly project(':annotations')
58+
java17CompileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables'
59+
java17CompileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.15'
60+
java17CompileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.15'
61+
java17CompileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.15'
62+
java17CompileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion'
63+
64+
java17Implementation project(':neo4j-kernel-adapter-api')
65+
java17Implementation project(':neo4j-kernel-adapter-5-common')
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.compat._515;
21+
22+
import org.neo4j.annotations.service.ServiceProvider;
23+
import org.neo4j.gds.compat.Neo4jProxyApi;
24+
import org.neo4j.gds.compat.Neo4jProxyFactory;
25+
import org.neo4j.gds.compat.Neo4jVersion;
26+
27+
@ServiceProvider
28+
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory {
29+
30+
@Override
31+
public boolean canLoad(Neo4jVersion version) {
32+
return false;
33+
}
34+
35+
@Override
36+
public Neo4jProxyApi load() {
37+
throw new UnsupportedOperationException("5.15 compatibility requires JDK17");
38+
}
39+
40+
@Override
41+
public String description() {
42+
return "Neo4j 5.15 (placeholder)";
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.compat._515;
21+
22+
import org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI;
23+
import org.neo4j.bolt.dbapi.BoltTransaction;
24+
import org.neo4j.bolt.protocol.common.message.AccessMode;
25+
import org.neo4j.bolt.protocol.common.message.request.connection.RoutingContext;
26+
import org.neo4j.bolt.tx.statement.StatementQuerySubscriber;
27+
import org.neo4j.exceptions.KernelException;
28+
import org.neo4j.gds.compat.BoltQuerySubscriber;
29+
import org.neo4j.gds.compat.BoltTransactionRunner;
30+
import org.neo4j.graphdb.QueryStatistics;
31+
import org.neo4j.internal.kernel.api.connectioninfo.ClientConnectionInfo;
32+
import org.neo4j.internal.kernel.api.security.LoginContext;
33+
import org.neo4j.kernel.api.KernelTransaction;
34+
import org.neo4j.kernel.impl.query.QueryExecutionConfiguration;
35+
import org.neo4j.kernel.impl.query.QueryExecutionKernelException;
36+
import org.neo4j.values.virtual.MapValue;
37+
38+
import java.time.Duration;
39+
import java.util.List;
40+
import java.util.Map;
41+
42+
public class BoltTransactionRunnerImpl extends BoltTransactionRunner<StatementQuerySubscriber, String> {
43+
44+
@Override
45+
protected BoltQuerySubscriber<StatementQuerySubscriber> boltQuerySubscriber() {
46+
var subscriber = new StatementQuerySubscriber();
47+
return new BoltQuerySubscriber<>() {
48+
@Override
49+
public void assertSucceeded() throws KernelException {
50+
subscriber.assertSuccess();
51+
}
52+
53+
@Override
54+
public QueryStatistics queryStatistics() {
55+
return subscriber.getStatistics();
56+
}
57+
58+
@Override
59+
public StatementQuerySubscriber innerSubscriber() {
60+
return subscriber;
61+
}
62+
};
63+
}
64+
65+
@Override
66+
protected void executeQuery(
67+
BoltTransaction boltTransaction,
68+
String query,
69+
MapValue parameters,
70+
StatementQuerySubscriber querySubscriber
71+
) throws QueryExecutionKernelException {
72+
boltTransaction.executeQuery(query, parameters, true, querySubscriber);
73+
}
74+
75+
@Override
76+
protected BoltTransaction beginBoltWriteTransaction(
77+
BoltGraphDatabaseServiceSPI fabricDb,
78+
LoginContext loginContext,
79+
KernelTransaction.Type kernelTransactionType,
80+
ClientConnectionInfo clientConnectionInfo,
81+
List<String> bookmarks,
82+
Duration txTimeout,
83+
Map<String, Object> txMetadata
84+
) {
85+
return fabricDb.beginTransaction(
86+
kernelTransactionType,
87+
loginContext,
88+
clientConnectionInfo,
89+
bookmarks,
90+
txTimeout,
91+
AccessMode.WRITE,
92+
txMetadata,
93+
new RoutingContext(true, Map.of()),
94+
QueryExecutionConfiguration.DEFAULT_CONFIG
95+
);
96+
}
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.compat._515;
21+
22+
import org.neo4j.annotations.service.ServiceProvider;
23+
import org.neo4j.gds.compat.Neo4jProxyApi;
24+
import org.neo4j.gds.compat.Neo4jProxyFactory;
25+
import org.neo4j.gds.compat.Neo4jVersion;
26+
27+
@ServiceProvider
28+
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory {
29+
30+
@Override
31+
public boolean canLoad(Neo4jVersion version) {
32+
return version == Neo4jVersion.V_5_15;
33+
}
34+
35+
@Override
36+
public Neo4jProxyApi load() {
37+
return new Neo4jProxyImpl();
38+
}
39+
40+
@Override
41+
public String description() {
42+
return "Neo4j 5.15";
43+
}
44+
}

0 commit comments

Comments
 (0)