org.randombits.confluence.metadata.indexing.graph.IndexDatabase Maven / Gradle / Ivy
package org.randombits.confluence.metadata.indexing.graph;
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
/**
* An interface to interact with the index database.
*
* @author longyc
* @since 7.2.0.20150414
*/
public interface IndexDatabase {
/**
* Interface required to be executed by DatabaseBean#executeTransaction().
*
* @param
*/
interface Transaction {
/**
* Logic to be executed within a database transaction.
*
* @param graph A connection to the index database which will be released after execution.
* @return T
* @throws Exception
*/
T execute(OrientGraph graph) throws Exception;
}
/**
* Execute and commit the transaction, rollback on exception.
*
* @param transaction
* @param
* @return T
*/
T executeTransaction(Transaction transaction);
/**
* Initialize OrientDB factory with default settings.
*
* @return OrientGraphFactory
*/
OrientGraphFactory initializeFactory();
/**
* Stop all connections to the database.
*/
void shutdownFactory();
}