-
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.
Merge pull request #8203 from yuvalr1neo/5.13-compat-2.4
5.13 compat 2.4
- Loading branch information
Showing
51 changed files
with
5,404 additions
and
1 deletion.
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.13' | ||
|
||
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.13' | ||
|
||
compileOnly project(':annotations') | ||
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion' | ||
compileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables' | ||
compileOnly group: 'org.neo4j', name: 'annotations', version: neos.'5.13' | ||
compileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.13' | ||
compileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.13' | ||
compileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.13' | ||
|
||
implementation project(':neo4j-kernel-adapter-api') | ||
} | ||
} 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.13' | ||
|
||
java17CompileOnly project(':annotations') | ||
java17CompileOnly group: 'org.immutables', name: 'value-annotations', version: ver.'immutables' | ||
java17CompileOnly group: 'org.neo4j', name: 'neo4j', version: neos.'5.13' | ||
java17CompileOnly group: 'org.neo4j', name: 'neo4j-record-storage-engine', version: neos.'5.13' | ||
java17CompileOnly group: 'org.neo4j.community', name: 'it-test-support', version: neos.'5.13' | ||
java17CompileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: ver.'spotbugsToolVersion' | ||
|
||
java17Implementation project(':neo4j-kernel-adapter-api') | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...3/neo4j-kernel-adapter/src/main/java/org/neo4j/gds/compat/_513/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._513; | ||
|
||
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("5.13 compatibility requires JDK17"); | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Neo4j 5.13 (placeholder)"; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...neo4j-kernel-adapter/src/main/java/org/neo4j/gds/compat/_513/SettingProxyFactoryImpl.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._513; | ||
|
||
import org.neo4j.annotations.service.ServiceProvider; | ||
import org.neo4j.gds.compat.Neo4jVersion; | ||
import org.neo4j.gds.compat.SettingProxyApi; | ||
import org.neo4j.gds.compat.SettingProxyFactory; | ||
|
||
@ServiceProvider | ||
public final class SettingProxyFactoryImpl implements SettingProxyFactory { | ||
|
||
@Override | ||
public boolean canLoad(Neo4jVersion version) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public SettingProxyApi load() { | ||
throw new UnsupportedOperationException("5.13 compatibility requires JDK17"); | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Neo4j Settings 5.13 (placeholder)"; | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
...j-kernel-adapter/src/main/java17/org/neo4j/gds/compat/_513/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,97 @@ | ||
/* | ||
* 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._513; | ||
|
||
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 { | ||
boltTransaction.executeQuery(query, parameters, true, querySubscriber); | ||
} | ||
|
||
@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 | ||
); | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...neo4j-kernel-adapter/src/main/java17/org/neo4j/gds/compat/_513/CallableProcedureImpl.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,53 @@ | ||
/* | ||
* 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._513; | ||
|
||
import org.neo4j.collection.RawIterator; | ||
import org.neo4j.gds.annotation.SuppressForbidden; | ||
import org.neo4j.gds.compat.CompatCallableProcedure; | ||
import org.neo4j.internal.kernel.api.exceptions.ProcedureException; | ||
import org.neo4j.internal.kernel.api.procs.ProcedureSignature; | ||
import org.neo4j.kernel.api.ResourceMonitor; | ||
import org.neo4j.kernel.api.procedure.CallableProcedure; | ||
import org.neo4j.kernel.api.procedure.Context; | ||
import org.neo4j.values.AnyValue; | ||
|
||
@SuppressForbidden(reason = "This is the compat API") | ||
public final class CallableProcedureImpl implements CallableProcedure { | ||
private final CompatCallableProcedure procedure; | ||
|
||
CallableProcedureImpl(CompatCallableProcedure procedure) { | ||
this.procedure = procedure; | ||
} | ||
|
||
@Override | ||
public ProcedureSignature signature() { | ||
return this.procedure.signature(); | ||
} | ||
|
||
@Override | ||
public RawIterator<AnyValue[], ProcedureException> apply( | ||
Context ctx, | ||
AnyValue[] input, | ||
ResourceMonitor resourceMonitor | ||
) throws ProcedureException { | ||
return this.procedure.apply(ctx, input); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
...dapter/src/main/java17/org/neo4j/gds/compat/_513/CallableUserAggregationFunctionImpl.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,77 @@ | ||
/* | ||
* 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._513; | ||
|
||
import org.neo4j.gds.annotation.SuppressForbidden; | ||
import org.neo4j.gds.compat.CompatUserAggregationFunction; | ||
import org.neo4j.gds.compat.CompatUserAggregator; | ||
import org.neo4j.internal.kernel.api.exceptions.ProcedureException; | ||
import org.neo4j.internal.kernel.api.procs.UserAggregationReducer; | ||
import org.neo4j.internal.kernel.api.procs.UserAggregationUpdater; | ||
import org.neo4j.internal.kernel.api.procs.UserFunctionSignature; | ||
import org.neo4j.kernel.api.procedure.CallableUserAggregationFunction; | ||
import org.neo4j.kernel.api.procedure.Context; | ||
import org.neo4j.values.AnyValue; | ||
|
||
@SuppressForbidden(reason = "This is the compat API") | ||
public final class CallableUserAggregationFunctionImpl implements CallableUserAggregationFunction { | ||
private final CompatUserAggregationFunction function; | ||
|
||
CallableUserAggregationFunctionImpl(CompatUserAggregationFunction function) { | ||
this.function = function; | ||
} | ||
|
||
@Override | ||
public UserFunctionSignature signature() { | ||
return this.function.signature(); | ||
} | ||
|
||
@Override | ||
public UserAggregationReducer createReducer(Context ctx) throws ProcedureException { | ||
return new UserAggregatorImpl(this.function.create(ctx)); | ||
} | ||
|
||
private static final class UserAggregatorImpl implements UserAggregationReducer, UserAggregationUpdater { | ||
private final CompatUserAggregator aggregator; | ||
|
||
private UserAggregatorImpl(CompatUserAggregator aggregator) { | ||
this.aggregator = aggregator; | ||
} | ||
|
||
@Override | ||
public UserAggregationUpdater newUpdater() { | ||
return this; | ||
} | ||
|
||
@Override | ||
public void update(AnyValue[] input) throws ProcedureException { | ||
this.aggregator.update(input); | ||
} | ||
|
||
@Override | ||
public void applyUpdates() { | ||
} | ||
|
||
@Override | ||
public AnyValue result() throws ProcedureException { | ||
return this.aggregator.result(); | ||
} | ||
} | ||
} |
Oops, something went wrong.