Skip to content

Commit

Permalink
Inject StoreDir into ProcedureGDSFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
boggle committed Feb 18, 2016
1 parent 01f1252 commit 78b0917
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Expand Up @@ -19,6 +19,7 @@
*/
package org.neo4j.kernel.impl.factory;

import java.io.File;
import java.net.URL;
import java.util.Map;

Expand Down Expand Up @@ -122,9 +123,9 @@ public StoreId storeId()
}

@Override
public String storeDir()
public File storeDir()
{
return platform.storeDir.getAbsolutePath();
return platform.storeDir;
}

@Override
Expand Down
Expand Up @@ -19,6 +19,7 @@
*/
package org.neo4j.kernel.impl.factory;

import java.io.File;
import java.net.URL;
import java.util.Collections;
import java.util.Map;
Expand Down Expand Up @@ -123,7 +124,7 @@ public interface SPI
DependencyResolver resolver();

StoreId storeId();
String storeDir();
File storeDir();

/** Eg. Neo4j Enterprise HA, Neo4j Community Standalone.. */
String name();
Expand Down Expand Up @@ -569,13 +570,13 @@ public URL validateURLAccess( URL url ) throws URLAccessValidationError
@Override
public String getStoreDir()
{
return spi.storeDir();
return spi.storeDir().getAbsolutePath();
}

@Override
public String toString()
{
return spi.name() + " ["+getStoreDir()+"]";
return spi.name() + " [" + getStoreDir() + "]";
}

private static class PropertyValueFilteringNodeIdIterator extends PrimitiveLongCollections.PrimitiveLongBaseIterator
Expand Down
Expand Up @@ -19,6 +19,7 @@
*/
package org.neo4j.kernel.impl.proc;

import java.io.File;
import java.net.URL;
import java.util.Map;
import java.util.function.Supplier;
Expand Down Expand Up @@ -49,12 +50,16 @@ class ProcedureGDBFacadeSPI implements GraphDatabaseFacade.SPI
private final Supplier<StoreId> storeId;
private final CoreAPIAvailabilityGuard availability;
private final ThrowingFunction<URL, URL, URLAccessValidationError> urlValidator;
private final File storeDir;

public ProcedureGDBFacadeSPI( KernelTransaction transaction, Supplier<QueryExecutionEngine> queryExecutor, DependencyResolver resolver, AutoIndexing autoIndexing,
Supplier<StoreId> storeId, CoreAPIAvailabilityGuard availability, ThrowingFunction<URL, URL, URLAccessValidationError> urlValidator )
public ProcedureGDBFacadeSPI( KernelTransaction transaction, Supplier<QueryExecutionEngine> queryExecutor,
File storeDir, DependencyResolver resolver, AutoIndexing autoIndexing,
Supplier<StoreId> storeId, CoreAPIAvailabilityGuard availability,
ThrowingFunction<URL, URL, URLAccessValidationError> urlValidator )
{
this.transaction = transaction;
this.queryExecutor = queryExecutor;
this.storeDir = storeDir;
this.resolver = resolver;
this.autoIndexing = autoIndexing;
this.storeId = storeId;
Expand All @@ -81,9 +86,9 @@ public StoreId storeId()
}

@Override
public String storeDir()
public File storeDir()
{
throw new UnsupportedOperationException();
return storeDir;
}

@Override
Expand Down
Expand Up @@ -19,6 +19,7 @@
*/
package org.neo4j.kernel.impl.proc;

import java.io.File;
import java.net.URL;
import java.util.function.Supplier;

Expand All @@ -40,6 +41,7 @@
public class ProcedureGDSFactory implements ThrowingFunction<CallableProcedure.Context,GraphDatabaseService,ProcedureException>
{
private final Config config;
private final File storeDir;
private final DependencyResolver resolver;
private final Supplier<StoreId> storeId;
private final Supplier<QueryExecutionEngine> queryExecutor;
Expand All @@ -48,13 +50,15 @@ public class ProcedureGDSFactory implements ThrowingFunction<CallableProcedure.C
private final AutoIndexing autoIndexing = AutoIndexing.UNSUPPORTED;

public ProcedureGDSFactory( Config config,
File storeDir,
DependencyResolver resolver,
Supplier<StoreId> storeId,
Supplier<QueryExecutionEngine> queryExecutor,
CoreAPIAvailabilityGuard availability,
URLAccessRule urlAccessRule )
{
this.config = config;
this.storeDir = storeDir;
this.resolver = resolver;
this.storeId = storeId;
this.queryExecutor = queryExecutor;
Expand All @@ -68,7 +72,7 @@ public GraphDatabaseService apply( CallableProcedure.Context context ) throws Pr
KernelTransaction transaction = context.get( CallableProcedure.Context.KERNEL_TRANSACTION );

GraphDatabaseFacade facade = new GraphDatabaseFacade();
facade.init( config, new ProcedureGDBFacadeSPI( transaction, queryExecutor, resolver, AutoIndexing.UNSUPPORTED, storeId, availability, urlValidator ) );
facade.init( config, new ProcedureGDBFacadeSPI( transaction, queryExecutor, storeDir, resolver, AutoIndexing.UNSUPPORTED, storeId, availability, urlValidator ) );

return facade;
}
Expand Down

0 comments on commit 78b0917

Please sign in to comment.