001/* 002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Thomas Roger <troger@nuxeo.com> 018 */ 019 020package org.nuxeo.ecm.quota; 021 022import org.nuxeo.ecm.core.api.CoreSession; 023import org.nuxeo.ecm.core.event.Event; 024import org.nuxeo.ecm.core.event.impl.DocumentEventContext; 025 026/** 027 * Interface to be implemented by {@code QuotaStatsUpdater}s registered to the 028 * {@link org.nuxeo.ecm.quota.QuotaStatsService}. 029 * <p> 030 * They use an unrestricted {@link CoreSession} to do the update. 031 * 032 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 033 * @since 5.5 034 */ 035public interface QuotaStatsUpdater { 036 037 /** 038 * Update the statistics for the given {@code docCtx} and {@code event}. Signature was changed in 5.6 to pass the 039 * Event instead of the eventName to allow the implementer to rollback the transaction if needed 040 * 041 * @param session an unrestricted {@link CoreSession} to be used 042 */ 043 void updateStatistics(CoreSession session, DocumentEventContext docCtx, Event event); 044 045 /** 046 * Compute the initial statistics on the whole repository for this {@code QuotaStatsUpdater}. 047 * 048 * @param session an unrestricted {@link CoreSession} to be used 049 */ 050 void computeInitialStatistics(CoreSession session, final QuotaStatsInitialWork currentWorker); 051 052 public void setName(String name); 053 054 public String getName(); 055 056 public void setLabel(String label); 057 058 public String getLabel(); 059 060 public void setDescriptionLabel(String descriptionLabel); 061 062 public String getDescriptionLabel(); 063 064}