Permalink
Browse files

Moved UdcSettings out from UDC, so the server can start without the u…

…dc-jar in place
  • Loading branch information...
systay committed Jul 2, 2012
1 parent b632e23 commit c1ec3ef8591bb132b562db8cc372c643a8d8e57b
@@ -242,7 +242,47 @@
@Description( "The minimal time that must pass in between logging statistics from the cache (when using the 'gcr' cache)." )
@Default( "60s" )
public static final TimeSpanSetting gcr_cache_min_log_interval = new TimeSpanSetting( "gcr_cache_min_log_interval");
-
+
+ /**
+ * Configuration key for enabling the UDC extension. Set to "false"
+ * to disable; any other value is considered false.
+ */
+ @Default( TRUE)
+ public static final GraphDatabaseSetting.BooleanSetting udc_enabled = new GraphDatabaseSetting.BooleanSetting("neo4j.ext.udc.enabled");
+
+ /**
+ * Configuration key for the first delay, expressed
+ * in milliseconds.
+ */
+ @Default( ""+10 * 1000 * 60 )
+ public static final GraphDatabaseSetting.IntegerSetting first_delay = new GraphDatabaseSetting.IntegerSetting("neo4j.ext.udc.first_delay", "Must be nr of milliseconds to delay", 1, null);
+
+ /**
+ * Configuration key for the interval for regular updates,
+ * expressed in milliseconds.
+ */
+ @Default(""+1000 * 60 * 60 * 24)
+ public static final GraphDatabaseSetting.IntegerSetting interval = new GraphDatabaseSetting.IntegerSetting("neo4j.ext.udc.interval", "Must be nr of milliseconds of the interval for checking", 1, null);
+
+ /**
+ * The host address to which UDC updates will be sent.
+ * Should be of the form hostname[:port].
+ */
+ @Default( "udc.neo4j.org" )
+ public static final GraphDatabaseSetting.StringSetting udc_host = new GraphDatabaseSetting.StringSetting( "neo4j.ext.udc.host", ANY, "Must be a valid hostname");
+
+ /**
+ * Configuration key for overriding the source parameter in UDC
+ */
+ public static final GraphDatabaseSetting.StringSetting udc_source = new GraphDatabaseSetting.StringSetting("neo4j.ext.udc.source", ANY, "Must be a valid source");
+
+ /**
+ * Unique registration id
+ */
+ @Default( "unreg" )
+ public static final GraphDatabaseSetting.StringSetting udc_registration_key = new GraphDatabaseSetting.StringSetting( "neo4j.ext.udc.reg", ANY, "Must be a valid registration id" );
+
+
// Specialized settings
public static class CacheTypeSetting
extends OptionsSetting
@@ -25,7 +25,6 @@
import java.util.Map;
import org.apache.commons.configuration.Configuration;
-import org.neo4j.ext.udc.UdcSettings;
import org.neo4j.graphdb.factory.GraphDatabaseSetting;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.MapUtil;
@@ -98,7 +97,7 @@ public void stop() throws Throwable
putIfAbsent( neo4jProperties, ShellSettings.remote_shell_enabled.name(), GraphDatabaseSetting.TRUE );
putIfAbsent( neo4jProperties, GraphDatabaseSettings.keep_logical_logs.name(), GraphDatabaseSetting.TRUE );
- neo4jProperties.put( UdcSettings.udc_source.name(), "server" );
+ neo4jProperties.put( GraphDatabaseSettings.udc_source.name(), "server" );
return neo4jProperties;
}
@@ -22,7 +22,6 @@
import java.util.HashMap;
import java.util.Map;
-import org.neo4j.ext.udc.UdcSettings;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.factory.GraphDatabaseSetting;
@@ -117,7 +116,7 @@ private static GraphDatabaseAPI createDatabase( GraphDatabaseFactory factory, St
putIfAbsent( databaseProperties, ShellSettings.remote_shell_enabled.name(), GraphDatabaseSetting.TRUE );
putIfAbsent( databaseProperties, GraphDatabaseSettings.keep_logical_logs.name(), GraphDatabaseSetting.TRUE );
- databaseProperties.put( UdcSettings.udc_source.name(), "server" );
+ databaseProperties.put( GraphDatabaseSettings.udc_source.name(), "server" );
return factory.createDatabase( databaseStoreDirectory, databaseProperties );
}
@@ -1,72 +0,0 @@
-/**
- * Copyright (c) 2002-2012 "Neo Technology,"
- * Network Engine for Objects in Lund AB [http://neotechnology.com]
- *
- * This file is part of Neo4j.
- *
- * Neo4j is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package org.neo4j.ext.udc;
-
-import static org.neo4j.graphdb.factory.GraphDatabaseSetting.ANY;
-import static org.neo4j.graphdb.factory.GraphDatabaseSetting.TRUE;
-
-import org.neo4j.graphdb.factory.Default;
-import org.neo4j.graphdb.factory.GraphDatabaseSetting;
-
-/**
- * Settings to use for the UDC extension. Use this with the GraphDatabaseBuilder
- */
-public class UdcSettings
-{
- /**
- * Configuration key for enabling the UDC extension. Set to "false"
- * to disable; any other value is considered false.
- */
- @Default( TRUE)
- public static final GraphDatabaseSetting.BooleanSetting udc_enabled = new GraphDatabaseSetting.BooleanSetting("neo4j.ext.udc.enabled");
-
- /**
- * Configuration key for the first delay, expressed
- * in milliseconds.
- */
- @Default( ""+10 * 1000 * 60 )
- public static final GraphDatabaseSetting.IntegerSetting first_delay = new GraphDatabaseSetting.IntegerSetting("neo4j.ext.udc.first_delay", "Must be nr of milliseconds to delay", 1, null);
-
- /**
- * Configuration key for the interval for regular updates,
- * expressed in milliseconds.
- */
- @Default(""+1000 * 60 * 60 * 24)
- public static final GraphDatabaseSetting.IntegerSetting interval = new GraphDatabaseSetting.IntegerSetting("neo4j.ext.udc.interval", "Must be nr of milliseconds of the interval for checking", 1, null);
-
- /**
- * The host address to which UDC updates will be sent.
- * Should be of the form hostname[:port].
- */
- @Default( "udc.neo4j.org" )
- public static final GraphDatabaseSetting.StringSetting udc_host = new GraphDatabaseSetting.StringSetting( "neo4j.ext.udc.host", ANY, "Must be a valid hostname");
-
- /**
- * Configuration key for overriding the source parameter in UDC
- */
- public static final GraphDatabaseSetting.StringSetting udc_source = new GraphDatabaseSetting.StringSetting("neo4j.ext.udc.source", ANY, "Must be a valid source");
-
- /**
- * Unique registration id
- */
- @Default( "unreg" )
- public static final GraphDatabaseSetting.StringSetting udc_registration_key = new GraphDatabaseSetting.StringSetting( "neo4j.ext.udc.reg", ANY, "Must be a valid registration id" );
-}
@@ -33,8 +33,8 @@
import java.util.regex.Pattern;
import org.neo4j.ext.udc.Edition;
-import org.neo4j.ext.udc.UdcSettings;
import org.neo4j.graphdb.factory.GraphDatabaseSetting;
+import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.Service;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.kernel.KernelData;
@@ -69,7 +69,7 @@ public UdcExtensionImpl()
@Override
public Class getSettingsClass()
{
- return UdcSettings.class;
+ return GraphDatabaseSettings.class;
}
@Override
@@ -81,13 +81,13 @@ protected UdcTimerTask load( KernelData kernel )
Config config = loadConfig(kernel);
- if ( !config.getBoolean( UdcSettings.udc_enabled )) return null;
+ if ( !config.getBoolean( GraphDatabaseSettings.udc_enabled )) return null;
- int firstDelay = config.getInteger( UdcSettings.first_delay);
- int interval = config.getInteger( UdcSettings.interval );
- String hostAddress = config.get( UdcSettings.udc_host );
- String source = config.get( UdcSettings.udc_source );
- String registration = config.get( UdcSettings.udc_registration_key );
+ int firstDelay = config.getInteger( GraphDatabaseSettings.first_delay);
+ int interval = config.getInteger( GraphDatabaseSettings.interval );
+ String hostAddress = config.get( GraphDatabaseSettings.udc_host );
+ String source = config.get( GraphDatabaseSettings.udc_source );
+ String registration = config.get( GraphDatabaseSettings.udc_registration_key );
Integer clusterNameHash = determineClusterNameHash(config);
NeoStoreXaDataSource ds = kernel.graphDatabase().getXaDataSourceManager().getNeoStoreDataSource();
boolean crashPing = ds.getXaContainer().getLogicalLog().wasNonClean();
@@ -39,10 +39,10 @@
import org.junit.Before;
import org.junit.Test;
import org.neo4j.ext.udc.Edition;
-import org.neo4j.ext.udc.UdcSettings;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.factory.GraphDatabaseBuilder;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
+import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.kernel.GraphDatabaseAPI;
// import org.neo4j.kernel.ha.HaSettings;
@@ -114,8 +114,8 @@ public void shouldRecordFailuresWhenThereIsNoServer() throws Exception
{
GraphDatabaseService graphdb = new GraphDatabaseFactory().
newEmbeddedDatabaseBuilder( "should-record-failures").
- setConfig( UdcSettings.first_delay, "100" ).
- setConfig( UdcSettings.udc_host, "127.0.0.1:1" ).
+ setConfig( GraphDatabaseSettings.first_delay, "100" ).
+ setConfig( GraphDatabaseSettings.udc_host, "127.0.0.1:1" ).
newGraphDatabase();
assertGotFailureWithRetry( IS_GREATER_THAN_ZERO );
destroy( graphdb );
@@ -154,8 +154,8 @@ private void setupServer() throws Exception {
serverAddress = hostname + ":" + server.getServicePort();
config = new HashMap<String, String>();
- config.put(UdcSettings.first_delay.name(), "100");
- config.put(UdcSettings.udc_host.name(), serverAddress);
+ config.put(GraphDatabaseSettings.first_delay.name(), "100");
+ config.put(GraphDatabaseSettings.udc_host.name(), serverAddress);
}
@Test
@@ -164,7 +164,7 @@ public void shouldNotBeAbleToSpecifyRegistrationIdWithConfig() throws Exception
setupServer();
- config.put( UdcSettings.udc_registration_key.name(), "marketoid" );
+ config.put( GraphDatabaseSettings.udc_registration_key.name(), "marketoid" );
GraphDatabaseService graphdb = createTempDatabase( config );
assertGotSuccessWithRetry( IS_GREATER_THAN_ZERO );

0 comments on commit c1ec3ef

Please sign in to comment.