class IndexingService extends LifecycleAdapter implements IndexingUpdateService, IndexingProvidersService {

    @Override
    public void init()
    {
        validateDefaultProviderExisting();

        indexMapRef.modify( indexMap ->
        {
            Map<InternalIndexState, List<IndexLogRecord>> indexStates = new EnumMap<>( InternalIndexState.class );
            for ( SchemaRule rule : schemaRules )
            {
                if ( rule instanceof ConstraintRule )
                {
                    ConstraintRule constraintRule = (ConstraintRule) rule;
                    if ( constraintRule.getConstraintDescriptor().enforcesUniqueness() )
                    {
                        indexMap.putUniquenessConstraint( constraintRule );
                    }
                    continue;
                }

                StoreIndexDescriptor indexDescriptor = (StoreIndexDescriptor) rule;
                IndexProxy indexProxy;

                IndexProviderDescriptor providerDescriptor = indexDescriptor.providerDescriptor();
                IndexProvider provider = providerMap.lookup( providerDescriptor );
                InternalIndexState initialState = provider.getInitialState( indexDescriptor );
                indexStates.computeIfAbsent( initialState, internalIndexState -> new ArrayList<>() )
                        .add( new IndexLogRecord( indexDescriptor ) );

                internalLog.debug( indexStateInfo( "init", initialState, indexDescriptor ) );
                switch ( initialState )
                {
                case ONLINE:
                    monitor.initialState( indexDescriptor, ONLINE );
                    indexProxy = indexProxyCreator.createOnlineIndexProxy( indexDescriptor );
                    break;
                case POPULATING:
                    // The database was shut down during population, or a crash has occurred, or some other sad thing.
                    monitor.initialState( indexDescriptor, POPULATING );
                    indexProxy = indexProxyCreator.createRecoveringIndexProxy( indexDescriptor );
                    break;
                case FAILED:
                    monitor.initialState( indexDescriptor, FAILED );
                    IndexPopulationFailure failure = failure( provider.getPopulationFailure( indexDescriptor ) );
                    indexProxy = indexProxyCreator.createFailedIndexProxy( indexDescriptor, failure );
                    break;
                default:
                    throw new IllegalArgumentException( "" + initialState );
                }
                indexMap.putIndexProxy( indexProxy );
            }
            logIndexStateSummary( "init", indexStates );
            return indexMap;
        } );
    }

      IndexingService( IndexProxyCreator indexProxyCreator,
            IndexProviderMap providerMap,
            IndexMapReference indexMapRef,
            IndexStoreView storeView,
            Iterable<SchemaRule> schemaRules,
            IndexSamplingController samplingController,
            TokenNameLookup tokenNameLookup,
            JobScheduler scheduler,
            SchemaState schemaState,
            MultiPopulatorFactory multiPopulatorFactory,
            LogProvider internalLogProvider,
            LogProvider userLogProvider,
            Monitor monitor,
            boolean readOnly );

}