Package org.forgerock.openig.sql
Class JdbcDataSourceHeaplet
java.lang.Object
org.forgerock.openig.heap.GenericHeaplet
org.forgerock.openig.sql.JdbcDataSourceHeaplet
- All Implemented Interfaces:
Heaplet
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
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"
}
}
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.forgerock.openig.heap.GenericHeaplet
create, endpointRegistry, evaluatedWithHeapProperties, expression, getConfig, getHeap, getType, initialBindings, meterRegistryHolder, start
-
Field Details
-
NAME
Public name used by resolver.- See Also:
-
-
Constructor Details
-
JdbcDataSourceHeaplet
public JdbcDataSourceHeaplet()
-
-
Method Details
-
create
Description copied from class:GenericHeapletCalled to request the heaplet create an object. Called byHeaplet.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 theGenericHeaplet.start()method.- Specified by:
createin classGenericHeaplet- 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 class:GenericHeapletReleases observability resources: deregisters the HTTP endpoint, all meters, and startup metrics.Subclasses that override this method must call
super.destroy()last, after releasing their own domain resources. This ensures that monitoring remains active for the full lifetime of those resources and that any metrics emitted during shutdown are not lost.- Specified by:
destroyin interfaceHeaplet- Overrides:
destroyin classGenericHeaplet
-