Search in sources :

Example 1 with AbstractNeoServer

use of org.neo4j.server.AbstractNeoServer in project neo4j by neo4j.

the class AbstractInProcessServerBuilder method newServer.

@Override
public ServerControls newServer() {
    try (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
        final OutputStream logOutputStream;
        try {
            logOutputStream = createOrOpenAsOuputStream(fileSystem, new File(serverFolder, "neo4j.log"), true);
        } catch (IOException e) {
            throw new RuntimeException("Unable to create log file", e);
        }
        config.put(ServerSettings.third_party_packages.name(), toStringForThirdPartyPackageProperty(extensions.toList()));
        final FormattedLogProvider userLogProvider = FormattedLogProvider.toOutputStream(logOutputStream);
        GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies();
        Iterable<KernelExtensionFactory<?>> kernelExtensions = append(new Neo4jHarnessExtensions(procedures), dependencies.kernelExtensions());
        dependencies = dependencies.kernelExtensions(kernelExtensions).userLogProvider(userLogProvider);
        AbstractNeoServer neoServer = createNeoServer(config, dependencies, userLogProvider);
        InProcessServerControls controls = new InProcessServerControls(serverFolder, neoServer, logOutputStream);
        controls.start();
        try {
            fixtures.applyTo(controls);
        } catch (Exception e) {
            controls.close();
            throw Exceptions.launderedException(e);
        }
        return controls;
    } catch (IOException e) {
        throw Exceptions.launderedException(e);
    }
}
Also used : DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) DefaultFileSystemAbstraction(org.neo4j.io.fs.DefaultFileSystemAbstraction) OutputStream(java.io.OutputStream) IOException(java.io.IOException) KernelExtensionFactory(org.neo4j.kernel.extension.KernelExtensionFactory) AbstractNeoServer(org.neo4j.server.AbstractNeoServer) IOException(java.io.IOException) FormattedLogProvider(org.neo4j.logging.FormattedLogProvider) GraphDatabaseDependencies(org.neo4j.kernel.GraphDatabaseDependencies) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 DefaultFileSystemAbstraction (org.neo4j.io.fs.DefaultFileSystemAbstraction)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 GraphDatabaseDependencies (org.neo4j.kernel.GraphDatabaseDependencies)1 KernelExtensionFactory (org.neo4j.kernel.extension.KernelExtensionFactory)1 FormattedLogProvider (org.neo4j.logging.FormattedLogProvider)1 AbstractNeoServer (org.neo4j.server.AbstractNeoServer)1