Skip to content

Commit

Permalink
Dex configuration has the additonal element for an external configura…
Browse files Browse the repository at this point in the history
…tion file.
  • Loading branch information
spmallette committed Oct 29, 2012
1 parent 3120d1e commit 972cac3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 972cac3

Please sign in to comment.