Package org.forgerock.openig.heap
Class GenericHeaplet
- java.lang.Object
-
- org.forgerock.openig.heap.GenericHeaplet
-
- All Implemented Interfaces:
Heaplet
- Direct Known Subclasses:
AbstractScriptableHeapObject.AbstractScriptableHeaplet,AssignmentFilter.Heaplet,AuditServiceObjectHeaplet,ChainFilterHeaplet,ChainHandlerHeaplet,ClientHandler.Heaplet,ClientRegistration.Heaplet,ConditionalFilterHeaplet,ConditionEnforcementFilter.Heaplet,CookieFilter.Heaplet,CryptoHeaderFilter.Heaplet,DefaultRateThrottlingPolicyHeaplet,DelegateHeaplet,DesKeyGenHandler.Heaplet,DispatchHandler.Heaplet,EmbeddedKafka,EntityExtractFilter.Heaplet,FileAttributesFilter.Heaplet,HeaderFilter.Heaplet,HttpBasicAuthFilter.Heaplet,ICAPFilter.Heaplet,Issuer.Heaplet,JwtBuilderFilter.Heaplet,JwtSessionManager.Heaplet,KeyManagerHeaplet,KeyStoreHeaplet,LLMProxyFilter.Heaplet,LocationHeaderFilter.Heaplet,MappedThrottlingPolicyHeaplet,MCPServerFeaturesFilter.Heaplet,MQ_IBM.Heaplet,MQ_Kafka.Heaplet,OAuth2ClientFilter.Heaplet,OAuth2ResourceServerFilterHeaplet,PasswordReplayFilterHeaplet,PolicyEnforcementFilter.Heaplet,RouterHandler.Heaplet,SamlFederationHandler.Heaplet,SampleFilter.Heaplet,ScheduledExecutorServiceHeaplet,SequenceHandler.Heaplet,SingleSignOnFilter.Heaplet,SqlAttributesFilter.Heaplet,StaticRequestFilter.Heaplet,StaticResponseHandler.Heaplet,SwitchFilter.Heaplet,SystemAndEnvSecretStore.Heaplet,TemporaryStorageHeaplet,ThrottlingFilterHeaplet,TokenTransformationFilter.Heaplet,TrustAllManager.Heaplet,TrustManagerHeaplet,UmaResourceServerFilter.Heaplet,UmaSharingService.Heaplet,WelcomeHandler.Heaplet
public abstract class GenericHeaplet extends Object implements Heaplet
A generic base class for heaplets with automatically injected fields.If the object created is an instance of
GenericHeapObject, it is then automatically injected withloggerandstorageobjects.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.forgerock.json.JsonValueconfigThe heaplet's object configuration object.protected HeapheapWhere objects should be put and where object dependencies should be retrieved.protected StringnameThe name of the object to be created and stored in the heap by this heaplet.protected ObjectobjectThe object created by the heaplet'screate()method.protected NamequalifiedThe fully qualified name of the object to be created.
-
Constructor Summary
Constructors Constructor Description GenericHeaplet()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Objectcreate()Called to request the heaplet create an object.Objectcreate(Name name, org.forgerock.json.JsonValue config, Heap heap)Called to request the heaplet to create an object.voiddestroy()Called to indicate that the object created by the heaplet is going to be dereferenced.protected EndpointRegistryendpointRegistry()Returns this object'sEndpointRegistry, creating it lazily when requested for the first time.protected org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException>evaluatedWithHeapProperties()Returns a function that will evaluate the expression hold by aJsonValueusing the properties defined in the heap of this Heaplet.protected <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException>expression(Class<T> type)Returns a function that will create anExpressionfrom the string by theJsonValueusing the bindings defined in the heap of this Heaplet as initial bindings.voidstart()Called to request the heaplet start an object.
-
-
-
Field Detail
-
name
protected String name
The name of the object to be created and stored in the heap by this heaplet.
-
qualified
protected Name qualified
The fully qualified name of the object to be created.
-
config
protected org.forgerock.json.JsonValue config
The heaplet's object configuration object.
-
heap
protected Heap heap
Where objects should be put and where object dependencies should be retrieved.
-
-
Method Detail
-
create
public Object create(Name name, org.forgerock.json.JsonValue config, Heap heap) throws HeapException
Description copied from interface:HeapletCalled to request the heaplet to create an object.- Specified by:
createin interfaceHeaplet- Parameters:
name- the name of the object to be created.config- the heaplet's configuration object.heap- the heap where object dependencies can be retrieved.- Returns:
- the object created by the heaplet.
- Throws:
HeapException- if an exception occurred during creation of the object or any of its dependencies.
-
endpointRegistry
protected EndpointRegistry endpointRegistry() throws HeapException
Returns this object'sEndpointRegistry, creating it lazily when requested for the first time.- Returns:
- this object's
EndpointRegistry(/objects/[name]) - Throws:
HeapException- should never be thrown
-
destroy
public void destroy()
Description copied from interface:HeapletCalled 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.
-
create
public abstract Object create() throws HeapException
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 thestart()method.- Returns:
- The created object.
- Throws:
HeapException- if an exception occurred during creation of the heap object or any of its dependencies.org.forgerock.json.JsonValueException- if the heaplet (or one of its dependencies) has a malformed configuration.
-
start
public void start() throws HeapExceptionCalled to request the heaplet start an object. Called byHeaplet.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.- Throws:
HeapException- if an exception occurred while starting the heap object or any of its dependencies.
-
evaluatedWithHeapProperties
protected org.forgerock.util.Function<org.forgerock.json.JsonValue,org.forgerock.json.JsonValue,org.forgerock.json.JsonValueException> evaluatedWithHeapProperties()
Returns a function that will evaluate the expression hold by aJsonValueusing the properties defined in the heap of this Heaplet.- Returns:
- a function that will evaluate the expression hold by a
JsonValueusing the properties defined in the heap of this Heaplet.
-
expression
protected <T> org.forgerock.util.Function<org.forgerock.json.JsonValue,Expression<T>,org.forgerock.json.JsonValueException> expression(Class<T> type)
Returns a function that will create anExpressionfrom the string by theJsonValueusing the bindings defined in the heap of this Heaplet as initial bindings.- Type Parameters:
T- The type of the expression's result.- Parameters:
type- The expected result type of theExpression- Returns:
- a function that will create an
Expressionfrom the string by theJsonValueusing the bindings defined in the heap of this Heaplet as initial bindings.
-
-