Search in sources :

Example 6 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 7 with ConfigurationManagementGraph

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

the class ConfiguredGraphFactory method removeTemplateConfiguration.

/**
 * Remove template configuration
 */
public static void removeTemplateConfiguration() {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    configManagementGraph.removeTemplateConfiguration();
}
Also used : ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph)

Example 8 with ConfigurationManagementGraph

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

the class ConfiguredGraphFactory method getGraphNames.

/**
 * Get a Set of the graphNames that exist in your configuration management graph
 */
public static Set<String> getGraphNames() {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    final List<Map<String, Object>> configurations = configManagementGraph.getConfigurations();
    return configurations.stream().map(elem -> (String) elem.getOrDefault(ConfigurationManagementGraph.PROPERTY_GRAPH_NAME, null)).filter(Objects::nonNull).collect(Collectors.toSet());
}
Also used : Map(java.util.Map) ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph)

Example 9 with ConfigurationManagementGraph

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

the class ConfiguredGraphFactory method createConfiguration.

/**
 * Create a configuration according to the supplied {@link Configuration}; you must include
 * the property "graph.graphname" with a value in the configuration; you can then
 * open your graph using graph.graphname without having to supply the
 * Configuration or File each time using the {@link org.janusgraph.core.ConfiguredGraphFactory}.
 */
public static void createConfiguration(final Configuration config) {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    configManagementGraph.createConfiguration(config);
}
Also used : ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph)

Example 10 with ConfigurationManagementGraph

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

the class ConfiguredGraphFactory method removeConfiguration.

/**
 * Remove Configuration according to graphName
 */
public static void removeConfiguration(final String graphName) {
    final ConfigurationManagementGraph configManagementGraph = getConfigGraphManagementInstance();
    try {
        final JanusGraph graph = open(graphName);
        removeGraphFromCache(graph);
    } catch (Exception e) {
        // cannot open graph, do nothing
        log.error(String.format("Failed to open graph %s with the following error:\n %s.\n" + "Thus, it and its traversal will not be bound on this server.", graphName, e.toString()));
    }
    configManagementGraph.removeConfiguration(graphName);
}
Also used : StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) BackendException(org.janusgraph.diskstorage.BackendException) ConfigurationManagementGraphNotEnabledException(org.janusgraph.graphdb.management.utils.ConfigurationManagementGraphNotEnabledException) ConfigurationManagementGraph(org.janusgraph.graphdb.management.ConfigurationManagementGraph)

Aggregations

ConfigurationManagementGraph (org.janusgraph.graphdb.management.ConfigurationManagementGraph)10 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)4 MapConfiguration (org.apache.commons.configuration.MapConfiguration)2 BackendException (org.janusgraph.diskstorage.BackendException)2 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)2 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)2 JanusGraphManager (org.janusgraph.graphdb.management.JanusGraphManager)2 ConfigurationManagementGraphNotEnabledException (org.janusgraph.graphdb.management.utils.ConfigurationManagementGraphNotEnabledException)2 Map (java.util.Map)1 Test (org.junit.Test)1