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         *                    retrieve a configuration file required to set up
016         *                    the SPI implementation, e.g. the parameters to
017         *                    establish a database connection. Not
018         *                    {@code null}.
019         *
020         * @throws Exception If initialisation failed.
021         */
022        public void init(final InitContext initContext)
023                throws Exception;
024
025
026        /**
027         * Checks if the SPI implementation is enabled and can handle requests.
028         * This can be controlled by a configuration setting or otherwise.
029         *
030         * @return {@code true} if the SPI implementation is enabled, else
031         *         {@code false}.
032         */
033        public boolean isEnabled();
034
035
036        /**
037         * Shuts down the SPI implementation. This method is called on
038         * Connect2id Server shutdown.
039         *
040         * @throws Exception If proper shutdown failed.
041         */
042        public void shutdown()
043                throws Exception;
044}