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        void init(final InitContext initContext)
021                throws Exception;
022
023
024        /**
025         * Checks if the SPI implementation is enabled and can handle requests.
026         * This can be controlled by a configuration setting or otherwise.
027         *
028         * @return {@code true} if the SPI implementation is enabled, else
029         *         {@code false}.
030         */
031        boolean isEnabled();
032
033
034        /**
035         * Shuts down the SPI implementation. This method is called on
036         * Connect2id Server shutdown.
037         *
038         * @throws Exception If proper shutdown failed.
039         */
040        void shutdown()
041                throws Exception;
042}