Class SimpleGraph
- java.lang.Object
-
- org.opennms.features.topology.api.topo.simple.SimpleGraph
-
- All Implemented Interfaces:
NamespaceAware
,BackendGraph
- Direct Known Subclasses:
BusinessServiceGraph
,LegacyBackendGraph
public class SimpleGraph extends Object implements BackendGraph
-
-
Constructor Summary
Constructors Constructor Description SimpleGraph(String namespace)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(Collection<Vertex> vertices)
void
add(List<Edge> edges)
void
add(Edge... edges)
void
add(Vertex... vertices)
void
addEdgeListener(EdgeListener edgeListener)
void
addEdges(Edge... edges)
void
addVertexListener(VertexListener vertexListener)
void
addVertices(Vertex... vertices)
void
clearEdges()
void
clearVertices()
Edge
connectVertices(String edgeId, VertexRef sourceVertextId, VertexRef targetVertextId)
protected AbstractEdge
connectVertices(String edgeId, VertexRef sourceVertexRef, VertexRef targetVertexRef, String namespace)
boolean
containsVertexId(String id)
Deprecated.You should search by the namespace and ID tuple insteadboolean
containsVertexId(VertexRef id, Criteria... criteria)
boolean
contributesTo(String namespace)
Defines if the current implementation contributes to the given namespace.Edge
getEdge(String namespace, String id)
Edge
getEdge(EdgeRef reference)
EdgeRef[]
getEdgeIdsForVertex(VertexRef vertex)
Map<VertexRef,Set<EdgeRef>>
getEdgeIdsForVertices(VertexRef... vertices)
This function can be used for efficiency when you need theEdgeRef
instances for a large number of vertices.List<Edge>
getEdges(Collection<? extends EdgeRef> references)
Return an immutable list of all edges that match this set of references.List<Edge>
getEdges(Criteria... criteria)
Return an immutable list of edges that match the criteria.int
getEdgeTotalCount()
String
getNamespace()
A string used to identify references belonging to this provider May only contain characters that make for a reasonable Java identifier such as letters digits and underscore (no colons, periods, commas etc.)Vertex
getVertex(String namespace, String id)
Vertex
getVertex(VertexRef reference, Criteria... criteria)
int
getVertexTotalCount()
List<Vertex>
getVertices(Collection<? extends VertexRef> references, Criteria... criteria)
List<Vertex>
getVertices(Criteria... criteria)
Return an immutable list of vertices that match the criteria.void
remove(EdgeRef... edges)
void
remove(VertexRef... vertices)
void
removeEdgeListener(EdgeListener edgeListener)
void
removeEdges(EdgeRef... edges)
void
removeVertex(VertexRef... vertexId)
void
removeVertexListener(VertexListener vertexListener)
void
resetContainer()
void
setEdges(List<Edge> edges)
void
setVertices(List<Vertex> vertices)
-
-
-
Constructor Detail
-
SimpleGraph
public SimpleGraph(String namespace)
-
-
Method Detail
-
getNamespace
public String getNamespace()
Description copied from interface:NamespaceAware
A string used to identify references belonging to this provider May only contain characters that make for a reasonable Java identifier such as letters digits and underscore (no colons, periods, commas etc.)- Specified by:
getNamespace
in interfaceNamespaceAware
- Returns:
- the namespace, e.g. "nodes".
-
contributesTo
public boolean contributesTo(String namespace)
Description copied from interface:NamespaceAware
Defines if the current implementation contributes to the given namespace. This is usually the case, when the given namespaces equalsNamespaceAware.getNamespace()
, but is not a requirement.- Specified by:
contributesTo
in interfaceNamespaceAware
- Parameters:
namespace
- the namespace to contribute to- Returns:
true
, if the current implementation contributes to the given namespace, otherwisefalse
.
-
getVertex
public Vertex getVertex(String namespace, String id)
- Specified by:
getVertex
in interfaceBackendGraph
-
getVertex
public Vertex getVertex(VertexRef reference, Criteria... criteria)
- Specified by:
getVertex
in interfaceBackendGraph
-
getVertices
public List<Vertex> getVertices(Collection<? extends VertexRef> references, Criteria... criteria)
- Specified by:
getVertices
in interfaceBackendGraph
-
addVertexListener
public void addVertexListener(VertexListener vertexListener)
- Specified by:
addVertexListener
in interfaceBackendGraph
-
removeVertexListener
public void removeVertexListener(VertexListener vertexListener)
- Specified by:
removeVertexListener
in interfaceBackendGraph
-
add
public void add(Vertex... vertices)
-
add
public void add(Collection<Vertex> vertices)
-
remove
public void remove(VertexRef... vertices)
-
getVertices
public List<Vertex> getVertices(Criteria... criteria)
Description copied from interface:BackendGraph
Return an immutable list of vertices that match the criteria.- Specified by:
getVertices
in interfaceBackendGraph
-
clearVertices
public void clearVertices()
- Specified by:
clearVertices
in interfaceBackendGraph
-
getVertexTotalCount
public int getVertexTotalCount()
- Specified by:
getVertexTotalCount
in interfaceBackendGraph
-
containsVertexId
public boolean containsVertexId(String id)
Deprecated.You should search by the namespace and ID tuple instead- Specified by:
containsVertexId
in interfaceBackendGraph
-
containsVertexId
public boolean containsVertexId(VertexRef id, Criteria... criteria)
- Specified by:
containsVertexId
in interfaceBackendGraph
-
getEdge
public Edge getEdge(String namespace, String id)
- Specified by:
getEdge
in interfaceBackendGraph
-
getEdge
public Edge getEdge(EdgeRef reference)
- Specified by:
getEdge
in interfaceBackendGraph
-
getEdges
public List<Edge> getEdges(Collection<? extends EdgeRef> references)
Description copied from interface:BackendGraph
Return an immutable list of all edges that match this set of references.- Specified by:
getEdges
in interfaceBackendGraph
-
addEdgeListener
public void addEdgeListener(EdgeListener edgeListener)
- Specified by:
addEdgeListener
in interfaceBackendGraph
-
removeEdgeListener
public void removeEdgeListener(EdgeListener edgeListener)
- Specified by:
removeEdgeListener
in interfaceBackendGraph
-
getEdges
public List<Edge> getEdges(Criteria... criteria)
Description copied from interface:BackendGraph
Return an immutable list of edges that match the criteria.- Specified by:
getEdges
in interfaceBackendGraph
-
clearEdges
public void clearEdges()
- Specified by:
clearEdges
in interfaceBackendGraph
-
getEdgeTotalCount
public int getEdgeTotalCount()
- Specified by:
getEdgeTotalCount
in interfaceBackendGraph
-
add
public void add(Edge... edges)
-
remove
public void remove(EdgeRef... edges)
-
addVertices
public void addVertices(Vertex... vertices)
- Specified by:
addVertices
in interfaceBackendGraph
-
removeVertex
public void removeVertex(VertexRef... vertexId)
- Specified by:
removeVertex
in interfaceBackendGraph
-
getEdgeIdsForVertex
public EdgeRef[] getEdgeIdsForVertex(VertexRef vertex)
- Specified by:
getEdgeIdsForVertex
in interfaceBackendGraph
-
getEdgeIdsForVertices
public final Map<VertexRef,Set<EdgeRef>> getEdgeIdsForVertices(VertexRef... vertices)
Description copied from interface:BackendGraph
This function can be used for efficiency when you need theEdgeRef
instances for a large number of vertices.- Specified by:
getEdgeIdsForVertices
in interfaceBackendGraph
-
addEdges
public void addEdges(Edge... edges)
- Specified by:
addEdges
in interfaceBackendGraph
-
removeEdges
public void removeEdges(EdgeRef... edges)
- Specified by:
removeEdges
in interfaceBackendGraph
-
connectVertices
public Edge connectVertices(String edgeId, VertexRef sourceVertextId, VertexRef targetVertextId)
- Specified by:
connectVertices
in interfaceBackendGraph
-
resetContainer
public void resetContainer()
- Specified by:
resetContainer
in interfaceBackendGraph
-
connectVertices
protected final AbstractEdge connectVertices(String edgeId, VertexRef sourceVertexRef, VertexRef targetVertexRef, String namespace)
-
-