001package com.nimbusds.openid.connect.provider.spi;
002
003
004/**
005 * Service Provider Interface (SPI) lifecycle.
006 */
007public interface Lifecycle {
008
009
010        /**
011         * Initialises the SPI implementation after it is loaded by the
012         * Connect2id Server.
013         *
014         * @param initContext The initialisation context. Can be used to
015         *                    configure and setup the SPI implementation. Not
016         *                    {@code null}.
017         *
018         * @throws Exception If initialisation failed.
019         */
020        default void init(final InitContext initContext) throws Exception {}
021
022
023        /**
024         * Checks if the SPI implementation is enabled and can handle requests.
025         * This can be controlled by a configuration setting or otherwise.
026         *
027         * @return {@code true} if the SPI implementation is enabled, else
028         *         {@code false}.
029         */
030        default boolean isEnabled() {
031                return true;
032        }
033
034
035        /**
036         * Shuts down the SPI implementation. This method is called on
037         * Connect2id Server shutdown.
038         *
039         * @throws Exception If proper shutdown failed.
040         */
041        default void shutdown() throws Exception {}
042}