use of org.neo4j.kernel.builtinprocs.SpecialBuiltInProcedures in project neo4j by neo4j.
the class DataSourceModule method setupProcedures.
private Procedures setupProcedures(PlatformModule platform, EditionModule editionModule) {
File pluginDir = platform.config.get(GraphDatabaseSettings.plugin_dir);
Log internalLog = platform.logging.getInternalLog(Procedures.class);
Procedures procedures = new Procedures(new SpecialBuiltInProcedures(Version.getNeo4jVersion(), platform.databaseInfo.edition.toString()), pluginDir, internalLog, new ProcedureConfig(platform.config));
platform.life.add(procedures);
platform.dependencies.satisfyDependency(procedures);
procedures.registerType(Node.class, new SimpleConverter(NTNode, Node.class));
procedures.registerType(Relationship.class, new SimpleConverter(NTRelationship, Relationship.class));
procedures.registerType(Path.class, new SimpleConverter(NTPath, Path.class));
procedures.registerType(Geometry.class, new SimpleConverter(NTGeometry, Geometry.class));
procedures.registerType(Point.class, new SimpleConverter(NTPoint, Point.class));
// Register injected public API components
Log proceduresLog = platform.logging.getUserLog(Procedures.class);
procedures.registerComponent(Log.class, (ctx) -> proceduresLog, true);
Guard guard = platform.dependencies.resolveDependency(Guard.class);
procedures.registerComponent(ProcedureTransaction.class, new ProcedureTransactionProvider(), true);
procedures.registerComponent(TerminationGuard.class, new TerminationGuardProvider(guard), true);
// Below components are not public API, but are made available for internal
// procedures to call, and to provide temporary workarounds for the following
// patterns:
// - Batch-transaction imports (GDAPI, needs to be real and passed to background processing threads)
// - Group-transaction writes (same pattern as above, but rather than splitting large transactions,
// combine lots of small ones)
// - Bleeding-edge performance (KernelTransaction, to bypass overhead of working with Core API)
procedures.registerComponent(DependencyResolver.class, (ctx) -> platform.dependencies, false);
procedures.registerComponent(KernelTransaction.class, (ctx) -> ctx.get(KERNEL_TRANSACTION), false);
procedures.registerComponent(GraphDatabaseAPI.class, (ctx) -> platform.graphDatabaseFacade, false);
// Security procedures
procedures.registerComponent(SecurityContext.class, ctx -> ctx.get(SECURITY_CONTEXT), true);
// Edition procedures
try {
editionModule.registerProcedures(procedures);
} catch (KernelException e) {
internalLog.error("Failed to register built-in edition procedures at start up: " + e.getMessage());
}
return procedures;
}
Aggregations