-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
3,712 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apply plugin: 'java-library' | ||
apply plugin: 'me.champeau.mrjar' | ||
|
||
description = 'Neo4j Graph Data Science :: Neo4j Kernel Adapter 5.18' | ||
|
||
group = 'org.neo4j.gds' | ||
|
||
// for all 5.x versions | ||
if (ver.'neo4j'.startsWith('5.')) { | ||
sourceSets { | ||
main { | ||
java { | ||
srcDirs = ['src/main/java17'] | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
annotationProcessor project(':annotations') | ||
annotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables' | ||
annotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.18' | ||
|
||
compileOnly project(':annotations') | ||
compileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables' | ||
compileOnly group: 'org.neo4j', name: 'annotations', version: neos.'5.18' | ||
compileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.18' | ||
compileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.18' | ||
compileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.18' | ||
|
||
implementation project(':neo4j-kernel-adapter-api') | ||
implementation project(':neo4j-kernel-adapter-5-common') | ||
} | ||
} else { | ||
multiRelease { | ||
targetVersions 11, 17 | ||
} | ||
|
||
if (!project.hasProperty('no-forbidden-apis')) { | ||
forbiddenApisJava17 { | ||
exclude('**') | ||
} | ||
} | ||
|
||
dependencies { | ||
annotationProcessor group: 'org.neo4j', name: 'annotations', version: ver.'neo4j' | ||
|
||
compileOnly project(':annotations') | ||
compileOnly group: 'org.neo4j', name: 'annotations', version: ver.'neo4j' | ||
|
||
implementation project(':neo4j-kernel-adapter-api') | ||
|
||
java17AnnotationProcessor project(':annotations') | ||
java17AnnotationProcessor group: 'org.immutables', name: 'value', version: ver.'immutables' | ||
java17AnnotationProcessor group: 'org.neo4j', name: 'annotations', version: neos.'5.18' | ||
|
||
java17CompileOnly project(':annotations') | ||
java17CompileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables' | ||
java17CompileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.18' | ||
java17CompileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.18' | ||
java17CompileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.18' | ||
|
||
java17Implementation project(':neo4j-kernel-adapter-api') | ||
java17Implementation project(':neo4j-kernel-adapter-5-common') | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...8/neo4j-kernel-adapter/src/main/java/org/neo4j/gds/compat/_518/Neo4jProxyFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.gds.compat._518; | ||
|
||
import org.neo4j.annotations.service.ServiceProvider; | ||
import org.neo4j.gds.compat.Neo4jProxyApi; | ||
import org.neo4j.gds.compat.Neo4jProxyFactory; | ||
import org.neo4j.gds.compat.Neo4jVersion; | ||
|
||
@ServiceProvider | ||
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory { | ||
|
||
@Override | ||
public boolean canLoad(Neo4jVersion version) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Neo4jProxyApi load() { | ||
throw new UnsupportedOperationException("RC compatibility requires JDK17 or later"); | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Neo4j RC (placeholder)"; | ||
} | ||
} |
103 changes: 103 additions & 0 deletions
103
...j-kernel-adapter/src/main/java17/org/neo4j/gds/compat/_518/BoltTransactionRunnerImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.gds.compat._518; | ||
|
||
import org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI; | ||
import org.neo4j.bolt.dbapi.BoltTransaction; | ||
import org.neo4j.bolt.protocol.common.message.AccessMode; | ||
import org.neo4j.bolt.protocol.common.message.request.connection.RoutingContext; | ||
import org.neo4j.bolt.tx.statement.StatementQuerySubscriber; | ||
import org.neo4j.exceptions.KernelException; | ||
import org.neo4j.gds.compat.BoltQuerySubscriber; | ||
import org.neo4j.gds.compat.BoltTransactionRunner; | ||
import org.neo4j.graphdb.QueryStatistics; | ||
import org.neo4j.internal.kernel.api.connectioninfo.ClientConnectionInfo; | ||
import org.neo4j.internal.kernel.api.security.LoginContext; | ||
import org.neo4j.kernel.api.KernelTransaction; | ||
import org.neo4j.kernel.impl.query.QueryExecutionConfiguration; | ||
import org.neo4j.kernel.impl.query.QueryExecutionKernelException; | ||
import org.neo4j.values.virtual.MapValue; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class BoltTransactionRunnerImpl extends BoltTransactionRunner<StatementQuerySubscriber, String> { | ||
|
||
@Override | ||
protected BoltQuerySubscriber<StatementQuerySubscriber> boltQuerySubscriber() { | ||
var subscriber = new StatementQuerySubscriber(); | ||
return new BoltQuerySubscriber<>() { | ||
@Override | ||
public void assertSucceeded() throws KernelException { | ||
subscriber.assertSuccess(); | ||
} | ||
|
||
@Override | ||
public QueryStatistics queryStatistics() { | ||
return subscriber.getStatistics(); | ||
} | ||
|
||
@Override | ||
public StatementQuerySubscriber innerSubscriber() { | ||
return subscriber; | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
protected void executeQuery( | ||
BoltTransaction boltTransaction, | ||
String query, | ||
MapValue parameters, | ||
StatementQuerySubscriber querySubscriber | ||
) throws QueryExecutionKernelException { | ||
try { | ||
boltTransaction.executeQuery(query, parameters, true, querySubscriber) | ||
.queryExecution() // This fella here is quite lazy | ||
.consumeAll(); // We need to do this in order to trigger the query execution. | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
@Override | ||
protected BoltTransaction beginBoltWriteTransaction( | ||
BoltGraphDatabaseServiceSPI fabricDb, | ||
LoginContext loginContext, | ||
KernelTransaction.Type kernelTransactionType, | ||
ClientConnectionInfo clientConnectionInfo, | ||
List<String> bookmarks, | ||
Duration txTimeout, | ||
Map<String, Object> txMetadata | ||
) { | ||
return fabricDb.beginTransaction( | ||
kernelTransactionType, | ||
loginContext, | ||
clientConnectionInfo, | ||
bookmarks, | ||
txTimeout, | ||
AccessMode.WRITE, | ||
txMetadata, | ||
new RoutingContext(true, Map.of()), | ||
QueryExecutionConfiguration.DEFAULT_CONFIG | ||
); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...neo4j-kernel-adapter/src/main/java17/org/neo4j/gds/compat/_518/Neo4jProxyFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [http://neo4j.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.gds.compat._518; | ||
|
||
import org.neo4j.annotations.service.ServiceProvider; | ||
import org.neo4j.gds.compat.Neo4jProxyApi; | ||
import org.neo4j.gds.compat.Neo4jProxyFactory; | ||
import org.neo4j.gds.compat.Neo4jVersion; | ||
|
||
@ServiceProvider | ||
public final class Neo4jProxyFactoryImpl implements Neo4jProxyFactory { | ||
|
||
@Override | ||
public boolean canLoad(Neo4jVersion version) { | ||
return version == Neo4jVersion.V_RC; | ||
} | ||
|
||
@Override | ||
public Neo4jProxyApi load() { | ||
return new Neo4jProxyImpl(); | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Neo4j RC"; | ||
} | ||
} |
Oops, something went wrong.