public class OrientGraphFactory extends OrientConfigurableGraph
Modifier and Type | Class and Description |
---|---|
static interface |
OrientGraphFactory.OrientGraphImplFactory |
OrientConfigurableGraph.Settings, OrientConfigurableGraph.THREAD_MODE
AUTO_SCALE_EDGE_TYPE_DEFAULT, AUTO_START_TX_DEFAULT, EDGE_CONTAINER_EMBEDDED_2_TREE_THRESHOLD_DEFAULT, EDGE_CONTAINER_TREE_2_EMBEDDED_THRESHOLD_DEFAULT, KEEP_IN_MEMORY_REFERENCES_DEFAULT, REQUIRE_TRANSACTION_DEFAULT, SAVE_ORIGINAL_IDS_DEFAULT, settings, STANDARD_ELEMENT_CONSTRAINTS_DEFAULT, STANDARD_EXCEPTIONS, STANDARD_MAX_RETRIES, STANDARD_TX_REQUIRE_FOR_SQL_OPERATIONS, THREAD_MODE_DEFAULT, USE_CLASS_FOR_EDGE_LABEL_DEFAULT, USE_CLASS_FOR_VERTEX_LABEL_DEFAULT, USE_LIGHTWEIGHT_EDGES_DEFAULT, USE_LOG_DEFAULT, USE_VERTEX_FIELDS_FOR_EDGE_LABELS, WARN_ON_FORCE_CLOSING_TX_DEFAULT
Constructor and Description |
---|
OrientGraphFactory(String iURL)
Creates a factory that use default admin credentials and pool with maximum amount of
connections equal to amount of CPU cores.
|
OrientGraphFactory(String iURL,
boolean createPool)
Creates a factory that use default admin credentials and pool with maximum amount of
connections equal to amount of CPU cores if needed.
|
OrientGraphFactory(String iURL,
String iUser,
String iPassword)
Creates a factory with given credentials and pool with maximum amount of connections equal to
amount of CPU cores.
|
OrientGraphFactory(String iURL,
String iUser,
String iPassword,
boolean createPool)
Creates a factory with given credentials and pool with maximum amount of connections equal to
amount of CPU cores if that is needed.
|
OrientGraphFactory(String iURL,
String iUser,
String iPassword,
OPartitionedDatabasePool pool)
Creates a factory with given credentials also you may pass pool which you already use in
"document part" of your application.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all pooled databases and clear the pool.
|
void |
declareIntent(OIntent iIntent) |
void |
drop()
Drops current database if such one exists.
|
boolean |
exists()
Check if the database with path given to the factory exists.
|
int |
getAvailableInstancesInPool()
Returns the number of available instances in the pool.
|
int |
getCreatedInstancesInPool()
Returns the total number of instances created in the pool.
|
ODatabaseDocumentTx |
getDatabase()
Gives new connection to database.
|
ODatabaseDocumentTx |
getDatabase(boolean iCreate,
boolean iOpen)
Gives new connection to database.
|
OrientGraphNoTx |
getNoTx()
Gets non transactional graph with the database from pool if pool is configured.
|
static OrientGraphFactory.OrientGraphImplFactory |
getNoTxGraphImplFactory() |
protected Map<String,Object> |
getProperties() |
Object |
getProperty(String iName)
Gets the property value.
|
OrientGraph |
getTx()
Gets transactional graph with the database from pool if pool is configured.
|
static OrientGraphFactory.OrientGraphImplFactory |
getTxGraphImplFactory() |
protected void |
initGraph(OrientBaseGraph g) |
static void |
setNoTxGraphImplFactory(OrientGraphFactory.OrientGraphImplFactory factory) |
Object |
setProperty(String iName,
Object iValue)
Sets a property value
|
static void |
setTxGraphImplFactory(OrientGraphFactory.OrientGraphImplFactory factory) |
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.
|
getConnectionStrategy, getEdgeContainerEmbedded2TreeThreshold, getEdgeContainerTree2EmbeddedThreshold, getMaxRetries, getThreadMode, init, isAutoScaleEdgeType, isAutoStartTx, isKeepInMemoryReferences, isRequireTransaction, isSaveOriginalIds, isStandardElementConstraints, isStandardExceptions, isTxRequiredForSQLGraphOperations, isUseClassForEdgeLabel, isUseClassForVertexLabel, isUseLightweightEdges, isUseVertexFieldsForEdgeLabels, isWarnOnForceClosingTx, setAutoScaleEdgeType, setAutoStartTx, setConnectionStrategy, setEdgeContainerEmbedded2TreeThreshold, setEdgeContainerTree2EmbeddedThreshold, setKeepInMemoryReferences, setMaxRetries, setRequireTransaction, setSaveOriginalIds, setStandardElementConstraints, setStandardExceptions, setThreadMode, setTxRequiredForSQLGraphOperations, setUseClassForEdgeLabel, setUseClassForVertexLabel, setUseLightweightEdges, setUseLog, setUseVertexFieldsForEdgeLabels, setWarnOnForceClosingTx
public OrientGraphFactory(String iURL)
iURL
- to the databasepublic OrientGraphFactory(String iURL, boolean createPool)
iURL
- to the databasecreatePool
- flag which indicates whether pool should be created.public OrientGraphFactory(String iURL, String iUser, String iPassword)
If you wish to change pool settings call com.tinkerpop.blueprints.impls.orient.OrientGraphFactory#setupPool(int, int) method.
iURL
- to the databaseiUser
- name of the useriPassword
- of the userpublic OrientGraphFactory(String iURL, String iUser, String iPassword, boolean createPool)
If you wish to change pool settings call com.tinkerpop.blueprints.impls.orient.OrientGraphFactory#setupPool(int, int) method.
iURL
- to the databaseiUser
- name of the useriPassword
- of the usercreatePool
- flag which indicates whether pool should be created.public OrientGraphFactory(String iURL, String iUser, String iPassword, OPartitionedDatabasePool pool)
iURL
- to the databaseiUser
- name of the useriPassword
- password of the userpool
- Pool which is used in "document part" of your application.public void close()
public void drop()
public OrientGraph getTx()
public OrientGraphNoTx getNoTx()
public static OrientGraphFactory.OrientGraphImplFactory getTxGraphImplFactory()
public static void setTxGraphImplFactory(OrientGraphFactory.OrientGraphImplFactory factory)
public static OrientGraphFactory.OrientGraphImplFactory getNoTxGraphImplFactory()
public static void setNoTxGraphImplFactory(OrientGraphFactory.OrientGraphImplFactory factory)
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, boolean iOpen)
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 existiOpen
- if true automatically opens the databasepublic boolean exists()
this api can be used only in embedded mode, and has no need of authentication.
public OrientGraphFactory setupPool(int iMin, int iMax)
iMin
- minimum size of pooliMax
- maximum size of poolpublic int getAvailableInstancesInPool()
public int getCreatedInstancesInPool()
public void declareIntent(OIntent iIntent)
declareIntent
in class OrientConfigurableGraph
protected void initGraph(OrientBaseGraph g)
public Object setProperty(String iName, Object iValue)
setProperty
in class OrientConfigurableGraph
iName
- Property nameiValue
- new value to setpublic Object getProperty(String iName)
getProperty
in class OrientConfigurableGraph
iName
- Property nameprotected Map<String,Object> getProperties()
getProperties
in class OrientConfigurableGraph
Copyright © 2009–2020 OrientDB. All rights reserved.