Skip to content

Commit

Permalink
Remove unused and deprecated things from server config
Browse files Browse the repository at this point in the history
  • Loading branch information
benbc committed Jan 7, 2016
1 parent ac9baf7 commit 45e8554
Show file tree
Hide file tree
Showing 47 changed files with 172 additions and 1,629 deletions.
Expand Up @@ -29,8 +29,8 @@
import org.neo4j.server.NeoServer; import org.neo4j.server.NeoServer;
import org.neo4j.server.advanced.AdvancedNeoServer; import org.neo4j.server.advanced.AdvancedNeoServer;
import org.neo4j.server.advanced.helpers.AdvancedServerBuilder; import org.neo4j.server.advanced.helpers.AdvancedServerBuilder;
import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.ServerConfigFactory; import org.neo4j.server.configuration.ServerConfigFactory;
import org.neo4j.server.web.ServerInternalSettings;
import org.neo4j.test.CleanupRule; import org.neo4j.test.CleanupRule;
import org.neo4j.test.TargetDirectory; import org.neo4j.test.TargetDirectory;


Expand Down Expand Up @@ -67,7 +67,7 @@ public void shouldBeAbleToRestartServer() throws Exception
assertEquals( dbDirectory1, server.getDatabase().getLocation() ); assertEquals( dbDirectory1, server.getDatabase().getLocation() );


// Change the database location // Change the database location
config.augment( stringMap( Configurator.DATABASE_LOCATION_PROPERTY_KEY, dbDirectory2 ) ); config.augment( stringMap( ServerInternalSettings.legacy_db_location.name(), dbDirectory2 ) );
ServerManagement bean = new ServerManagement( server ); ServerManagement bean = new ServerManagement( server );
bean.restartServer(); bean.restartServer();


Expand Down
Expand Up @@ -19,16 +19,17 @@
*/ */
package org.neo4j.harness.internal; package org.neo4j.harness.internal;


import org.apache.commons.io.FileUtils;

import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.function.Function; import java.util.function.Function;


import org.apache.commons.io.FileUtils;

import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.config.Setting; import org.neo4j.graphdb.config.Setting;
import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.graphdb.factory.GraphDatabaseSettings;
Expand All @@ -37,15 +38,15 @@
import org.neo4j.io.fs.DefaultFileSystemAbstraction; import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction; import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.kernel.GraphDatabaseDependencies; import org.neo4j.kernel.GraphDatabaseDependencies;
import org.neo4j.kernel.configuration.Settings;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory; import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory;
import org.neo4j.logging.FormattedLogProvider; import org.neo4j.logging.FormattedLogProvider;
import org.neo4j.server.AbstractNeoServer; import org.neo4j.server.AbstractNeoServer;
import org.neo4j.server.configuration.ServerSettings; import org.neo4j.server.configuration.ServerSettings;
import org.neo4j.server.configuration.ThirdPartyJaxRsPackage;
import org.neo4j.server.web.ServerInternalSettings;


import static org.neo4j.io.file.Files.createOrOpenAsOuputStream; import static org.neo4j.io.file.Files.createOrOpenAsOuputStream;
import static org.neo4j.server.configuration.ConfigurationBuilder.ConfiguratorWrappingConfigurationBuilder.toStringForThirdPartyPackageProperty;
import static org.neo4j.server.configuration.Configurator.DATABASE_LOCATION_PROPERTY_KEY;
import static org.neo4j.server.configuration.Configurator.WEBSERVER_PORT_PROPERTY_KEY;
import static org.neo4j.test.Digests.md5Hex; import static org.neo4j.test.Digests.md5Hex;


public abstract class AbstractInProcessServerBuilder implements TestServerBuilder public abstract class AbstractInProcessServerBuilder implements TestServerBuilder
Expand All @@ -71,7 +72,7 @@ private void init( File workingDir )
setDirectory( workingDir ); setDirectory( workingDir );
withConfig( ServerSettings.auth_enabled, "false" ); withConfig( ServerSettings.auth_enabled, "false" );
withConfig( GraphDatabaseSettings.pagecache_memory, "8m" ); withConfig( GraphDatabaseSettings.pagecache_memory, "8m" );
withConfig( WEBSERVER_PORT_PROPERTY_KEY, Integer.toString( freePort() ) ); withConfig( ServerSettings.webserver_port.name(), Integer.toString( freePort() ) );
} }




Expand Down Expand Up @@ -177,7 +178,7 @@ public TestServerBuilder withFixture( Function<GraphDatabaseService,Void> fixtur
private TestServerBuilder setDirectory( File dir ) private TestServerBuilder setDirectory( File dir )
{ {
this.serverFolder = dir; this.serverFolder = dir;
config.put( DATABASE_LOCATION_PROPERTY_KEY, serverFolder.getAbsolutePath() ); config.put( ServerInternalSettings.legacy_db_location.name(), serverFolder.getAbsolutePath() );
return this; return this;
} }


Expand All @@ -197,4 +198,25 @@ private int freePort()
throw new RuntimeException( "Unable to find an available port: " + e.getMessage(), e ); throw new RuntimeException( "Unable to find an available port: " + e.getMessage(), e );
} }
} }

private static String toStringForThirdPartyPackageProperty( List<ThirdPartyJaxRsPackage> extensions )
{
String propertyString = "";
int packageCount = extensions.size();

if( packageCount == 0 )
return propertyString;
else
{
ThirdPartyJaxRsPackage jaxRsPackage;
for( int i = 0; i < packageCount - 1; i ++ )
{
jaxRsPackage = extensions.get( i );
propertyString += jaxRsPackage.getPackageName() + "=" + jaxRsPackage.getMountPoint() + Settings.SEPARATOR;
}
jaxRsPackage = extensions.get( packageCount - 1 );
propertyString += jaxRsPackage.getPackageName() + "=" + jaxRsPackage.getMountPoint();
return propertyString;
}
}
} }

This file was deleted.

Expand Up @@ -19,11 +19,6 @@
*/ */
package org.neo4j.harness; package org.neo4j.harness;


import org.apache.commons.io.FileUtils;
import org.codehaus.jackson.JsonNode;
import org.junit.Rule;
import org.junit.Test;

import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
Expand All @@ -40,6 +35,11 @@
import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager; import javax.net.ssl.X509TrustManager;


import org.apache.commons.io.FileUtils;
import org.codehaus.jackson.JsonNode;
import org.junit.Rule;
import org.junit.Test;

import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.ResourceIterable; import org.neo4j.graphdb.ResourceIterable;
Expand All @@ -49,7 +49,6 @@
import org.neo4j.helpers.collection.Iterables; import org.neo4j.helpers.collection.Iterables;
import org.neo4j.helpers.collection.IteratorUtil; import org.neo4j.helpers.collection.IteratorUtil;
import org.neo4j.server.ServerTestUtils; import org.neo4j.server.ServerTestUtils;
import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.ServerSettings; import org.neo4j.server.configuration.ServerSettings;
import org.neo4j.server.rest.domain.JsonParseException; import org.neo4j.server.rest.domain.JsonParseException;
import org.neo4j.test.SuppressOutput; import org.neo4j.test.SuppressOutput;
Expand All @@ -64,6 +63,7 @@
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;

import static org.neo4j.harness.TestServerBuilders.newInProcessBuilder; import static org.neo4j.harness.TestServerBuilders.newInProcessBuilder;


public class InProcessBuilderTest public class InProcessBuilderTest
Expand Down Expand Up @@ -110,9 +110,8 @@ public void shouldAllowCustomServerAndDbConfig() throws Exception


// When // When
try ( ServerControls server = getTestServerBuilder( testDir.directory() ) try ( ServerControls server = getTestServerBuilder( testDir.directory() )
.withConfig( Configurator.WEBSERVER_HTTPS_ENABLED_PROPERTY_KEY, "true") .withConfig( ServerSettings.webserver_https_enabled.name(), "true")
.withConfig( ServerSettings.tls_certificate_file.name(), testDir.file( "cert" ).getAbsolutePath() ) .withConfig( ServerSettings.tls_certificate_file.name(), testDir.file( "cert" ).getAbsolutePath() )
.withConfig( Configurator.WEBSERVER_KEYSTORE_PATH_PROPERTY_KEY, testDir.file( "keystore" ).getAbsolutePath() )
.withConfig( ServerSettings.tls_key_file.name(), testDir.file( "key" ).getAbsolutePath() ) .withConfig( ServerSettings.tls_key_file.name(), testDir.file( "key" ).getAbsolutePath() )
.withConfig( GraphDatabaseSettings.dense_node_threshold, "20" ) .withConfig( GraphDatabaseSettings.dense_node_threshold, "20" )
.newServer() ) .newServer() )
Expand Down Expand Up @@ -230,7 +229,7 @@ public void shouldFailWhenProvidingANonDirectoryAsSource() throws IOException
File notADirectory = File.createTempFile( "prefix", "suffix" ); File notADirectory = File.createTempFile( "prefix", "suffix" );
assertFalse( notADirectory.isDirectory() ); assertFalse( notADirectory.isDirectory() );


try ( ServerControls server = newInProcessBuilder( ).copyFrom( notADirectory ) try ( ServerControls ignored = newInProcessBuilder( ).copyFrom( notADirectory )
.newServer() ) .newServer() )
{ {
fail("server should not start"); fail("server should not start");
Expand Down
6 changes: 0 additions & 6 deletions community/server/src/docs/ops/server-configuration.asciidoc
Expand Up @@ -38,12 +38,6 @@ org.neo4j.server.webserver.address=0.0.0.0


For securing the Neo4j Server, see also <<operations-security>> For securing the Neo4j Server, see also <<operations-security>>


Set the location of the round-robin database directory which gathers metrics on the running server instance:
[source,properties]
----
org.neo4j.server.webadmin.rrdb.location=data/graph.db/../rrd
----

Set the URI path for the REST data API through which the database is accessed. This should be a relative path. Set the URI path for the REST data API through which the database is accessed. This should be a relative path.
[source,properties] [source,properties]
---- ----
Expand Down
Expand Up @@ -19,9 +19,6 @@
*/ */
package org.neo4j.server; package org.neo4j.server;


import org.apache.commons.configuration.Configuration;
import org.bouncycastle.operator.OperatorCreationException;

import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
Expand All @@ -34,6 +31,9 @@
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.servlet.Filter; import javax.servlet.Filter;


import org.apache.commons.configuration.Configuration;
import org.bouncycastle.operator.OperatorCreationException;

import org.neo4j.bolt.security.ssl.Certificates; import org.neo4j.bolt.security.ssl.Certificates;
import org.neo4j.bolt.security.ssl.KeyStoreFactory; import org.neo4j.bolt.security.ssl.KeyStoreFactory;
import org.neo4j.bolt.security.ssl.KeyStoreInformation; import org.neo4j.bolt.security.ssl.KeyStoreInformation;
Expand All @@ -52,8 +52,6 @@
import org.neo4j.logging.Log; import org.neo4j.logging.Log;
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;
import org.neo4j.server.configuration.ConfigWrappingConfiguration; import org.neo4j.server.configuration.ConfigWrappingConfiguration;
import org.neo4j.server.configuration.ConfigurationBuilder;
import org.neo4j.server.configuration.Configurator;
import org.neo4j.server.configuration.ServerSettings; import org.neo4j.server.configuration.ServerSettings;
import org.neo4j.server.database.CypherExecutor; import org.neo4j.server.database.CypherExecutor;
import org.neo4j.server.database.CypherExecutorProvider; import org.neo4j.server.database.CypherExecutorProvider;
Expand Down Expand Up @@ -87,6 +85,7 @@
import static java.lang.Math.round; import static java.lang.Math.round;
import static java.lang.String.format; import static java.lang.String.format;
import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MILLISECONDS;

import static org.neo4j.helpers.Clock.SYSTEM_CLOCK; import static org.neo4j.helpers.Clock.SYSTEM_CLOCK;
import static org.neo4j.helpers.collection.Iterables.map; import static org.neo4j.helpers.collection.Iterables.map;
import static org.neo4j.kernel.impl.util.JobScheduler.Groups.serverTransactionTimeout; import static org.neo4j.kernel.impl.util.JobScheduler.Groups.serverTransactionTimeout;
Expand Down Expand Up @@ -290,12 +289,6 @@ public Config getConfig()
return config; return config;
} }


@Override
public Configuration getConfiguration()
{
return new ConfigWrappingConfiguration( config );
}

// TODO: Once WebServer is fully implementing LifeCycle, // TODO: Once WebServer is fully implementing LifeCycle,
// it should manage all but static (eg. unchangeable during runtime) // it should manage all but static (eg. unchangeable during runtime)
// configuration itself. // configuration itself.
Expand Down Expand Up @@ -508,12 +501,6 @@ public WebServer getWebServer()
return webServer; return webServer;
} }


@Override
public Configurator getConfigurator()
{
return new ConfigurationBuilder.ConfigWrappingConfigurator( config );
}

@Override @Override
public PluginManager getExtensionManager() public PluginManager getExtensionManager()
{ {
Expand Down
Expand Up @@ -24,7 +24,6 @@
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;


import org.neo4j.kernel.GraphDatabaseAPI;
import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.factory.CommunityFacadeFactory; import org.neo4j.kernel.impl.factory.CommunityFacadeFactory;
import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory; import org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory;
Expand Down Expand Up @@ -56,14 +55,9 @@
@Deprecated @Deprecated
public class CommunityNeoServer extends AbstractNeoServer public class CommunityNeoServer extends AbstractNeoServer
{ {
public static final GraphFactory COMMUNITY_FACTORY = new GraphFactory() public static final GraphFactory COMMUNITY_FACTORY = ( config, dependencies ) -> {
{ File storeDir = config.get( ServerInternalSettings.legacy_db_location );
@Override return new CommunityFacadeFactory().newFacade( storeDir, config.getParams(), dependencies );
public GraphDatabaseAPI newGraphDatabase( Config config, GraphDatabaseFacadeFactory.Dependencies dependencies )
{
File storeDir = config.get( ServerInternalSettings.legacy_db_location );
return new CommunityFacadeFactory().newFacade( storeDir, config.getParams(), dependencies );
}
}; };


public CommunityNeoServer( Config config, GraphDatabaseFacadeFactory.Dependencies dependencies, public CommunityNeoServer( Config config, GraphDatabaseFacadeFactory.Dependencies dependencies,
Expand Down
69 changes: 0 additions & 69 deletions community/server/src/main/java/org/neo4j/server/JAXRSHelper.java

This file was deleted.

0 comments on commit 45e8554

Please sign in to comment.