Class OrientGraphFactory

java.lang.Object
org.apache.tinkerpop.gremlin.orientdb.OrientGraphFactory
All Implemented Interfaces:
AutoCloseable, OrientGraphBaseFactory

public final class OrientGraphFactory extends Object implements AutoCloseable, OrientGraphBaseFactory
  • Field Details

    • ADMIN

      public static final String ADMIN
      See Also:
    • connectionURI

      protected String connectionURI
    • dbName

      protected String dbName
    • user

      protected final String user
    • password

      protected final String password
    • configuration

      protected org.apache.commons.configuration2.Configuration configuration
    • pool

      protected volatile OPartitionedReCreatableDatabasePool pool
    • labelAsClassName

      protected boolean labelAsClassName
    • type

      protected Optional<ODatabaseType> type
    • factory

      protected OrientDB factory
    • shouldCloseOrientDB

      protected boolean shouldCloseOrientDB
  • Constructor Details

    • OrientGraphFactory

      public OrientGraphFactory(OrientDB orientdb, String dbName, ODatabaseType type, String user, String password)
    • OrientGraphFactory

      public OrientGraphFactory()
    • OrientGraphFactory

      public OrientGraphFactory(String url)
    • OrientGraphFactory

      public OrientGraphFactory(String url, ODatabaseType type)
    • OrientGraphFactory

      public OrientGraphFactory(String url, String user, String password)
    • OrientGraphFactory

      public OrientGraphFactory(String url, String user, String password, ODatabaseType type)
    • OrientGraphFactory

      public OrientGraphFactory(org.apache.commons.configuration2.Configuration config)
  • Method Details

    • getNoTx

      public OrientGraph getNoTx(boolean create, boolean open)
      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.
      Parameters:
      create - if true automatically creates database if database with given URL does not exist
      open - if true automatically opens the database
    • getNoTx

      public OrientGraph getNoTx()
      Specified by:
      getNoTx in interface OrientGraphBaseFactory
    • getTx

      public OrientGraph getTx(boolean create, boolean open)
    • getTx

      public OrientGraph getTx()
      Specified by:
      getTx in interface OrientGraphBaseFactory
    • getGraph

      protected OrientGraph getGraph(boolean create, boolean open, boolean transactional)
    • initGraph

      protected void initGraph(OrientGraph g)
    • getConfiguration

      protected org.apache.commons.configuration2.Configuration getConfiguration(boolean create, boolean open, boolean transactional)
    • getDatabase

      public ODatabaseDocument getDatabase(boolean create, boolean open)
      Specified by:
      getDatabase in interface OrientGraphBaseFactory
      Parameters:
      create - if true automatically creates database if database with given URL does not exist
      open - if true automatically opens the database
    • acquireFromPool

      protected ODatabaseDocument acquireFromPool(boolean create, boolean open)
      Parameters:
      create - if true automatically creates database if database with given URL does not exist
      open - if true automatically opens the database
    • setLabelAsClassName

      public OrientGraphBaseFactory setLabelAsClassName(boolean is)
      Enable or disable the prefixing of class names with V_<label> for vertices or E_<label> for edges.
      Parameters:
      is - if true classname equals label, if false classname is prefixed with V_ or E_ (default)
    • setupPool

      public OrientGraphBaseFactory setupPool(int max)
      Setting up the factory to use database pool instead of creation a new instance of database connection each time.
    • setupPool

      public OrientGraphFactory setupPool(int maxPartitionSize, int max)
    • pool

    • close

      public void close()
      Closes all pooled databases and clear the pool.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface OrientGraphBaseFactory
    • drop

      public void drop()
      Specified by:
      drop in interface OrientGraphBaseFactory
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface OrientGraphBaseFactory