Class GenericHeaplet

    • 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 JsonValue config
        The heaplet's object configuration object.
      • heap

        protected Heap heap
        Where objects should be put and where object dependencies should be retrieved.
      • object

        protected Object object
        The object created by the heaplet's create() method.
    • Constructor Detail

      • GenericHeaplet

        public GenericHeaplet()
    • Method Detail

      • create

        public Object create​(Name name,
                             JsonValue config,
                             Heap heap)
                      throws HeapException
        Description copied from interface: Heaplet
        Called to request the heaplet to create an object.
        Specified by:
        create in interface Heaplet
        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.
      • meterRegistryHolder

        protected org.forgerock.monitoring.api.instrument.MeterRegistryHolder meterRegistryHolder()
                                                                                           throws HeapException
        Returns this object's MeterRegistry, creating it lazily when requested for the first time.
        Returns:
        this object's MeterRegistry
        Throws:
        HeapException - should never be thrown
      • getType

        protected String getType()
        Returns the type of the IG object.
        Returns:
        the type of the IG object
      • 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
      • create

        public abstract Object create()
                               throws HeapException
        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 start() method.
        Returns:
        The created object.
        Throws:
        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.
      • start

        public void start()
                   throws HeapException
        Called to request the heaplet start an object. Called by 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.
        Throws:
        HeapException - if an exception occurred while starting the heap object or any of its dependencies.
      • evaluatedWithHeapProperties

        public 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.
        Returns:
        a function that will evaluate the expression hold by a JsonValue using the properties defined in the heap of this Heaplet.
      • expression

        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.
        Type Parameters:
        T - The type of the expression's result.
        Parameters:
        type - The expected result type of the Expression
        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.
      • initialBindings

        protected Bindings initialBindings()
        Return an initial set of bindings based on the heap properties, along with any utility items from the heap, such as the clock.
        Returns:
        an initial set of bindings based on the heap properties, along with any utility items from the heap, such as the clock.
      • getHeap

        public Heap getHeap()
        Returns the heap associated to that Heaplet.
        Returns:
        the heap associated to that Heaplet.
      • getConfig

        public JsonValue getConfig()
        Returns the config associated to that Heaplet.
        Returns:
        the config associated to that Heaplet.