Package org.opendaylight.graph.impl
Class ConnectedGraphServer
- java.lang.Object
-
- org.opendaylight.graph.impl.ConnectedGraphServer
-
- All Implemented Interfaces:
AutoCloseable,EventListener,ConnectedGraphProvider,org.opendaylight.mdsal.binding.api.TransactionChainListener
@Singleton public final class ConnectedGraphServer extends Object implements ConnectedGraphProvider, org.opendaylight.mdsal.binding.api.TransactionChainListener, AutoCloseable
This Class Implements the DataStoreService interface providing the methods required to manage the network representation elements in the datastore.- Author:
- Olivier Dugeon, Philippe Niger
-
-
Constructor Summary
Constructors Constructor Description ConnectedGraphServer(org.opendaylight.mdsal.binding.api.DataBroker dataBroker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(Graph graph, Edge edge, Edge old)Add Edge to existing Graph.ConnectedGraphaddGraph(Graph graph)Add a Graph.voidaddPrefix(Graph graph, Prefix prefix)Add Prefix to existing Graph.voidaddVertex(Graph graph, Vertex vertex, Vertex old)Add Vertex to existing Graph.voidclearGraph(Graph graph)Clear Graph.voidclose()Remove the Operation Graph Model and destroy the transaction chain.ConnectedGraphcreateConnectedGraph(String name, Graph.DomainScope scope)Create Connected Graph and associated Graph for given name and Graph Type.voiddeleteEdge(Graph graph, Edge edge)Remove Edge to existing Graph.voiddeleteGraph(GraphKey key)Remove a Graph.voiddeletePrefix(Graph graph, Prefix prefix)Remove Prefix to existing Graph.voiddeleteVertex(Graph graph, Vertex vertex)Remove Vertex to existing Graph.ConnectedGraphgetConnectedGraph(String name)Returns Connected Graph for the given graph name.ConnectedGraphgetConnectedGraph(GraphKey key)Returns Connected Graph for the given graph key.List<ConnectedGraph>getConnectedGraphs()Returns all registered Connected Graphs.GraphgetGraph(String name)Returns Graph for the given graph name.GraphgetGraph(GraphKey key)Returns the Graph for the given graph key.voidonTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)voidonTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)protected voidresetTransactionChain()Reset the transaction chain only so that the PingPong transaction chain will become usable again.
-
-
-
Method Detail
-
close
@PreDestroy public void close()
Remove the Operation Graph Model and destroy the transaction chain.- Specified by:
closein interfaceAutoCloseable
-
resetTransactionChain
protected void resetTransactionChain()
Reset the transaction chain only so that the PingPong transaction chain will become usable again. However, there will be data loss if we do not apply the previous failed transaction again
-
clearGraph
public void clearGraph(Graph graph)
Clear Graph. This method is used by the Connected Graph to clear associated Graph.- Parameters:
graph- Graph associated to the Connected Graph
-
addVertex
public void addVertex(Graph graph, Vertex vertex, Vertex old)
Add Vertex to existing Graph. Old vertex is remove first. This method is called when a Connected Vertex is created (See addVertex() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the vertex will be storedvertex- Vertex to be inserted in the graphold- Old vertex when performing an update. Must be null for a simple addition
-
deleteVertex
public void deleteVertex(Graph graph, Vertex vertex)
Remove Vertex to existing Graph. This method is called when a Connected Vertex is removed (See deleteVertex() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the vertex is storedvertex- Vertex to be removed
-
addEdge
public void addEdge(Graph graph, Edge edge, Edge old)
Add Edge to existing Graph. Old edge is remove first. This method is called when a Connected Edge is created (See addEdge() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the edge will be storededge- Edge to be inserted in the graphold- Old edge when performing an update. Must be null for a simple addition
-
deleteEdge
public void deleteEdge(Graph graph, Edge edge)
Remove Edge to existing Graph. This method is called when a Connected Edge is removed (See deleteEdge() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the edge is storededge- Edge to be removed
-
addPrefix
public void addPrefix(Graph graph, Prefix prefix)
Add Prefix to existing Graph. This method is called when a Prefix is added to a Connected Vertex (See addPrefix() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the prefix will be storedprefix- Prefix to be interted in the graph
-
deletePrefix
public void deletePrefix(Graph graph, Prefix prefix)
Remove Prefix to existing Graph. This method is called when a Prefix is removed from a Connected Vertex (See deletePrefix() method from ConnectedGraph Interface).- Parameters:
graph- Graph where the prefix is storedprefix- Prefix to be removed
-
onTransactionChainFailed
public void onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)- Specified by:
onTransactionChainFailedin interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
onTransactionChainSuccessful
public void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
- Specified by:
onTransactionChainSuccessfulin interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
getConnectedGraphs
public List<ConnectedGraph> getConnectedGraphs()
Description copied from interface:ConnectedGraphProviderReturns all registered Connected Graphs.- Specified by:
getConnectedGraphsin interfaceConnectedGraphProvider- Returns:
- List of Connected Graph
-
getConnectedGraph
public ConnectedGraph getConnectedGraph(GraphKey key)
Description copied from interface:ConnectedGraphProviderReturns Connected Graph for the given graph key.- Specified by:
getConnectedGraphin interfaceConnectedGraphProvider- Parameters:
key- Unique Graph Identifier- Returns:
- Connected Graph
-
getConnectedGraph
public ConnectedGraph getConnectedGraph(String name)
Description copied from interface:ConnectedGraphProviderReturns Connected Graph for the given graph name.- Specified by:
getConnectedGraphin interfaceConnectedGraphProvider- Parameters:
name- Name of the Graph- Returns:
- Connected Graph
-
getGraph
public Graph getGraph(GraphKey key)
Description copied from interface:ConnectedGraphProviderReturns the Graph for the given graph key.- Specified by:
getGraphin interfaceConnectedGraphProvider- Parameters:
key- Unique Graph Identifier- Returns:
- Graph
-
getGraph
public Graph getGraph(String name)
Description copied from interface:ConnectedGraphProviderReturns Graph for the given graph name.- Specified by:
getGraphin interfaceConnectedGraphProvider- Parameters:
name- Name of the Graph- Returns:
- Graph
-
createConnectedGraph
public ConnectedGraph createConnectedGraph(String name, Graph.DomainScope scope)
Description copied from interface:ConnectedGraphProviderCreate Connected Graph and associated Graph for given name and Graph Type. The associated Graph is also stored in the DataStore.- Specified by:
createConnectedGraphin interfaceConnectedGraphProvider- Parameters:
name- Name of the Graphscope- Domain scope of the Graph (Intra or Inter domain)- Returns:
- Connected Graph
-
addGraph
public ConnectedGraph addGraph(Graph graph)
Description copied from interface:ConnectedGraphProviderAdd a Graph. This action will automatically create the associated Connected Graph and store is in the DataStore.- Specified by:
addGraphin interfaceConnectedGraphProvider- Parameters:
graph- Graph to be added- Returns:
- Connected Graph
-
deleteGraph
public void deleteGraph(GraphKey key)
Description copied from interface:ConnectedGraphProviderRemove a Graph. This action will automatically delete the associated Connected Graph and store is in the DataStore.- Specified by:
deleteGraphin interfaceConnectedGraphProvider- Parameters:
key- Graph Identifier
-
-