class ContentAnalysis implements SynchronousDataSetAnalyzer {

    @Override
    public void analyze(String dataSetId) {

        // defensive programming
        if (StringUtils.isEmpty(dataSetId)) {
            throw new IllegalArgumentException("Data set id cannot be null or empty.");
        }

        DistributedLock datasetLock = repository.createDatasetMetadataLock(dataSetId);
        datasetLock.lock();
        try {
            DataSetMetadata metadata = repository.get(dataSetId);
            if (metadata != null) {
                LOG.info("Indexing content of data set #{}...", metadata.getId());

                updateHeaderAndFooter(metadata);
                updateLimit(metadata);

                metadata.getLifecycle().contentIndexed(true);

                DataSetMetadata savedDataSetMetadata = repository.get(dataSetId);
                // in order to check that the dataset was not deleted during analysis
                if (savedDataSetMetadata != null) {
                    repository.save(metadata);
                }
                LOG.info("Indexed content of data set #{}.", dataSetId);
            } else {
                LOG.info("Data set #{} no longer exists.", dataSetId); //$NON-NLS-1$
            }
        } finally {
            datasetLock.unlock();
        }
    }

}