Class ManagedObject<C extends Configuration>

Object
se.curity.identityserver.sdk.plugin.ManagedObject<C>
All Implemented Interfaces:
Closeable, AutoCloseable, ThreadSafe

public abstract class ManagedObject<C extends Configuration> extends Object implements Closeable, ThreadSafe
A managed object is an object that can be used by a plugin to manage the plugin life-cycle.

A new instance of the plugin's ManagedObject class will be created every time the plugin's configuration is modified; including server startup. The new Configuration object is passed to the new instance of ManagedObject via its constructor.

If there was at least one previous configuration change, the older instance of ManagedObject is closed via the close() method before the new instance is created.

The close() method and the constructor of the new instance may be called from different Threads.

The plugin will not be available until the constructor of this object finishes running. If it never completes or throws an Exception, then the plugin will not become active and all requests to the server that require this plugin will respond with an error.

A plugin type may receive an instance of the ManagedObject by injection into its constructor in the same manner as it receives an instance of its Configuration type.

All implementations extending this abstract class must be Thread-safe.

  • Constructor Details

    • ManagedObject

      public ManagedObject(C configuration)
      Create and initialize this ManagedObject.

      A new instance of this type will be created by the server every time the plugin configuration is modified.

      The provided Configuration instance will contain only primitive values and nested configuration objects. Calling a method that returns a service will result in an UnsupportedOperationException at runtime.

      If this constructor throws an Exception, then the plugin will not become active until the next configuration change (when this instance will be closed, and the new instance initialized).

      Parameters:
      configuration - of the plugin.
  • Method Details

    • close

      public void close() throws IOException
      Close this ManagedObject.

      This method is called every time the plugin configuration is modified (just before the new instance is created) and on server shutdown.

      If any Exception is thrown, the error will be logged but the next instance of this object will be initialized anyway, unless it is a server shutdown.

      The default implementation of this method does not do anything.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException