|
7 | 7 | import javax.annotation.PostConstruct;
|
8 | 8 | import javax.annotation.PreDestroy;
|
9 | 9 |
|
10 |
| -import org.apache.commons.configuration.Configuration; |
11 | 10 | import org.apache.commons.configuration.ConfigurationException;
|
12 | 11 | import org.apache.commons.configuration.PropertiesConfiguration;
|
13 | 12 | import org.janusgraph.core.JanusGraph;
|
14 |
| -import org.janusgraph.core.JanusGraphFactory; |
| 13 | +import org.janusgraph.diskstorage.configuration.ReadConfiguration; |
15 | 14 | import org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration;
|
| 15 | +import org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration; |
| 16 | +import org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder; |
16 | 17 | import org.janusgraph.graphdb.database.StandardJanusGraph;
|
17 | 18 | import org.slf4j.Logger;
|
18 | 19 | import org.slf4j.LoggerFactory;
|
| 20 | +import org.strongbox.db.server.janusgraph.CustomGraphDatabaseConfiguration; |
19 | 21 |
|
20 | 22 | /**
|
21 | 23 | * @author sbespalov
|
@@ -84,16 +86,18 @@ protected JanusGraph buildJanusGraph(JanusGraphConfiguration configuration)
|
84 | 86 | try
|
85 | 87 | {
|
86 | 88 | URL configLocationUrl = new URL(configLocation);
|
87 |
| - Configuration jgConfiguration = new PropertiesConfiguration(configLocationUrl); |
88 |
| - |
89 |
| - return JanusGraphFactory.open(new CommonsConfiguration(jgConfiguration)); |
| 89 | + ReadConfiguration janusGraphLocalConfig = new CommonsConfiguration(new PropertiesConfiguration(configLocationUrl)); |
| 90 | + GraphDatabaseConfigurationBuilder configBuilder = new GraphDatabaseConfigurationBuilder(); |
| 91 | + GraphDatabaseConfiguration janusGraphDbConfig = configBuilder.build(janusGraphLocalConfig); |
| 92 | + |
| 93 | + return new StandardJanusGraph(new CustomGraphDatabaseConfiguration(janusGraphDbConfig)); |
90 | 94 | }
|
91 | 95 | catch (MalformedURLException|ConfigurationException e)
|
92 | 96 | {
|
93 | 97 | throw new RuntimeException(String.format("Invalid configuration [%s].", configLocation), e);
|
94 | 98 | }
|
95 | 99 | }
|
96 |
| - |
| 100 | + |
97 | 101 | @PreDestroy
|
98 | 102 | @Override
|
99 | 103 | public synchronized void stop()
|
|
0 commit comments