Package org.nuxeo.ecm.quota
Class QuotaStatsServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.quota.QuotaStatsServiceImpl
-
- All Implemented Interfaces:
QuotaStatsService
,Adaptable
,Component
,Extensible
,TimestampedService
public class QuotaStatsServiceImpl extends DefaultComponent implements QuotaStatsService
Default implementation ofQuotaStatsService
.- Since:
- 5.5
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BATCH_SIZE
static String
QUOTA_STATS_UPDATERS_EP
protected QuotaStatsUpdaterRegistry
quotaStatsUpdaterRegistry
static String
STATUS_INITIAL_COMPUTATION_COMPLETED
static String
STATUS_INITIAL_COMPUTATION_PENDING
static String
STATUS_INITIAL_COMPUTATION_QUEUED
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description QuotaStatsServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(ComponentContext context)
Activates the component.void
activateQuotaOnUserWorkspaces(long maxQuota, CoreSession session)
Activates the quota on user personal workspacesboolean
canSetMaxQuota(long maxQuota, DocumentModel doc, CoreSession session)
Test to see if quota allowed.void
computeInitialStatistics(String updaterName, CoreSession session, QuotaStatsInitialWork currentWorker, String path)
Compute the initial statistics for the given @{code updaterName} fordocPath
.protected List<DocumentModel>
getParentsInReverseOrder(DocumentModel doc, CoreSession session)
String
getProgressStatus(String updaterName, String repositoryName)
Returns the progress status ofupdaterName
.long
getQuotaFromParent(DocumentModel doc, CoreSession session)
Gets the quota from the first parent where quota has been set.long
getQuotaSetOnUserWorkspaces(CoreSession session)
List<QuotaStatsUpdater>
getQuotaStatsUpdaters()
QuotaStatsUpdater
getQuotaStatsUpdaters(String updaterName)
String
getUserWorkspaceRootId(DocumentModel context, CoreSession session)
void
launchInitialStatisticsComputation(String updaterName, String repositoryName, String path)
Launch an asynchronously initial computation for the givenupdaterName
onrepositoryName
fordocPath
.void
launchSetMaxQuotaOnUserWorkspaces(long maxSize, DocumentModel context, CoreSession session)
Sets this maxQuota on all user workspacesvoid
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
updateStatistics(DocumentEventContext docCtx, Event event)
Update the statistics for the givendocCtx
andevent
.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
Methods inherited from interface org.nuxeo.ecm.quota.QuotaStatsService
computeInitialStatistics, launchInitialStatisticsComputation
-
-
-
-
Field Detail
-
STATUS_INITIAL_COMPUTATION_QUEUED
public static final String STATUS_INITIAL_COMPUTATION_QUEUED
- See Also:
- Constant Field Values
-
STATUS_INITIAL_COMPUTATION_PENDING
public static final String STATUS_INITIAL_COMPUTATION_PENDING
- See Also:
- Constant Field Values
-
STATUS_INITIAL_COMPUTATION_COMPLETED
public static final String STATUS_INITIAL_COMPUTATION_COMPLETED
- See Also:
- Constant Field Values
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
-
QUOTA_STATS_UPDATERS_EP
public static final String QUOTA_STATS_UPDATERS_EP
- See Also:
- Constant Field Values
-
quotaStatsUpdaterRegistry
protected QuotaStatsUpdaterRegistry quotaStatsUpdaterRegistry
-
-
Method Detail
-
activate
public void activate(ComponentContext context)
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
getQuotaStatsUpdaters
public List<QuotaStatsUpdater> getQuotaStatsUpdaters()
- Specified by:
getQuotaStatsUpdaters
in interfaceQuotaStatsService
-
getQuotaStatsUpdaters
public QuotaStatsUpdater getQuotaStatsUpdaters(String updaterName)
-
updateStatistics
public void updateStatistics(DocumentEventContext docCtx, Event event)
Description copied from interface:QuotaStatsService
- Specified by:
updateStatistics
in interfaceQuotaStatsService
-
computeInitialStatistics
public void computeInitialStatistics(String updaterName, CoreSession session, QuotaStatsInitialWork currentWorker, String path)
Description copied from interface:QuotaStatsService
Compute the initial statistics for the given @{code updaterName} fordocPath
.- Specified by:
computeInitialStatistics
in interfaceQuotaStatsService
-
launchInitialStatisticsComputation
public void launchInitialStatisticsComputation(String updaterName, String repositoryName, String path)
Description copied from interface:QuotaStatsService
Launch an asynchronously initial computation for the givenupdaterName
onrepositoryName
fordocPath
.- Specified by:
launchInitialStatisticsComputation
in interfaceQuotaStatsService
-
getProgressStatus
public String getProgressStatus(String updaterName, String repositoryName)
Description copied from interface:QuotaStatsService
Returns the progress status ofupdaterName
.- Specified by:
getProgressStatus
in interfaceQuotaStatsService
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContribution
in classDefaultComponent
-
getQuotaFromParent
public long getQuotaFromParent(DocumentModel doc, CoreSession session)
Description copied from interface:QuotaStatsService
Gets the quota from the first parent where quota has been set. Returns -1 if no quota has been set. For user workspaces, only the first parent is investigated- Specified by:
getQuotaFromParent
in interfaceQuotaStatsService
-
activateQuotaOnUserWorkspaces
public void activateQuotaOnUserWorkspaces(long maxQuota, CoreSession session)
Description copied from interface:QuotaStatsService
Activates the quota on user personal workspaces- Specified by:
activateQuotaOnUserWorkspaces
in interfaceQuotaStatsService
-
getQuotaSetOnUserWorkspaces
public long getQuotaSetOnUserWorkspaces(CoreSession session)
- Specified by:
getQuotaSetOnUserWorkspaces
in interfaceQuotaStatsService
-
getParentsInReverseOrder
protected List<DocumentModel> getParentsInReverseOrder(DocumentModel doc, CoreSession session)
-
launchSetMaxQuotaOnUserWorkspaces
public void launchSetMaxQuotaOnUserWorkspaces(long maxSize, DocumentModel context, CoreSession session)
Description copied from interface:QuotaStatsService
Sets this maxQuota on all user workspaces- Specified by:
launchSetMaxQuotaOnUserWorkspaces
in interfaceQuotaStatsService
-
getUserWorkspaceRootId
public String getUserWorkspaceRootId(DocumentModel context, CoreSession session)
-
canSetMaxQuota
public boolean canSetMaxQuota(long maxQuota, DocumentModel doc, CoreSession session)
Description copied from interface:QuotaStatsService
Test to see if quota allowed. Skip user worskpaces, where validation rules don't apply.- Specified by:
canSetMaxQuota
in interfaceQuotaStatsService
-
-