Files
alfresco-community-repo/source/java/org/alfresco/repo/usage/RepoUsageComponent.java
Raluca Munteanu 8674e2bfc8 Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2016-04-26 12:48:49 +00:00

95 lines
3.7 KiB
Java

package org.alfresco.repo.usage;
import org.alfresco.service.cmr.admin.RepoUsage;
import org.alfresco.service.cmr.admin.RepoUsageStatus;
import org.alfresco.service.cmr.admin.RepoUsage.UsageType;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* Low-level interface to answer repository usage queries
*
* @author Derek Hulley
* @since 3.5
*/
public interface RepoUsageComponent
{
public static final Long LOCK_TTL = 60000L;
public static final QName LOCK_USAGE = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "RepoUsageComponent");
public static final QName LOCK_USAGE_USERS = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "RepoUsageComponent.Users");
public static final QName LOCK_USAGE_DOCUMENTS = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "RepoUsageComponent.Documents");
public static final String KEY_USAGE_ROOT = ".repoUsages";
public static final String KEY_USAGE_CURRENT = "current";
public static final String KEY_USAGE_LAST_UPDATE_USERS = "lastUpdateUsers";
public static final String KEY_USAGE_USERS = "users";
public static final String KEY_USAGE_LAST_UPDATE_DOCUMENTS = "lastUpdateDocuments";
public static final String KEY_USAGE_DOCUMENTS = "documents";
/**
* Observe when restrictions change
*/
void observeRestrictions(RestrictionObserver observer);
/**
* Interface for observers of repository restriction changes
*/
public interface RestrictionObserver
{
/**
* Called when restrictions are changed
*
* @param restrictions the new restrictions
*/
void onChangeRestriction(RepoUsage restrictions);
};
/**
* Record changes to the restrictions imposed on the repository. These <i>may</i> be cached
* for fast access. This method should only be called if the {@link #getRestrictions() current restrictions}
* have changed.
*
* @param restrictions the new restrictions imposed on the repository
*/
void setRestrictions(RepoUsage restrictions);
/**
* @return Returns the restrictions currently in play for the repository
*/
RepoUsage getRestrictions();
/**
* Force an update of the current repository usage. Usage data will be gathered and
* stored as required.
*
* @param usageType the type of usage data that must be updated
* @return <tt>true</tt> if the update succeeded or <tt>false</tt> if
* some other client was already performing the same update
*/
boolean updateUsage(UsageType usageType);
/**
* Force a reset of the current repository usage. Usage data will be zero'd
*
* @param usageType the type of usage data that must be reset
* @return <tt>true</tt> if the reset succeeded or <tt>false</tt> if
* some other client was already performing the same reset
*/
boolean resetUsage(UsageType usageType);
/**
* Get the current repository usage data. This will not trigger an update of the data if it
* is not available; only pre-loaded data will be used.
*
* @return Returns the repository-specific current usage data.
*/
RepoUsage getUsage();
/**
* Calculate and retrieve full status alerts based on the usage and license expiry state.
*
* @return Returns the usage status bean
*/
RepoUsageStatus getUsageStatus();
}