Search in sources :

Example 11 with ConfigurationManagementGraph

use of org.janusgraph.graphdb.management.ConfigurationManagementGraph in project janusgraph by JanusGraph.

the class ConfiguredGraphFactory method updateTemplateConfiguration.

/**
 * Update template configuration by updating supplied existing properties and adding new ones to the
 * {@link Configuration}; your updated Configuration may not contain the property "graph.graphname";
 * NOTE: Any graph using a configuration that was created using the template configuration must--
 * 1) be closed and reopened on every JanusGraph Node 2) have its corresponding Configuration removed
 * and 3) recreate the graph-- before the update is guaranteed to take effect.
 */
public static void updateTemplateConfiguration(final Configuration config) {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    configManagementGraph.updateTemplateConfiguration(config);
}
Also used : ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph)

Example 12 with ConfigurationManagementGraph

use of org.janusgraph.graphdb.management.ConfigurationManagementGraph in project janusgraph by JanusGraph.

the class ConfiguredGraphFactory method open.

/**
 * Open a {@link JanusGraph} using a previously created Configuration using the
 * {@link ConfigurationManagementGraph} API. A corresponding configuration must exist.
 *
 * <p>NOTE: If your configuration corresponding to this graph does not contain information about
 * the backend's keyspace/table/storage directory, then we set the keyspace/table to the
 * graphName or set the storage directory to the storage_root + /graphName.</p>
 *
 * @param graphName
 *
 * @return JanusGraph
 */
public static JanusGraph open(String graphName) {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    final Map<String, Object> graphConfigMap = configManagementGraph.getConfiguration(graphName);
    Preconditions.checkNotNull(graphConfigMap, "Please create configuration for this graph using the ConfigurationManagementGraph#createConfiguration API.");
    final JanusGraphManager jgm = JanusGraphManagerUtility.getInstance();
    Preconditions.checkNotNull(jgm, JANUS_GRAPH_MANAGER_EXPECTED_STATE_MSG);
    final CommonsConfiguration config = new CommonsConfiguration(ConfigurationUtil.loadMapConfiguration(graphConfigMap));
    return (JanusGraph) jgm.openGraph(graphName, (String gName) -> new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(config)));
}
Also used : GraphDatabaseConfigurationBuilder(org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) JanusGraphManager(org.janusgraph.graphdb.management.JanusGraphManager) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph)

Aggregations

ConfigurationManagementGraph (org.janusgraph.graphdb.management.ConfigurationManagementGraph)12 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)3 GraphDatabaseConfigurationBuilder (org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder)3 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)3 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)3 MapConfiguration (org.apache.commons.configuration2.MapConfiguration)2 Map (java.util.Map)1 Settings (org.apache.tinkerpop.gremlin.server.Settings)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1