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 Details

    • ConnectedGraphServer

      @Inject public ConnectedGraphServer(org.opendaylight.mdsal.binding.api.DataBroker dataBroker)
  • Method Details

    • close

      @PreDestroy public void close()
      Remove the Operation Graph Model and destroy the transaction chain.
      Specified by:
      close in interface AutoCloseable
    • 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 stored
      vertex - Vertex to be inserted in the graph
      old - 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 stored
      vertex - 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 stored
      edge - Edge to be inserted in the graph
      old - 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 stored
      edge - 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 stored
      prefix - 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 stored
      prefix - 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:
      onTransactionChainFailed in interface org.opendaylight.mdsal.binding.api.TransactionChainListener
    • onTransactionChainSuccessful

      public void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain transactionChain)
      Specified by:
      onTransactionChainSuccessful in interface org.opendaylight.mdsal.binding.api.TransactionChainListener
    • getConnectedGraphs

      public List<ConnectedGraph> getConnectedGraphs()
      Description copied from interface: ConnectedGraphProvider
      Returns all registered Connected Graphs.
      Specified by:
      getConnectedGraphs in interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      Parameters:
      name - Name of the Graph
      scope - 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 interface ConnectedGraphProvider
      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 interface ConnectedGraphProvider
      Parameters:
      key - Graph Identifier