class SourceQuotaEnforcer extends Processor {

    protected String sourceTag;
    public void setSourceTag(String sourceTag) {
        this.sourceTag = sourceTag;
    }
    public String getSourceTag() {
        return sourceTag;
    }

    protected Map<String, Long> quotas = new HashMap<String, Long>();
    public Map<String, Long> getQuotas() {
        return quotas;
    }
    /**
     * Keys can be any of the {@link CrawledBytesHistotable} keys.
     */
    public void setQuotas(Map<String, Long> quotas) {
        this.quotas = quotas;
    }

    protected StatisticsTracker statisticsTracker;
    public StatisticsTracker getStatisticsTracker() {
        return this.statisticsTracker;
    }
    @Autowired
    public void setStatisticsTracker(StatisticsTracker statisticsTracker) {
        this.statisticsTracker = statisticsTracker;
    }

    @Override
    protected boolean shouldProcess(CrawlURI curi) {
        return curi.containsDataKey(CoreAttributeConstants.A_SOURCE_TAG)
                && sourceTag.equals(curi.getSourceTag())
                && statisticsTracker.getSourceStats(curi.getSourceTag()) != null;
    }

    protected void innerProcess(CrawlURI curi) {
        throw new AssertionError();
    }

    protected ProcessResult innerProcessResult(CrawlURI curi) {<FILL_FUNCTION_BODY>}
}

        if (!shouldProcess(curi)) {
            return ProcessResult.PROCEED;
        }

        CrawledBytesHistotable stats = statisticsTracker.getSourceStats(curi.getSourceTag());

        for (Entry<String, Long> quota: quotas.entrySet()) {
            if (stats.get(quota.getKey()) >= quota.getValue()) {
                curi.getAnnotations().add("sourceQuota:" + quota.getKey());
                curi.setFetchStatus(FetchStatusCodes.S_BLOCKED_BY_QUOTA);
                return ProcessResult.FINISH;
            }
        }

        return ProcessResult.PROCEED;
    
<methods>public non-sealed void <init>() ,public void doCheckpoint(org.archive.checkpointing.Checkpoint) throws java.io.IOException,public void finishCheckpoint(org.archive.checkpointing.Checkpoint) ,public static java.lang.String flattenVia(org.archive.modules.CrawlURI) ,public java.lang.String getBeanName() ,public boolean getEnabled() ,public org.archive.spring.KeyedProperties getKeyedProperties() ,public static long getRecordedSize(org.archive.modules.CrawlURI) ,public org.archive.modules.deciderules.DecideRule getShouldProcessRule() ,public long getURICount() ,public static boolean hasHttpAuthenticationCredential(org.archive.modules.CrawlURI) ,public boolean isRunning() ,public static boolean isSuccess(org.archive.modules.CrawlURI) ,public org.archive.modules.ProcessResult process(org.archive.modules.CrawlURI) throws java.lang.InterruptedException,public java.lang.String report() ,public void setBeanName(java.lang.String) ,public void setEnabled(boolean) ,public void setRecoveryCheckpoint(org.archive.checkpointing.Checkpoint) ,public void setShouldProcessRule(org.archive.modules.deciderules.DecideRule) ,public void start() ,public void startCheckpoint(org.archive.checkpointing.Checkpoint) ,public void stop() <variables>protected java.lang.String beanName,protected boolean isRunning,protected org.archive.spring.KeyedProperties kp,protected org.archive.checkpointing.Checkpoint recoveryCheckpoint,protected java.util.concurrent.atomic.AtomicLong uriCount