FileDocCategorySizeDatePackage
Quota.javaAPI DocJavaMail 1.4.34157Tue Nov 17 10:38:12 GMT 2009javax.mail

Quota

public class Quota extends Object
This class represents a set of quotas for a given quota root. Each quota root has a set of resources, represented by the Quota.Resource class. Each resource has a name (for example, "STORAGE"), a current usage, and a usage limit. See RFC 2087.
since
JavaMail 1.4
author
Bill Shannon

Fields Summary
public String
quotaRoot
The name of the quota root.
public Resource[]
resources
The set of resources associated with this quota root.
Constructors Summary
public Quota(String quotaRoot)
Create a Quota object for the named quotaroot with no associated resources.

param
quotaRoot the name of the quota root

	this.quotaRoot = quotaRoot;
    
Methods Summary
public voidsetResourceLimit(java.lang.String name, long limit)
Set a resource limit for this quota root.

param
name the name of the resource
param
limit the resource limit

	if (resources == null) {
	    resources = new Quota.Resource[1];
	    resources[0] = new Quota.Resource(name, 0, limit);
	    return;
	}
	for (int i = 0; i < resources.length; i++) {
	    if (resources[i].name.equalsIgnoreCase(name)) {
		resources[i].limit = limit;
		return;
	    }
	}
	Quota.Resource[] ra = new Quota.Resource[resources.length + 1];
	System.arraycopy(resources, 0, ra, 0, resources.length);
	ra[ra.length - 1] = new Quota.Resource(name, 0, limit);
	resources = ra;