@Override protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy == null) { dataPolicy = (isPersistent() ? DataPolicy.PERSISTENT_REPLICATE : DataPolicy.REPLICATE); } else if (DataPolicy.EMPTY.equals(dataPolicy)) { dataPolicy = DataPolicy.EMPTY; } else { // Validate that the user-defined Data Policy matches the appropriate Spring GemFire XML namespace // configuration meta-data element for the Region (i.e. <gfe:replicated-region .../>)! Assert.isTrue(dataPolicy.withReplication(), String.format( "Data Policy '%1$s' is not supported in Replicated Regions.", dataPolicy)); } // Validate that the data-policy and persistent attributes are compatible when both are specified! RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); }
@Override protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy == null) { dataPolicy = (isPersistent() ? DataPolicy.PERSISTENT_PARTITION : DataPolicy.PARTITION); } else { // Validate that the user-defined Data Policy matches the appropriate Spring GemFire XML namespace // configuration meta-data element for Region (i.e. <gfe:partitioned-region .../>)! Assert.isTrue(dataPolicy.withPartitioning(), String.format( "Data Policy '%1$s' is not supported in Partitioned Regions.", dataPolicy)); } // Validate the data-policy and persistent attributes are compatible when specified! RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); }
@Override protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy == null) { dataPolicy = (isPersistent() ? DataPolicy.PERSISTENT_REPLICATE : DataPolicy.REPLICATE); } else if (DataPolicy.EMPTY.equals(dataPolicy)) { dataPolicy = DataPolicy.EMPTY; } else { // Validate that the user-defined Data Policy matches the appropriate Spring Pivotal GemFire XML namespace // configuration meta-data element for the Region (i.e. <gfe:replicated-region .../>)! Assert.isTrue(dataPolicy.withReplication(), String.format( "Data Policy '%1$s' is not supported in Replicated Regions.", dataPolicy)); } // Validate that the data-policy and persistent attributes are compatible when both are specified! RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); }
@Override protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy == null) { dataPolicy = (isPersistent() ? DataPolicy.PERSISTENT_PARTITION : DataPolicy.PARTITION); } else { // Validate that the user-defined Data Policy matches the appropriate Spring Pivotal GemFire XML namespace // configuration meta-data element for Region (i.e. <gfe:partitioned-region .../>)! Assert.isTrue(dataPolicy.withPartitioning(), String.format( "Data Policy '%1$s' is not supported in Partitioned Regions.", dataPolicy)); } // Validate the data-policy and persistent attributes are compatible when specified! RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); }
RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, this.persistent);
RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, this.persistent);
/** * Validates the configured Data Policy and may override it, taking into account the 'persistent' attribute * and constraints for the Region type. * * @param regionFactory the GemFire RegionFactory used to create the desired Region. * @param persistent a boolean value indicating whether the Region should persist it's data to disk. * @param dataPolicy requested Data Policy as set by the user in the Spring GemFire configuration meta-data. * @see org.apache.geode.cache.DataPolicy * @see org.apache.geode.cache.RegionFactory */ protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, String dataPolicy) { if (dataPolicy != null) { DataPolicy resolvedDataPolicy = new DataPolicyConverter().convert(dataPolicy); Assert.notNull(resolvedDataPolicy, String.format("Data Policy [%s] is invalid", dataPolicy)); RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(resolvedDataPolicy, this.persistent); regionFactory.setDataPolicy(resolvedDataPolicy); setDataPolicy(resolvedDataPolicy); } else { DataPolicy regionAttributesDataPolicy = getDataPolicy(getAttributes(), DataPolicy.DEFAULT); DataPolicy resolvedDataPolicy = isPersistent() && DataPolicy.DEFAULT.equals(regionAttributesDataPolicy) ? DataPolicy.PERSISTENT_REPLICATE : regionAttributesDataPolicy; RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(resolvedDataPolicy, this.persistent); regionFactory.setDataPolicy(resolvedDataPolicy); setDataPolicy(resolvedDataPolicy); } }
/** * Validates and sets the {@link DataPolicy} on the {@link RegionFactory} used to create and configure * the {@link Region} from this {@link FactoryBean}. * * @param regionFactory the RegionFactory used by this FactoryBean to create and configure the Region. * @param persistent a boolean value indicating whether the Region should be persistent and persist it's * data to disk. * @param dataPolicy the configured Data Policy for the Region. * @see #resolveDataPolicy(org.apache.geode.cache.RegionFactory, Boolean, String) * @see org.apache.geode.cache.DataPolicy * @see org.apache.geode.cache.RegionFactory */ protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy != null) { RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, this.persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); } else { resolveDataPolicy(regionFactory, persistent, (String) null); } }
/** * Validates and sets the Data Policy on the RegionFactory used to create and configure the Region from this * FactoryBean. * * @param regionFactory the RegionFactory used by this FactoryBean to create and configure the Region. * @param persistent a boolean value indicating whether the Region should be persistent and persist it's * data to disk. * @param dataPolicy the configured Data Policy for the Region. * @see #resolveDataPolicy(org.apache.geode.cache.RegionFactory, Boolean, String) * @see org.apache.geode.cache.DataPolicy * @see org.apache.geode.cache.RegionFactory */ protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, DataPolicy dataPolicy) { if (dataPolicy != null) { RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(dataPolicy, this.persistent); regionFactory.setDataPolicy(dataPolicy); setDataPolicy(dataPolicy); } else { resolveDataPolicy(regionFactory, persistent, (String) null); } }
/** * Validates the configured Data Policy and may override it, taking into account the 'persistent' attribute * and constraints for the Region type. * * @param regionFactory the Pivotal GemFire RegionFactory used to create the desired Region. * @param persistent a boolean value indicating whether the Region should persist it's data to disk. * @param dataPolicy requested Data Policy as set by the user in the Spring Pivotal GemFire configuration meta-data. * @see org.apache.geode.cache.DataPolicy * @see org.apache.geode.cache.RegionFactory */ protected void resolveDataPolicy(RegionFactory<K, V> regionFactory, Boolean persistent, String dataPolicy) { if (dataPolicy != null) { DataPolicy resolvedDataPolicy = new DataPolicyConverter().convert(dataPolicy); Assert.notNull(resolvedDataPolicy, String.format("Data Policy [%s] is invalid", dataPolicy)); RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(resolvedDataPolicy, this.persistent); regionFactory.setDataPolicy(resolvedDataPolicy); setDataPolicy(resolvedDataPolicy); } else { DataPolicy regionAttributesDataPolicy = getDataPolicy(getAttributes(), DataPolicy.DEFAULT); DataPolicy resolvedDataPolicy = isPersistent() && DataPolicy.DEFAULT.equals(regionAttributesDataPolicy) ? DataPolicy.PERSISTENT_REPLICATE : regionAttributesDataPolicy; RegionUtils.assertDataPolicyAndPersistentAttributeAreCompatible(resolvedDataPolicy, this.persistent); regionFactory.setDataPolicy(resolvedDataPolicy); setDataPolicy(resolvedDataPolicy); } }