// can be built.
if (localSize == 0) {
localSize = 1;
}
RemotePoliciesConfiguration remotePolicies =
marinerConfig.getRemotePolicies();
RemotePolicyCacheConfiguration policyCacheConfiguration =
remotePolicies.getPolicyCache();
if (policyCacheConfiguration == null) {
policyCacheConfiguration = new RemotePolicyCacheConfiguration();
}
int remoteSize;
remoteSize = getInteger(policyCacheConfiguration.getMaxCacheSize(),
DEFAULT_REMOTE_GROUP_SIZE);
PolicyCacheBuilder builder = new PolicyCacheBuilder(
localSize, remoteSize);
CacheControlConstraints localConstraints = createLocalCacheConstraints(
Boolean.TRUE, null);
PolicyCachePartitionConstraints localPartitionConstraints =
createPartitionConstraints(localSize, localConstraints);
builder.setLocalPartitionConstraints(localPartitionConstraints);
PolicyCachePartitionConstraints remotePartitionConstraints =
createPartitionConstraints(remoteSize, remoteConstraints);
builder.setRemotePartitionConstraints(remotePartitionConstraints);
// Now build the policy specific groups to the local group.
for (Iterator i = policyTypes.iterator(); i.hasNext();) {
PolicyType policyType = (PolicyType) i.next();
PolicyCacheConfiguration groupConfiguration =
getPolicyCacheConfiguration(policyType);
int maxCount;
if (groupConfiguration == null) {
// Allow some entries in the group to ensure that when a policy
// is marked as uncacheable that it is preserved.
maxCount = 10;
} else {
maxCount = getInteger(groupConfiguration.getMaxEntries(),
Integer.MAX_VALUE);
if (maxCount == -1) {
maxCount = Integer.MAX_VALUE;
}
}
builder.addDefaultLocalPolicySpecificGroup(
policyType, maxCount);
}
Iterator i = remotePolicies.getQuotaIterator();
while (i.hasNext()) {
RemotePolicyQuotaConfiguration quota =
(RemotePolicyQuotaConfiguration) i.next();
int percentage = quota.getPercentage().intValue();
String url = quota.getUrl();