Class GraphHelper
java.lang.Object
org.odpi.openmetadata.openconnectors.governancedaemonconnectors.openlineageconnectors.janusconnector.graph.GraphHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClose the connection to the graph<U> voidcommit(BiConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, U> consumer, U argument, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graph<V,U> void commit(org.apache.tinkerpop.gremlin.util.function.TriConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, U> consumer, V argument1, U argument2, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graphorg.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSourceReturns a traversal that is used to query the graph<U,V> U getResult(BiFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, U> function, V argument, BiConsumer<Exception, V> errorHandler) Helper method that gets a traversal and executes the code that queries the graph<U> UgetResult(Function<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, U> function, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graph<U,V, T> U getResult(org.apache.tinkerpop.gremlin.util.function.TriFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, T, U> function, V argument1, T argument2, org.apache.tinkerpop.gremlin.util.function.TriConsumer<Exception, V, T> errorHandler) Helper method that gets a traversal and executes the code that queries the graphbooleanreturn whether the graph is supporting transactionsvoidopenGraph(String providerClass, Map<String, Object> configurationProperties, org.odpi.openmetadata.frameworks.auditlog.AuditLog auditLog) Open the graph with the provided configuration
-
Constructor Details
-
GraphHelper
public GraphHelper()
-
-
Method Details
-
openGraph
public void openGraph(String providerClass, Map<String, Object> configurationProperties, org.odpi.openmetadata.frameworks.auditlog.AuditLog auditLog) throws JanusConnectorException, org.odpi.openmetadata.governanceservers.openlineage.ffdc.OpenLineageExceptionOpen the graph with the provided configuration- Parameters:
providerClass- - Provider Class name to be usedconfigurationProperties- - The configuration properties for janusGraphauditLog- - Used for logging errors- Throws:
JanusConnectorException- if init failsorg.odpi.openmetadata.governanceservers.openlineage.ffdc.OpenLineageException- if init fails
-
getGraphTraversalSource
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource getGraphTraversalSource()Returns a traversal that is used to query the graph- Returns:
- traversal for the janusgraph
-
isSupportingTransactions
public boolean isSupportingTransactions()return whether the graph is supporting transactions -
closeGraph
public void closeGraph()Close the connection to the graph -
commit
public <U> void commit(BiConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, U> consumer, U argument, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graph- Type Parameters:
U- type of the second parameter of the consumer- Parameters:
consumer- must accept a GraphTraversalSource as the first parameter and has a second parameterargument- the second argument of the consumererrorHandler- function that is called when an error occurs while executing the consumer
-
commit
public <V,U> void commit(org.apache.tinkerpop.gremlin.util.function.TriConsumer<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, U> consumer, V argument1, U argument2, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graph- Type Parameters:
U- type of the second parameter of the consumerV- type of the third parameter of the consumer- Parameters:
consumer- must accept a GraphTraversalSource as the first parameter and has two more parameterargument1- the second argument of the consumerargument2- the third argument of the consumererrorHandler- function that is called when an error occurs while executing the consumer
-
getResult
public <U> U getResult(Function<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, U> function, Consumer<Exception> errorHandler) Helper method that gets a traversal and executes the code that queries the graph- Type Parameters:
U- type of the returned result- Parameters:
function- must accept a GraphTraversalSource as the parametererrorHandler- consumer that is called when an error occurs while executing the function- Returns:
- the result of the function
-
getResult
public <U,V> U getResult(BiFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, U> function, V argument, BiConsumer<Exception, V> errorHandler) Helper method that gets a traversal and executes the code that queries the graph- Type Parameters:
V- the type of the parameter of the functionU- type of the returned result- Parameters:
function- must accept a GraphTraversalSource as the first parameter and has a second parameterargument- the argument of the functionerrorHandler- consumer that is called when an error occurs while executing the function- Returns:
- the result of the function
-
getResult
public <U,V, U getResultT> (org.apache.tinkerpop.gremlin.util.function.TriFunction<org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource, V, T, U> function, V argument1, T argument2, org.apache.tinkerpop.gremlin.util.function.TriConsumer<Exception, V, T> errorHandler) Helper method that gets a traversal and executes the code that queries the graph- Type Parameters:
V- the type of the second parameter of the functionT- the type of the third parameter of the functionU- type of the returned result- Parameters:
function- must accept a GraphTraversalSource as the first parameter and has two more parametersargument1- the first argument of the functionargument2- the second argument of the functionerrorHandler- consumer that is called when an error occurs while executing the function- Returns:
- the result of the function
-