public abstract class GenericHeaplet extends Object implements Heaplet
Modifier and Type | Field and Description |
---|---|
protected JsonValue |
config
The heaplet's object configuration object.
|
protected Heap |
heap
Where objects should be put and where object dependencies should be retrieved.
|
protected String |
name
The name of the object to be created and stored in the heap by this heaplet.
|
protected Object |
object
The object created by the heaplet's
create() method. |
protected Name |
qualified
The fully qualified name of the object to be created.
|
Constructor and Description |
---|
GenericHeaplet() |
Modifier and Type | Method and Description |
---|---|
abstract Object |
create()
Called to request the heaplet create an object.
|
Object |
create(Name name,
JsonValue config,
Heap heap)
Called to request the heaplet to create an object.
|
void |
destroy()
Called to indicate that the object created by the heaplet is going to be dereferenced.
|
protected EndpointRegistry |
endpointRegistry()
Returns this object's
EndpointRegistry , creating it lazily when requested for the first time. |
Function<JsonValue,JsonValue,JsonValueException> |
evaluatedWithHeapProperties()
Returns a function that will evaluate the expression hold by a
JsonValue using the properties defined in the heap of this
Heaplet. |
protected <T> Function<JsonValue,Expression<T>,JsonValueException> |
expression(Class<T> type)
Returns a function that will create an
Expression from the string by the JsonValue using the
bindings defined in the heap of this Heaplet as initial bindings. |
JsonValue |
getConfig()
Returns the config associated to that
Heaplet . |
Heap |
getHeap()
Returns the heap associated to that
Heaplet . |
SecretsService |
getSecretService()
Returns the
SecretsService from the heap. |
protected String |
getType()
Returns the type of the IG object.
|
protected MeterRegistryHolder |
meterRegistryHolder()
Returns this object's
MeterRegistry , creating it lazily when requested for the first time. |
void |
start()
Called to request the heaplet start an object.
|
protected String name
protected Name qualified
protected JsonValue config
protected Heap heap
public Object create(Name name, JsonValue config, Heap heap) throws HeapException
Heaplet
create
in interface Heaplet
name
- the name of the object to be created.config
- the heaplet's configuration object.heap
- the heap where object dependencies can be retrieved.HeapException
- if an exception occurred during creation of the object or any of its dependencies.protected EndpointRegistry endpointRegistry() throws HeapException
EndpointRegistry
, creating it lazily when requested for the first time.EndpointRegistry
(/objects/[name])HeapException
- should never be thrownprotected MeterRegistryHolder meterRegistryHolder() throws HeapException
MeterRegistry
, creating it lazily when requested for the first time.MeterRegistry
HeapException
- should never be thrownprotected String getType()
public void destroy()
Heaplet
public abstract Object create() throws HeapException
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 start()
method.HeapException
- if an exception occurred during creation of the heap object
or any of its dependencies.JsonValueException
- if the heaplet (or one of its dependencies) has a malformed
configuration.public void start() throws HeapException
Heaplet.create(Name, JsonValue, Heap)
after creating and
configuring the object and once the object's logger and storage have been
configured. Implementations should override this method if they need to
acquire resources, start threads, or log any initialization messages.HeapException
- if an exception occurred while starting the heap object or
any of its dependencies.public Function<JsonValue,JsonValue,JsonValueException> evaluatedWithHeapProperties()
JsonValue
using the properties defined in the heap of this
Heaplet.JsonValue
using the properties defined in the heap of
this Heaplet.protected <T> Function<JsonValue,Expression<T>,JsonValueException> expression(Class<T> type)
Expression
from the string by the JsonValue
using the
bindings defined in the heap of this Heaplet as initial bindings.T
- The type of the expression's result.type
- The expected result type of the Expression
Expression
from the string by the JsonValue
using the
bindings defined in the heap of this Heaplet as initial bindings.public Heap getHeap()
Heaplet
.Heaplet
.public JsonValue getConfig()
Heaplet
.Heaplet
.public SecretsService getSecretService() throws HeapException
SecretsService
from the heap.SecretsService
from the heap.HeapException
- if it cannot retrieve the secret service.Copyright 2011-2017 ForgeRock AS.