addons/pkg-maven/common/src/main/java/org/commonjava/indy/pkg/maven/content/MetadataStoreListener.java
public void onMetadataFileForceDelete( @Observes final FileDeletionEvent event )
    {
        EventMetadata eventMetadata = event.getEventMetadata();
        if ( !Boolean.TRUE.equals( eventMetadata.get( CHECK_CACHE_ONLY ) ) )
        {
            return;
        }

        logger.trace( "Got file-delete event: {}", event );

        Transfer transfer = event.getTransfer();
        String path = transfer.getPath();

        if ( !path.endsWith( METADATA_NAME ) )
        {
            logger.trace( "Not {} , path: {}", METADATA_NAME, path );
            return;
        }

        Location loc = transfer.getLocation();

        if ( !( loc instanceof KeyedLocation ) )
        {
            logger.trace( "Ignore FileDeletionEvent, not a KeyedLocation, location: {}", loc );
            return;
        }

        KeyedLocation keyedLocation = (KeyedLocation) loc;
        StoreKey storeKey = keyedLocation.getKey();
        try
        {
            ArtifactStore store = storeManager.getArtifactStore( storeKey );
            metadataGenerator.clearAllMerged( store, path );
        }
        catch ( IndyDataException e )
        {
            logger.error( "Handle FileDeletionEvent failed", e );
        }
    }
public void onMetadataFileForceDelete( @Observes final FileDeletionEvent event )
    {
        EventMetadata eventMetadata = event.getEventMetadata();
        if ( !Boolean.TRUE.equals( eventMetadata.get( CHECK_CACHE_ONLY ) ) )
        {
            return;
        }

        logger.trace( "Got file-delete event: {}", event );

        Transfer transfer = event.getTransfer();
        String path = transfer.getPath();

        if ( !path.endsWith( METADATA_NAME ) )
        {
            logger.trace( "Not {} , path: {}", METADATA_NAME, path );
            return;
        }

        Location loc = transfer.getLocation();

        if ( !( loc instanceof KeyedLocation ) )
        {
            logger.trace( "Ignore FileDeletionEvent, not a KeyedLocation, location: {}", loc );
            return;
        }

        KeyedLocation keyedLocation = (KeyedLocation) loc;
        StoreKey storeKey = keyedLocation.getKey();
        try
        {
            ArtifactStore store = storeManager.getArtifactStore( storeKey );
            metadataGenerator.clearAllMerged( store, path );
        }
        catch ( IndyDataException e )
        {
            logger.error( "Handle FileDeletionEvent failed", e );
        }
    }
Indy normally does not handle FileDeletionEvent when the cached metadata files were deleted due to store
enable/disable/delete, etc. Lately we add a force-deletion for group/remote-repo cache files. This requires to
delete affected group metadata files and clear ISPN cache too. We use this method for just this case, i.e.,
only if CHECK_CACHE_ONLY is true.