Search in sources :

Example 1 with CommunityCompatibilityFactory

use of org.neo4j.cypher.internal.CommunityCompatibilityFactory in project neo4j by neo4j.

the class CommunityCypherEngineProvider method createEngine.

@Override
protected QueryExecutionEngine createEngine(Dependencies deps, GraphDatabaseAPI graphAPI) {
    GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);
    deps.satisfyDependency(queryService);
    DependencyResolver resolver = graphAPI.getDependencyResolver();
    LogService logService = resolver.resolveDependency(LogService.class);
    KernelAPI kernelAPI = resolver.resolveDependency(KernelAPI.class);
    Monitors monitors = resolver.resolveDependency(Monitors.class);
    LogProvider logProvider = logService.getInternalLogProvider();
    CommunityCompatibilityFactory compatibilityFactory = new CommunityCompatibilityFactory(queryService, kernelAPI, monitors, logProvider);
    deps.satisfyDependencies(compatibilityFactory);
    return new ExecutionEngine(queryService, logProvider, compatibilityFactory);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) QueryExecutionEngine(org.neo4j.kernel.impl.query.QueryExecutionEngine) Monitors(org.neo4j.kernel.monitoring.Monitors) CommunityCompatibilityFactory(org.neo4j.cypher.internal.CommunityCompatibilityFactory) GraphDatabaseCypherService(org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService) KernelAPI(org.neo4j.kernel.api.KernelAPI) LogService(org.neo4j.kernel.impl.logging.LogService) DependencyResolver(org.neo4j.graphdb.DependencyResolver)

Example 2 with CommunityCompatibilityFactory

use of org.neo4j.cypher.internal.CommunityCompatibilityFactory in project neo4j by neo4j.

the class ExecutionEngineTests method shouldConvertListsAndMapsWhenPassingFromScalaToJava.

@Test
public void shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception {
    GraphDatabaseQueryService graph = new GraphDatabaseCypherService(this.database.getGraphDatabaseAPI());
    KernelAPI kernelAPI = graph.getDependencyResolver().resolveDependency(KernelAPI.class);
    Monitors monitors = graph.getDependencyResolver().resolveDependency(Monitors.class);
    NullLogProvider nullLogProvider = NullLogProvider.getInstance();
    CommunityCompatibilityFactory compatibilityFactory = new CommunityCompatibilityFactory(graph, kernelAPI, monitors, nullLogProvider);
    ExecutionEngine executionEngine = new ExecutionEngine(graph, nullLogProvider, compatibilityFactory);
    Result result;
    try (InternalTransaction tx = graph.beginTransaction(KernelTransaction.Type.implicit, SecurityContext.AUTH_DISABLED)) {
        String query = "RETURN { key : 'Value' , collectionKey: [{ inner: 'Map1' }, { inner: 'Map2' }]}";
        TransactionalContext tc = createTransactionContext(graph, tx, query);
        result = executionEngine.executeQuery(query, NO_PARAMS, tc);
        tx.success();
    }
    Map firstRowValue = (Map) result.next().values().iterator().next();
    assertThat(firstRowValue.get("key"), is("Value"));
    List theList = (List) firstRowValue.get("collectionKey");
    assertThat(((Map) theList.get(0)).get("inner"), is("Map1"));
    assertThat(((Map) theList.get(1)).get("inner"), is("Map2"));
}
Also used : GraphDatabaseQueryService(org.neo4j.kernel.GraphDatabaseQueryService) GraphDatabaseCypherService(org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService) InternalTransaction(org.neo4j.kernel.impl.coreapi.InternalTransaction) Result(org.neo4j.graphdb.Result) Monitors(org.neo4j.kernel.monitoring.Monitors) NullLogProvider(org.neo4j.logging.NullLogProvider) CommunityCompatibilityFactory(org.neo4j.cypher.internal.CommunityCompatibilityFactory) List(java.util.List) TransactionalContext(org.neo4j.kernel.impl.query.TransactionalContext) KernelAPI(org.neo4j.kernel.api.KernelAPI) Map(java.util.Map) Test(org.junit.Test)

Example 3 with CommunityCompatibilityFactory

use of org.neo4j.cypher.internal.CommunityCompatibilityFactory in project neo4j-documentation by neo4j.

the class DocsExecutionEngineTest method createStuff.

private static DocsSetup createStuff() {
    EphemeralFileSystemAbstraction fs = new EphemeralFileSystemAbstraction();
    GraphDatabaseService graph = new TestEnterpriseGraphDatabaseFactory().setFileSystem(fs).newImpermanentDatabase();
    GraphDatabaseCypherService database = new GraphDatabaseCypherService(graph);
    GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graph);
    GraphDatabaseAPI graphAPI = (GraphDatabaseAPI) graph;
    DependencyResolver resolver = graphAPI.getDependencyResolver();
    LogService logService = resolver.resolveDependency(LogService.class);
    Monitors monitors = resolver.resolveDependency(Monitors.class);
    LogProvider logProvider = logService.getInternalLogProvider();
    CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory(queryService, monitors, logProvider);
    EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory(inner, queryService, monitors, logProvider);
    NullLogProvider logProvider1 = NullLogProvider.getInstance();
    DocsExecutionEngine engine = new DocsExecutionEngine(database, logProvider1, compatibilityFactory);
    PropertyContainerLocker locker = new PropertyContainerLocker();
    TransactionalContextFactory contextFactory = Neo4jTransactionalContextFactory.create(database, locker);
    return new DocsSetup() {

        @Override
        public GraphDatabaseCypherService database() {
            return database;
        }

        @Override
        public DocsExecutionEngine engine() {
            return engine;
        }

        @Override
        public TransactionalContextFactory contextFactory() {
            return contextFactory;
        }
    };
}
Also used : GraphDatabaseService(org.neo4j.graphdb.GraphDatabaseService) TestEnterpriseGraphDatabaseFactory(org.neo4j.test.TestEnterpriseGraphDatabaseFactory) EphemeralFileSystemAbstraction(org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction) GraphDatabaseCypherService(org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService) EnterpriseCompatibilityFactory(org.neo4j.cypher.internal.EnterpriseCompatibilityFactory) TransactionalContextFactory(org.neo4j.kernel.impl.query.TransactionalContextFactory) Neo4jTransactionalContextFactory(org.neo4j.kernel.impl.query.Neo4jTransactionalContextFactory) DependencyResolver(org.neo4j.graphdb.DependencyResolver) LogProvider(org.neo4j.logging.LogProvider) NullLogProvider(org.neo4j.logging.NullLogProvider) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) PropertyContainerLocker(org.neo4j.kernel.impl.coreapi.PropertyContainerLocker) Monitors(org.neo4j.kernel.monitoring.Monitors) CommunityCompatibilityFactory(org.neo4j.cypher.internal.CommunityCompatibilityFactory) NullLogProvider(org.neo4j.logging.NullLogProvider) DocsExecutionEngine(org.neo4j.cypher.internal.DocsExecutionEngine) LogService(org.neo4j.kernel.impl.logging.LogService)

Example 4 with CommunityCompatibilityFactory

use of org.neo4j.cypher.internal.CommunityCompatibilityFactory in project neo4j by neo4j.

the class EnterpriseCypherEngineProvider method createEngine.

@Override
protected QueryExecutionEngine createEngine(Dependencies deps, GraphDatabaseAPI graphAPI) {
    GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);
    deps.satisfyDependency(queryService);
    DependencyResolver resolver = graphAPI.getDependencyResolver();
    LogService logService = resolver.resolveDependency(LogService.class);
    KernelAPI kernelAPI = resolver.resolveDependency(KernelAPI.class);
    Monitors monitors = resolver.resolveDependency(Monitors.class);
    LogProvider logProvider = logService.getInternalLogProvider();
    CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory(queryService, kernelAPI, monitors, logProvider);
    EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory(inner, queryService, kernelAPI, monitors, logProvider);
    deps.satisfyDependency(compatibilityFactory);
    return new ExecutionEngine(queryService, logProvider, compatibilityFactory);
}
Also used : LogProvider(org.neo4j.logging.LogProvider) QueryExecutionEngine(org.neo4j.kernel.impl.query.QueryExecutionEngine) Monitors(org.neo4j.kernel.monitoring.Monitors) CommunityCompatibilityFactory(org.neo4j.cypher.internal.CommunityCompatibilityFactory) GraphDatabaseCypherService(org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService) KernelAPI(org.neo4j.kernel.api.KernelAPI) EnterpriseCompatibilityFactory(org.neo4j.cypher.internal.EnterpriseCompatibilityFactory) LogService(org.neo4j.kernel.impl.logging.LogService) DependencyResolver(org.neo4j.graphdb.DependencyResolver)

Aggregations

CommunityCompatibilityFactory (org.neo4j.cypher.internal.CommunityCompatibilityFactory)4 Monitors (org.neo4j.kernel.monitoring.Monitors)4 GraphDatabaseCypherService (org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService)3 DependencyResolver (org.neo4j.graphdb.DependencyResolver)3 KernelAPI (org.neo4j.kernel.api.KernelAPI)3 LogService (org.neo4j.kernel.impl.logging.LogService)3 LogProvider (org.neo4j.logging.LogProvider)3 EnterpriseCompatibilityFactory (org.neo4j.cypher.internal.EnterpriseCompatibilityFactory)2 QueryExecutionEngine (org.neo4j.kernel.impl.query.QueryExecutionEngine)2 NullLogProvider (org.neo4j.logging.NullLogProvider)2 List (java.util.List)1 Map (java.util.Map)1 Test (org.junit.Test)1 DocsExecutionEngine (org.neo4j.cypher.internal.DocsExecutionEngine)1 GraphDatabaseCypherService (org.neo4j.cypher.internal.javacompat.GraphDatabaseCypherService)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 Result (org.neo4j.graphdb.Result)1 EphemeralFileSystemAbstraction (org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction)1 GraphDatabaseQueryService (org.neo4j.kernel.GraphDatabaseQueryService)1 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)1