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 <[email protected]> 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:[email protected]">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 * @deprecated since 10.1, use other signature 050 */ 051 @Deprecated 052 default void computeInitialStatistics(CoreSession session, final QuotaStatsInitialWork currentWorker) { 053 computeInitialStatistics(session, currentWorker, null); 054 } 055 056 /** 057 * Compute the initial statistics under the given path for this {@code QuotaStatsUpdater}. 058 * 059 * @param session an unrestricted {@link CoreSession} to be used 060 * @param path the root of the recomputation, or {@code null} for the whole repository 061 * @since 10.1 062 */ 063 void computeInitialStatistics(CoreSession session, final QuotaStatsInitialWork currentWorker, String path); 064 065 public void setName(String name); 066 067 public String getName(); 068 069 public void setLabel(String label); 070 071 public String getLabel(); 072 073 public void setDescriptionLabel(String descriptionLabel); 074 075 public String getDescriptionLabel(); 076 077}