public class ConfiguredGraphFactory extends Object
ConfigurationManagementGraph
or 2) open a graph reference denoted by a
graphName for graphs that have been previously created or for graphs for which you have
previously created a configuration using the ConfigurationManagementGraph
. This
class also defines a close which allows for removal of these Graph
objects from the
JanusGraphManager
reference tracker and closes the graph as well a drop which completely
clears all associated graph and index data as well as removes the graph configuration from the
ConfigurationManagementGraph
.
This class allows you to create/update/remove configuration objects used to open a graph. To use these APIs, you must define one of your graph's key as "ConfigurationManagementGraph" in your server's YAML; the configuration objects you define using these APIs will be stored in a graph representation (on a vertex, more precisely), and this graph will be opened according to the file supplied along with the "ConfigurationManagementGraph" key.
Constructor and Description |
---|
ConfiguredGraphFactory() |
Modifier and Type | Method and Description |
---|---|
static JanusGraph |
close(String graphName)
Removes the graph corresponding to the supplied graphName
from the
JanusGraphManager graph reference tracker and
returns the corresponding Graph, or null if it doesn't exist. |
static JanusGraph |
create(String graphName)
Creates a
JanusGraph configuration stored in the ConfigurationManagementGraph
graph and a JanusGraph graph reference according to the single
Template Configuration previously created by the ConfigurationManagementGraph API;
A configuration for this graph must not already exist, and a Template Configuration must
exist. |
static void |
createConfiguration(org.apache.commons.configuration2.Configuration config)
Create a configuration according to the supplied
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 ConfiguredGraphFactory . |
static void |
createTemplateConfiguration(org.apache.commons.configuration2.Configuration config)
Create a template configuration according to the supplied
Configuration ; if
you already created a template configuration or the supplied Configuration
contains the property "graph.graphname", we throw a RuntimeException ; you can then use
this template configuration to create a graph using the
ConfiguredGraphFactory create signature and supplying a new graphName. |
static void |
drop(String graphName)
Drop graph database, deleting all data in storage and indexing backends.
|
static Map<String,Object> |
getConfiguration(String configName)
Get Configuration according to supplied graphName mapped to a specific
Graph ; if does not exist, return null. |
static List<Map<String,Object>> |
getConfigurations()
Get a list of all Configurations, excluding the template configuration; if none exist,
return an empty list
|
static Set<String> |
getGraphNames()
Get a Set of the graphNames that exist in your configuration management graph
|
static Map<String,Object> |
getTemplateConfiguration()
Get template configuration if exists, else return null.
|
static JanusGraph |
open(String graphName)
Open a
JanusGraph using a previously created Configuration using the
ConfigurationManagementGraph API. |
static void |
removeConfiguration(String graphName)
Remove Configuration according to graphName
|
static void |
removeTemplateConfiguration()
Remove template configuration
|
static String |
toTraversalSourceName(String graphName)
Get traversal source name given a graph name.
|
static void |
updateConfiguration(String graphName,
org.apache.commons.configuration2.Configuration config)
Update configuration corresponding to supplied graphName; we update supplied existing
properties and add new ones to the
Configuration ; The supplied Configuration must include a
property "graph.graphname" and it must match supplied graphName;
NOTE: The updated configuration is only guaranteed to take effect if the Graph corresponding to
graphName has been closed and reopened on every JanusGraph Node. |
static void |
updateTemplateConfiguration(org.apache.commons.configuration2.Configuration config)
Update template configuration by updating supplied existing properties and adding new ones to the
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 JanusGraph create(String graphName)
JanusGraph
configuration stored in the ConfigurationManagementGraph
graph and a JanusGraph
graph reference according to the single
Template Configuration previously created by the ConfigurationManagementGraph
API;
A configuration for this graph must not already exist, and a Template Configuration must
exist. If the Template Configuration does not include its
backend's respective keyspace/table/storage_directory parameter, we set the keyspace/table
to the supplied graphName or we append the graphName to the supplied
storage_root parameter.graphName
- public static JanusGraph open(String graphName)
JanusGraph
using a previously created Configuration using the
ConfigurationManagementGraph
API. A corresponding configuration must exist.
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.
graphName
- public static Set<String> getGraphNames()
public static JanusGraph close(String graphName) throws Exception
JanusGraphManager
graph reference tracker and
returns the corresponding Graph, or null if it doesn't exist.graphName
- GraphException
public static void drop(String graphName)
JanusGraphManager
graph reference tracker, if there. Finally, if a configuration for this
graph exists on the ConfigurationManagementGraph
, then said configuration will be
removed.
WARNING: This is an irreversible operation that will delete all graph and index data.
graphName
- String graphName. Corresponding graph can be open or closed.public static void createConfiguration(org.apache.commons.configuration2.Configuration config)
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 ConfiguredGraphFactory
.public static void createTemplateConfiguration(org.apache.commons.configuration2.Configuration config)
Configuration
; if
you already created a template configuration or the supplied Configuration
contains the property "graph.graphname", we throw a RuntimeException
; you can then use
this template configuration to create a graph using the
ConfiguredGraphFactory create signature and supplying a new graphName.public static void updateConfiguration(String graphName, org.apache.commons.configuration2.Configuration config)
Configuration
; The supplied Configuration
must include a
property "graph.graphname" and it must match supplied graphName;
NOTE: The updated configuration is only guaranteed to take effect if the Graph
corresponding to
graphName has been closed and reopened on every JanusGraph Node.public static void updateTemplateConfiguration(org.apache.commons.configuration2.Configuration config)
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 removeConfiguration(String graphName)
public static void removeTemplateConfiguration()
public static Map<String,Object> getConfiguration(String configName)
Graph
; if does not exist, return null.public static List<Map<String,Object>> getConfigurations()
public static Map<String,Object> getTemplateConfiguration()
Copyright © 2012–2023. All rights reserved.