Search in sources :

Example 1 with OrientDbContextExtension

use of org.openkilda.persistence.orientdb.OrientDbContextExtension in project open-kilda by telstra.

the class GraphSupplier method get.

@Override
public OrientGraph get() {
    PersistenceContext context = PersistenceContextManager.INSTANCE.getContextCreateIfMissing();
    OrientDbContextExtension contextExtension = implementation.getContextExtension(context);
    DelegatingFramedGraph<OrientGraph> wrapper = contextExtension.getGraphCreateIfMissing();
    if (wrapper == null) {
        throw new PersistenceException("Failed to obtain a framed graph");
    }
    return wrapper.getBaseGraph();
}
Also used : OrientGraph(org.apache.tinkerpop.gremlin.orientdb.OrientGraph) OrientDbContextExtension(org.openkilda.persistence.orientdb.OrientDbContextExtension) PersistenceException(org.openkilda.persistence.exceptions.PersistenceException) PersistenceContext(org.openkilda.persistence.context.PersistenceContext)

Example 2 with OrientDbContextExtension

use of org.openkilda.persistence.orientdb.OrientDbContextExtension in project open-kilda by telstra.

the class DatabaseSupportImpl method getGraph.

private FramedGraph getGraph() {
    PersistenceContext context = PersistenceContextManager.INSTANCE.getContextCreateIfMissing();
    OrientDbContextExtension contextExtension = orientPersistenceImplementation.getContextExtension(context);
    return contextExtension.getGraphCreateIfMissing();
}
Also used : OrientDbContextExtension(org.openkilda.persistence.orientdb.OrientDbContextExtension) PersistenceContext(org.openkilda.persistence.context.PersistenceContext)

Aggregations

PersistenceContext (org.openkilda.persistence.context.PersistenceContext)2 OrientDbContextExtension (org.openkilda.persistence.orientdb.OrientDbContextExtension)2 OrientGraph (org.apache.tinkerpop.gremlin.orientdb.OrientGraph)1 PersistenceException (org.openkilda.persistence.exceptions.PersistenceException)1