Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows configuration options like: dbms.books.0.name=Lord of the Rings dbms.books.0.author=Unknown dbms.books.1.name=Dr Who dbms.books.1.author=Spielberg, Steven This commit does not contain the user-facing java API part of this, but it will simply be a way to help build these setting strings, like: setConfig( books(0, book_name ), "Lordi" ) Eg. it ends up existing only once we use this API, which we will do for Bolt in upcoming commits.
- Loading branch information
Showing
4 changed files
with
292 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
community/kernel/src/main/java/org/neo4j/kernel/configuration/ConfigValues.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright (c) 2002-2015 "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.kernel.configuration; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.function.Function; | ||
|
||
import org.neo4j.helpers.Pair; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
import static org.neo4j.helpers.Pair.pair; | ||
|
||
public class ConfigValues implements Function<String, String> | ||
{ | ||
private final Map<String, String> raw; | ||
|
||
public ConfigValues( Map<String,String> raw ) | ||
{ | ||
this.raw = raw; | ||
} | ||
|
||
@Override | ||
public String apply( String s ) | ||
{ | ||
return raw.get( s ); | ||
} | ||
|
||
public List<Pair<String,String>> rawConfiguration() | ||
{ | ||
return raw.entrySet().stream() | ||
.map( e -> pair( e.getKey(), e.getValue() ) ) | ||
.collect( toList() ); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
community/kernel/src/main/java/org/neo4j/kernel/configuration/ConfigView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2002-2015 "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.kernel.configuration; | ||
|
||
import org.neo4j.graphdb.config.Setting; | ||
|
||
/** | ||
* Provide the basic operation that one could perform on a set of configurations. | ||
*/ | ||
public interface ConfigView | ||
{ | ||
/** | ||
* Retrieve the value of a configuration property from this {@link ConfigView}. | ||
* | ||
* @param setting The configuration property | ||
* @param <T> The type of the configuration property | ||
* @return The value of the configuration property if the property is found, otherwise, return the default value | ||
* of the given property. | ||
*/ | ||
<T> T get( Setting<T> setting ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters