Skip to content
Browse files

Dex configuration has the additonal element for an external configura…

…tion file.
  • Loading branch information...
1 parent 3120d1e commit 972cac3f4b59a13dd11de63cdaae4eec6ca345b9 @spmallette spmallette committed Oct 29, 2012
View
1 CHANGELOG.textile
@@ -27,6 +27,7 @@ h3. Version 2.2.0 (NOT OFFICIALLY RELEASED YET)
** @upload-timeout-millis@ element represents the length of the time in milliseconds that Rexster will wait for an upload to occur.
* Fixed Rexster Console where some @null@ results were not being rendered back to it.
* Fixed Rexster Console issues where transactions were not executing properly as requests within a session were not being bound to specific threads.
+* Update the Dex configuration of @rexster.xml@ to accept an external configuration file.
h3. Version 2.1.0 (August 4, 2012)
View
26 rexster-server/src/main/java/com/tinkerpop/rexster/config/DexGraphConfiguration.java
@@ -4,15 +4,39 @@
import com.tinkerpop.blueprints.impls.dex.DexGraph;
import com.tinkerpop.rexster.Tokens;
import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.SubnodeConfiguration;
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
public class DexGraphConfiguration implements GraphConfiguration {
+ private final static String DEX_CONFIGURATION_PROPERTY = "config-file";
+
public Graph configureGraphInstance(final Configuration properties) throws GraphConfigurationException {
final String graphFile = properties.getString(Tokens.REXSTER_GRAPH_LOCATION, null);
+ if (graphFile == null || graphFile.length() == 0) {
+ throw new GraphConfigurationException("Check graph configuration. Missing or empty configuration element: " + Tokens.REXSTER_GRAPH_LOCATION);
+ }
+
+ // get the <properties> section of the xml configuration
+ final HierarchicalConfiguration graphSectionConfig = (HierarchicalConfiguration) properties;
+ SubnodeConfiguration dexSpecificConfiguration;
+ String dexconfig;
+
+ try {
+ // allow the properties to be optional
+ dexSpecificConfiguration = graphSectionConfig.configurationAt(Tokens.REXSTER_GRAPH_PROPERTIES);
+ dexconfig = dexSpecificConfiguration.getString(DEX_CONFIGURATION_PROPERTY, null);
+ } catch (IllegalArgumentException iae) {
+ dexconfig = null;
+ }
+
try {
- return new DexGraph(graphFile);
+ return new DexGraph(graphFile, dexconfig);
} catch (Exception ex) {
throw new GraphConfigurationException(ex);
}

0 comments on commit 972cac3

Please sign in to comment.
Something went wrong with that request. Please try again.