001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thomas Roger <troger@nuxeo.com>
016 */
017
018package org.nuxeo.ecm.quota;
019
020import org.nuxeo.ecm.core.api.CoreSession;
021import org.nuxeo.ecm.core.event.Event;
022import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
023
024/**
025 * Interface to be implemented by {@code QuotaStatsUpdater}s registered to the
026 * {@link org.nuxeo.ecm.quota.QuotaStatsService}.
027 * <p>
028 * They use an unrestricted {@link CoreSession} to do the update.
029 * 
030 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a>
031 * @since 5.5
032 */
033public interface QuotaStatsUpdater {
034
035    /**
036     * Update the statistics for the given {@code docCtx} and {@code event}. Signature was changed in 5.6 to pass the
037     * Event instead of the eventName to allow the implementer to rollback the transaction if needed
038     * 
039     * @param session an unrestricted {@link CoreSession} to be used
040     */
041    void updateStatistics(CoreSession session, DocumentEventContext docCtx, Event event);
042
043    /**
044     * Compute the initial statistics on the whole repository for this {@code QuotaStatsUpdater}.
045     * 
046     * @param session an unrestricted {@link CoreSession} to be used
047     */
048    void computeInitialStatistics(CoreSession session, final QuotaStatsInitialWork currentWorker);
049
050    public void setName(String name);
051
052    public String getName();
053
054    public void setLabel(String label);
055
056    public String getLabel();
057
058    public void setDescriptionLabel(String descriptionLabel);
059
060    public String getDescriptionLabel();
061
062}