Class OrientGraphFactory
java.lang.Object
com.tinkerpop.blueprints.impls.orient.OrientConfigurableGraph
com.tinkerpop.blueprints.impls.orient.OrientGraphFactory
Orient Graph factory. It supports also a pool of instances that are recycled.
- Author:
- Luca Garulli
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.tinkerpop.blueprints.impls.orient.OrientConfigurableGraph
OrientConfigurableGraph.Settings, OrientConfigurableGraph.THREAD_MODE -
Field Summary
Fields inherited from class com.tinkerpop.blueprints.impls.orient.OrientConfigurableGraph
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 Summary
ConstructorsConstructorDescriptionOrientGraphFactory(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. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all pooled databases and clear the pool.voiddeclareIntent(OIntent iIntent) voiddrop()Drops current database if such one exists.booleanexists()Check if the database with path given to the factory exists.intReturns the number of available instances in the pool.intReturns the total number of instances created in the pool.Gives new connection to database.getDatabase(boolean iCreate, boolean iOpen) Gives new connection to database.getNoTx()Gets non transactional graph with the database from pool if pool is configured.getProperty(String iName) Gets the property value.getTx()Gets transactional graph with the database from pool if pool is configured.protected voidstatic voidsetProperty(String iName, Object iValue) Sets a property valuestatic voidsetupPool(int iMin, int iMax) Setting up the factory to use database pool instead of creation a new instance of database connection each time.Methods inherited from class com.tinkerpop.blueprints.impls.orient.OrientConfigurableGraph
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
-
Constructor Details
-
OrientGraphFactory
Creates a factory that use default admin credentials and pool with maximum amount of connections equal to amount of CPU cores.- Parameters:
iURL- to the database
-
OrientGraphFactory
Creates a factory that use default admin credentials and pool with maximum amount of connections equal to amount of CPU cores if needed.- Parameters:
iURL- to the databasecreatePool- flag which indicates whether pool should be created.
-
OrientGraphFactory
Creates a factory with given credentials and pool with maximum amount of connections equal to amount of CPU cores.If you wish to change pool settings call com.tinkerpop.blueprints.impls.orient.OrientGraphFactory#setupPool(int, int) method.
- Parameters:
iURL- to the databaseiUser- name of the useriPassword- of the user
-
OrientGraphFactory
Creates a factory with given credentials and pool with maximum amount of connections equal to amount of CPU cores if that is needed.If you wish to change pool settings call com.tinkerpop.blueprints.impls.orient.OrientGraphFactory#setupPool(int, int) method.
- Parameters:
iURL- to the databaseiUser- name of the useriPassword- of the usercreatePool- flag which indicates whether pool should be created.
-
OrientGraphFactory
public 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. It is mandatory to use the same pool for document and graph databases.- Parameters:
iURL- to the databaseiUser- name of the useriPassword- password of the userpool- Pool which is used in "document part" of your application.
-
-
Method Details
-
close
public void close()Closes all pooled databases and clear the pool. -
drop
public void drop()Drops current database if such one exists. -
getTx
Gets transactional graph with the database from pool if pool is configured. Otherwise creates a graph with new db instance. The Graph instance inherits the factory's configuration.- Returns:
- transactional graph
-
getNoTx
Gets non transactional graph with the database from pool if pool is configured. Otherwise creates a graph with new db instance. The Graph instance inherits the factory's configuration.- Returns:
- non transactional graph
-
getTxGraphImplFactory
-
setTxGraphImplFactory
-
getNoTxGraphImplFactory
-
setNoTxGraphImplFactory
-
getDatabase
Gives new connection to database. If current factory configured to use pool (seesetupPool(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)- Returns:
- database.
-
getDatabase
Gives new connection to database. If current factory configured to use pool (seesetupPool(int, int)method), retrieves connection from pool. Otherwise creates new connection each time.- Parameters:
iCreate- if true automatically creates database if database with given URL does not existiOpen- if true automatically opens the database- Returns:
- database
-
exists
public boolean exists()Check if the database with path given to the factory exists.this api can be used only in embedded mode, and has no need of authentication.
- Returns:
- true if database is exists
-
setupPool
Setting up the factory to use database pool instead of creation a new instance of database connection each time.- Parameters:
iMin- minimum size of pooliMax- maximum size of pool- Returns:
- this
-
getAvailableInstancesInPool
public int getAvailableInstancesInPool()Returns the number of available instances in the pool. -
getCreatedInstancesInPool
public int getCreatedInstancesInPool()Returns the total number of instances created in the pool. -
declareIntent
- Specified by:
declareIntentin classOrientConfigurableGraph
-
initGraph
-
setProperty
Sets a property value- Specified by:
setPropertyin classOrientConfigurableGraph- Parameters:
iName- Property nameiValue- new value to set- Returns:
- The previous value if any, otherwise null
-
getProperty
Gets the property value.- Specified by:
getPropertyin classOrientConfigurableGraph- Parameters:
iName- Property name- Returns:
- The previous value if any, otherwise null
-
getProperties
- Specified by:
getPropertiesin classOrientConfigurableGraph
-