Package org.opendaylight.graph.impl
Class ConnectedGraphServer
- java.lang.Object
-
- org.opendaylight.graph.impl.ConnectedGraphServer
-
- All Implemented Interfaces:
EventListener
,ConnectedGraphProvider
,org.opendaylight.mdsal.binding.api.TransactionChainListener
public class ConnectedGraphServer extends Object implements ConnectedGraphProvider, org.opendaylight.mdsal.binding.api.TransactionChainListener
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 void
addEdge(Graph graph, Edge edge, Edge old)
Add Edge to existing Graph.ConnectedGraph
addGraph(Graph graph)
Add a Graph.void
addPrefix(Graph graph, Prefix prefix)
Add Prefix to existing Graph.void
addVertex(Graph graph, Vertex vertex, Vertex old)
Add Vertex to existing Graph.void
clearGraph(Graph graph)
Clear Graph.void
close()
Remove the Operation Graph Model and destroy the transaction chain.ConnectedGraph
createConnectedGraph(String name, Graph.DomainScope scope)
Create Connected Graph and associated Graph for given name and Graph Type.void
deleteEdge(Graph graph, Edge edge)
Remove Edge to existing Graph.void
deleteGraph(GraphKey key)
Remove a Graph.void
deletePrefix(Graph graph, Prefix prefix)
Remove Prefix to existing Graph.void
deleteVertex(Graph graph, Vertex vertex)
Remove Vertex to existing Graph.ConnectedGraph
getConnectedGraph(String name)
Returns Connected Graph for the given graph name.ConnectedGraph
getConnectedGraph(GraphKey key)
Returns Connected Graph for the given graph key.ArrayList<ConnectedGraph>
getConnectedGraphs()
Returns all registered Connected Graphs.Graph
getGraph(String name)
Returns Graph for the given graph name.Graph
getGraph(GraphKey key)
Returns the Graph for the given graph key.void
init()
Initialization of the Graph Model Server.void
onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
void
onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
protected void
resetTransactionChain()
Reset the transaction chain only so that the PingPong transaction chain will become usable again.
-
-
-
Method Detail
-
init
public void init()
Initialization of the Graph Model Server. This method is called through the blueprint.
-
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
-
close
public void close()
Remove the Operation Graph Model and destroy the transaction chain.
-
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 final void onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
- Specified by:
onTransactionChainFailed
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
onTransactionChainSuccessful
public final void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
- Specified by:
onTransactionChainSuccessful
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
getConnectedGraphs
public ArrayList<ConnectedGraph> getConnectedGraphs()
Description copied from interface:ConnectedGraphProvider
Returns all registered Connected Graphs.- Specified by:
getConnectedGraphs
in interfaceConnectedGraphProvider
- Returns:
- List of Connected Graph
-
getConnectedGraph
public ConnectedGraph getConnectedGraph(GraphKey key)
Description copied from interface:ConnectedGraphProvider
Returns Connected Graph for the given graph key.- Specified by:
getConnectedGraph
in interfaceConnectedGraphProvider
- Parameters:
key
- Unique Graph Identifier- Returns:
- Connected Graph
-
getConnectedGraph
public ConnectedGraph getConnectedGraph(String name)
Description copied from interface:ConnectedGraphProvider
Returns Connected Graph for the given graph name.- Specified by:
getConnectedGraph
in interfaceConnectedGraphProvider
- Parameters:
name
- Name of the Graph- Returns:
- Connected Graph
-
getGraph
public Graph getGraph(GraphKey key)
Description copied from interface:ConnectedGraphProvider
Returns the Graph for the given graph key.- Specified by:
getGraph
in interfaceConnectedGraphProvider
- Parameters:
key
- Unique Graph Identifier- Returns:
- Graph
-
getGraph
public Graph getGraph(String name)
Description copied from interface:ConnectedGraphProvider
Returns Graph for the given graph name.- Specified by:
getGraph
in interfaceConnectedGraphProvider
- Parameters:
name
- Name of the Graph- Returns:
- Graph
-
createConnectedGraph
public ConnectedGraph createConnectedGraph(String name, Graph.DomainScope scope)
Description copied from interface:ConnectedGraphProvider
Create Connected Graph and associated Graph for given name and Graph Type. The associated Graph is also stored in the DataStore.- Specified by:
createConnectedGraph
in 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:ConnectedGraphProvider
Add a Graph. This action will automatically create the associated Connected Graph and store is in the DataStore.- Specified by:
addGraph
in interfaceConnectedGraphProvider
- Parameters:
graph
- Graph to be added- Returns:
- Connected Graph
-
deleteGraph
public void deleteGraph(GraphKey key)
Description copied from interface:ConnectedGraphProvider
Remove a Graph. This action will automatically delete the associated Connected Graph and store is in the DataStore.- Specified by:
deleteGraph
in interfaceConnectedGraphProvider
- Parameters:
key
- Graph Identifier
-
-