use of org.apache.geode.cache.Scope in project geode by apache.
the class PartitionRegionConfigValidator method validatePartitionAttrsFromPRConfig.
/**
* This method validates the PartitionedAttributes that user provided PR Attributes with PR
* Attributes set in PR Config obtained from global meta-data allPartitionedRegion region
*/
void validatePartitionAttrsFromPRConfig(PartitionRegionConfig prconf) {
final PartitionAttributes prconfPA = prconf.getPartitionAttrs();
final PartitionAttributes userPA = pr.getAttributes().getPartitionAttributes();
if (userPA.getTotalSize() != prconfPA.getTotalSize()) {
throw new IllegalStateException(LocalizedStrings.PartitionedRegion_TOTAL_SIZE_IN_PARTITIONATTRIBUTES_IS_INCOMPATIBLE_WITH_GLOBALLY_SET_TOTAL_SIZE_SET_THE_TOTAL_SIZE_TO_0MB.toLocalizedString(Long.valueOf(prconfPA.getTotalSize())));
}
if (userPA.getRedundantCopies() != prconfPA.getRedundantCopies()) {
throw new IllegalStateException(LocalizedStrings.PartitionedRegion_REQUESTED_REDUNDANCY_0_IS_INCOMPATIBLE_WITH_EXISTING_REDUNDANCY_1.toLocalizedString(new Object[] { Integer.valueOf(userPA.getRedundantCopies()), Integer.valueOf(prconfPA.getRedundantCopies()) }));
}
if (prconf.isFirstDataStoreCreated() && pr.isDataStore()) {
validateDistributedEvictionAttributes(prconf.getEvictionAttributes());
}
Scope prconfScope = prconf.getScope();
Scope myScope = pr.getScope();
if (!myScope.equals(prconfScope)) {
throw new IllegalStateException(LocalizedStrings.PartitionedRegion_SCOPE_IN_PARTITIONATTRIBUTES_IS_INCOMPATIBLE_WITH_ALREADY_SET_SCOPESET_THE_SCOPE_TO_0.toLocalizedString(prconfScope));
}
final int prconfTotalNumBuckets = prconfPA.getTotalNumBuckets();
if (userPA.getTotalNumBuckets() != prconfTotalNumBuckets) {
throw new IllegalStateException(LocalizedStrings.PartitionedRegion_THE_TOTAL_NUMBER_OF_BUCKETS_FOUND_IN_PARTITIONATTRIBUTES_0_IS_INCOMPATIBLE_WITH_THE_TOTAL_NUMBER_OF_BUCKETS_USED_BY_OTHER_DISTRIBUTED_MEMBERS_SET_THE_NUMBER_OF_BUCKETS_TO_1.toLocalizedString(new Object[] { Integer.valueOf(userPA.getTotalNumBuckets()), Integer.valueOf(prconfTotalNumBuckets) }));
}
validatePartitionListeners(prconf, userPA);
validatePartitionResolver(prconf, userPA);
validateColocatedWith(prconf, userPA);
validateExpirationAttributes(pr.getAttributes(), prconf);
}
Aggregations