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
-
Constructor Summary
-
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:GenericHeaplet
Called 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:
create
in 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 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 interfaceHeaplet
- Overrides:
destroy
in classGenericHeaplet
-