Class JdbcDataSourceHeaplet

java.lang.Object
org.forgerock.openig.heap.GenericHeaplet
org.forgerock.openig.sql.JdbcDataSourceHeaplet
All Implemented Interfaces:
Heaplet

public class JdbcDataSourceHeaplet extends GenericHeaplet
Creates and initializes a JDBC data source in a heap environment.
 
 config {
   "poolName"            : String                    [OPTIONAL  - pool name]
   "jdbcUrl"             : Configuration expression  [OPTIONAL* - database JDBC URL]
   "dataSourceClassName" : Configuration expression  [OPTIONAL* - database data source class name]
   "driverClassName"     : Configuration expression  [OPTIONAL# - database driver class name, if required]
   "username"            : Configuration expression  [OPTIONAL  - database user to authenticate with]
   "passwordSecretId"    : password Secret ID        [OPTIONAL  - database password to authenticate with]
   "secretsProvider"     : Secrets Provider          [OPTIONAL+  - secrets provider to use to retrieve password]
   "properties"          : object {                  [OPTIONAL  - data source-specific properties:
      ...                                                         Consult data source-specific property settings
   },
   "executor             : executor                  [OPTIONAL  - executor used to perform housekeeping, defaults to
                                                                  heap {@literal SCHEDULED_EXECUTOR_SERVICE_HEAP_KEY}
 }
 
 
  • * Either 'jdbcUrl' or 'dataSourceClassName' should be used depending on the underlying data source support
  • # 'driverClassName' may need to be specified for older JDBC drivers
  • + Required when "passwordSecretId" is set
Example configuration using 'jdbcUrl':
 
 config {
   "jdbcUrl"             : "jdbc:h2:mem:testdb",
   "username"            : "testuser",
   "passwordSecretId     : "database.password",
   "secretsProvider"     : "MySecretsProvider"
 }
 
 
Example configuration using 'dataSourceName' with 'url' property:
 
 config {
   "dataSourceClassName" : "org.h2.jdbcx.JdbcDataSource",
   "username"            : "testuser",
   "passwordSecretId     : "database.password",
   "secretsProvider"     : "MySecretsProvider",
   "properties" : {
      "url"              : "jdbc:h2:mem:testdb"
   }
 }
 
 
  • Constructor Details

    • JdbcDataSourceHeaplet

      public JdbcDataSourceHeaplet()
  • Method Details

    • create

      public Object create() throws HeapException
      Description copied from class: GenericHeaplet
      Called to request the heaplet create an object. Called by Heaplet.create(Name, JsonValue, Heap) after initializing the protected field members. Implementations should parse configuration but not acquire resources, start threads, or log any initialization messages. These tasks should be performed by the GenericHeaplet.start() method.
      Specified by:
      create in class GenericHeaplet
      Returns:
      The created object.
      Throws:
      HeapException - if an exception occurred during creation of the heap object or any of its dependencies.
    • destroy

      public void destroy()
      Description copied from interface: Heaplet
      Called to indicate that the object created by the heaplet is going to be dereferenced. This gives the heaplet an opportunity to free any resources that are being held prior to its dereference.
      Specified by:
      destroy in interface Heaplet
      Overrides:
      destroy in class GenericHeaplet