class IndexSubsystemInitializer implements ServletContextListener {

    private static final Logger LOGGER = Logger.getLogger(IndexSubsystemInitializer.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public void contextInitialized(final ServletContextEvent event) {<FILL_FUNCTION_BODY>}

    /**
     * {@inheritDoc}
     */
    @Override
    public void contextDestroyed(final ServletContextEvent event) {
        LOGGER.info("Closing search indexes");

        Arrays.stream(IndexManager.IndexType.values())
                .map(IndexManager.IndexType::getClazz)
                .map(IndexManagerFactory::getIndexManager)
                .forEach(IndexManager::close);
    }
}

        LOGGER.info("Building lucene indexes if required");

        if (RequirementsVerifier.failedValidation()) {
            return;
        }

        IndexManager.ensureIndexesExists();
    
<no_super_class>