public class OrientGraphFactory extends Object
OrientGraph. OrientGraph is a Blueprints implementation of the graph database OrientDB
(http://www.orientechnologies.com).
By default creates new connection for each graph, but could be configured to use database pool.
Thread safe after set up.| Modifier and Type | Field and Description |
|---|---|
protected String |
password |
protected ODatabaseDocumentPool |
pool |
protected boolean |
transactional |
protected String |
url |
protected String |
user |
| Constructor and Description |
|---|
OrientGraphFactory(String iURL)
Creates a factory that use default admin credentials.
|
OrientGraphFactory(String iURL,
String iUser,
String iPassword)
Creates a factory with given credentials.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all pooled databases and clear the pool.
|
void |
drop()
Drops current database if such one exists.
|
boolean |
exists()
Check if the database with path given to the factory exists.
|
protected void |
finalize() |
OrientBaseGraph |
get()
|
int |
getAvailableInstancesInPool()
Returns the number of available instances in the pool.
|
ODatabaseDocumentTx |
getDatabase()
Gives new connection to database.
|
ODatabaseDocumentTx |
getDatabase(boolean iCreate)
Gives new connection to database.
|
OrientGraphNoTx |
getNoTx()
Gets non transactional graph with the database from pool if pool is configured.
|
OrientGraph |
getTx()
Gets transactional graph with the database from pool if pool is configured.
|
boolean |
isTransactional() |
OrientGraphFactory |
setTransactional(boolean transactional)
Configure current factory to create transactional of non transactional graphs by default.
|
OrientGraphFactory |
setupPool(int iMin,
int iMax)
Setting up the factory to use database pool instead of creation a new instance of database connection each time.
|
protected final String url
protected final String user
protected final String password
protected volatile ODatabaseDocumentPool pool
protected volatile boolean transactional
public OrientGraphFactory(String iURL)
iURL - to the databasepublic void close()
public void drop()
ODatabaseException - if there is no current database.public OrientBaseGraph get()
getTx() or getNoTx(). By default the factory configured to return
transactional graph. Use setTransactional(boolean) to change the behaviourpublic OrientGraph getTx()
public OrientGraphNoTx getNoTx()
public ODatabaseDocumentTx getDatabase()
setupPool(int, int) method),
retrieves connection from pool. Otherwise creates new connection each time.
Automatically creates database if database with given URL does not exist
Shortcut for getDatabase(true)public ODatabaseDocumentTx getDatabase(boolean iCreate)
setupPool(int, int) method),
retrieves connection from pool. Otherwise creates new connection each time.iCreate - if true automatically creates database if database with given URL does not existpublic boolean exists()
public OrientGraphFactory setupPool(int iMin, int iMax)
iMin - minimum size of pooliMax - maximum size of poolpublic boolean isTransactional()
get()public OrientGraphFactory setTransactional(boolean transactional)
transactional - defines should the factory return transactional graph by default.get()public int getAvailableInstancesInPool()
Copyright © 2009-2014 Orient Technologies. All Rights Reserved.