class IntegrityValidator {

    public void validateSchemaRule( SchemaRule schemaRule ) throws TransactionFailureException
    {
        if ( schemaRule instanceof ConstraintRule )
        {
            ConstraintRule constraintRule = (ConstraintRule) schemaRule;
            if ( constraintRule.getConstraintDescriptor().enforcesUniqueness() )
            {
                try
                {
                    indexes.validateIndex( constraintRule.getOwnedIndex() );
                }
                catch ( UniquePropertyValueValidationException e )
                {
                    throw new TransactionFailureException( Status.Transaction.TransactionValidationFailed, e,
                            "Index validation failed" );
                }
                catch ( IndexNotFoundKernelException | IndexPopulationFailedKernelException e )
                {
                    // We don't expect this to occur, and if they do, it is because we are in a very bad state - out of
                    // disk or index corruption, or similar. This will kill the database such that it can be shut down
                    // and have recovery performed. It's the safest bet to avoid loosing data.
                    throw new TransactionFailureException( Status.Transaction.TransactionValidationFailed, e,
                            "Index population failure" );
                }
            }
        }
    }

    public  IntegrityValidator( NeoStores neoStores, IndexingService indexes );

}