Search in sources :

Example 1 with ProcedureConfig

use of org.neo4j.kernel.impl.proc.ProcedureConfig 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;
}
Also used : NTPath(org.neo4j.kernel.api.proc.Neo4jTypes.NTPath) Path(org.neo4j.graphdb.Path) Log(org.neo4j.logging.Log) SimpleConverter(org.neo4j.kernel.impl.proc.TypeMappers.SimpleConverter) NTNode(org.neo4j.kernel.api.proc.Neo4jTypes.NTNode) Node(org.neo4j.graphdb.Node) SpecialBuiltInProcedures(org.neo4j.kernel.builtinprocs.SpecialBuiltInProcedures) Procedures(org.neo4j.kernel.impl.proc.Procedures) NTPoint(org.neo4j.kernel.api.proc.Neo4jTypes.NTPoint) Point(org.neo4j.graphdb.spatial.Point) TerminationGuardProvider(org.neo4j.kernel.impl.proc.TerminationGuardProvider) NTGeometry(org.neo4j.kernel.api.proc.Neo4jTypes.NTGeometry) Geometry(org.neo4j.graphdb.spatial.Geometry) NTRelationship(org.neo4j.kernel.api.proc.Neo4jTypes.NTRelationship) Relationship(org.neo4j.graphdb.Relationship) AvailabilityGuard(org.neo4j.kernel.AvailabilityGuard) SchemaWriteGuard(org.neo4j.kernel.impl.api.SchemaWriteGuard) Guard(org.neo4j.kernel.guard.Guard) TerminationGuard(org.neo4j.procedure.TerminationGuard) TimeoutGuard(org.neo4j.kernel.guard.TimeoutGuard) ProcedureTransactionProvider(org.neo4j.kernel.impl.proc.ProcedureTransactionProvider) KernelException(org.neo4j.kernel.api.exceptions.KernelException) PhysicalLogFile(org.neo4j.kernel.impl.transaction.log.PhysicalLogFile) File(java.io.File) ProcedureConfig(org.neo4j.kernel.impl.proc.ProcedureConfig) SpecialBuiltInProcedures(org.neo4j.kernel.builtinprocs.SpecialBuiltInProcedures)

Aggregations

File (java.io.File)1 Node (org.neo4j.graphdb.Node)1 Path (org.neo4j.graphdb.Path)1 Relationship (org.neo4j.graphdb.Relationship)1 Geometry (org.neo4j.graphdb.spatial.Geometry)1 Point (org.neo4j.graphdb.spatial.Point)1 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)1 KernelException (org.neo4j.kernel.api.exceptions.KernelException)1 NTGeometry (org.neo4j.kernel.api.proc.Neo4jTypes.NTGeometry)1 NTNode (org.neo4j.kernel.api.proc.Neo4jTypes.NTNode)1 NTPath (org.neo4j.kernel.api.proc.Neo4jTypes.NTPath)1 NTPoint (org.neo4j.kernel.api.proc.Neo4jTypes.NTPoint)1 NTRelationship (org.neo4j.kernel.api.proc.Neo4jTypes.NTRelationship)1 SpecialBuiltInProcedures (org.neo4j.kernel.builtinprocs.SpecialBuiltInProcedures)1 Guard (org.neo4j.kernel.guard.Guard)1 TimeoutGuard (org.neo4j.kernel.guard.TimeoutGuard)1 SchemaWriteGuard (org.neo4j.kernel.impl.api.SchemaWriteGuard)1 ProcedureConfig (org.neo4j.kernel.impl.proc.ProcedureConfig)1 ProcedureTransactionProvider (org.neo4j.kernel.impl.proc.ProcedureTransactionProvider)1 Procedures (org.neo4j.kernel.impl.proc.Procedures)1