Interface Driver

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AbstractConfigurableDriver

public interface Driver extends AutoCloseable
Author:
Vince Bickers, Mark Angrish, Michael J. Simons
  • Method Details

    • configure

      void configure(Configuration config)
    • getTransactionFactorySupplier

      Returns:
      A factory method for creating suppliers of transactions for a given transaction manager
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • request

      Request request(Transaction transaction)
      Parameters:
      transaction - Current transaction, may be null, depending on the driver
      Returns:
      A new request handler
    • getConfiguration

      Configuration getConfiguration()
    • getCypherModification

      default Function<String,String> getCypherModification()
    • requiresTransaction

      default boolean requiresTransaction()
      Indicates if the driver requires an explicit transaction to run queries. Used to know if transactions has to be explicitly triggered by OGM before accessing DB.
      Returns:
      true if client code has to setup a transaction, false if the driver can auto-commit.
    • getTypeSystem

      default TypeSystem getTypeSystem()
      This returns the type system of the specific drivers. A type system for a driver is set of types that are special to Neo4j and can be represented in either Java built-ins or dedicated types. The driver interface defaults to a type system that does not support any native types.
      Returns:
      This driver's type system.
    • getExceptionTranslator

      default ExceptionTranslator getExceptionTranslator()
      An ExceptionTranslator translating driver specific exception into a Neo4j-OGM api exceptions.
      Returns:
      The default translator returning the exception itself.
      Since:
      3.2
    • unwrap

      default <T> T unwrap(Class<T> clazz)
      Unwraps this Neo4j-OGM specific driver into it's underlying physical driver of type T if the concrete driver's transport is compatible with the specified class.

      A call to this method won't initialize a driver. Depending on the actual type, the underlying driver will be null if it had not been used beforehand or Configuration.Builder.verifyConnection(Boolean) hat been set to true.

      This method won't return null once the driver has been initialized until close() has been called.

      Type Parameters:
      T - Type of the class
      Parameters:
      clazz - The class into which the driver should be unwrapped
      Returns:
      The unwrapped driver or null if the driver has not been initialized beforehand.
      Throws:
      IllegalArgumentException - if this driver cannot be unwrapped into the given class.