/** * When a <code>value-constraint</code> element is finished, the name of the * class should be on top of the stack. * * @throws CacheXmlException If the value constraint class cannot be loaded */ private void endValueConstraint() { String className = ((StringBuffer) stack.pop()).toString().trim(); Class c; try { c = InternalDataSerializer.getCachedClass(className); } catch (Exception ex) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_COULD_NOT_LOAD_VALUECONSTRAINT_CLASS_0.toLocalizedString(className), ex); } // The region attributes should be on top of the stack RegionAttributesCreation attrs = peekRegionAttributesContext("value-constraint"); attrs.setValueConstraint(c); }
/** * When a <code>value-constraint</code> element is finished, the name of the * class should be on top of the stack. * * @throws CacheXmlException If the value constraint class cannot be loaded */ private void endValueConstraint() { String className = ((StringBuffer) stack.pop()).toString().trim(); Class c; try { c = InternalDataSerializer.getCachedClass(className); } catch (Exception ex) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_COULD_NOT_LOAD_VALUECONSTRAINT_CLASS_0.toLocalizedString(className), ex); } // The region attributes should be on top of the stack RegionAttributesCreation attrs = peekRegionAttributesContext("value-constraint"); attrs.setValueConstraint(c); }
/** * Tests the value constraints region attribute that was added in * GemFire 4.0. * * @since 4.1 */ public void testConstrainedValues() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); attrs.setValueConstraint(String.class); cache.createRegion("root", attrs); testXml(cache); }
attrs.setValueConstraint(this.valueConstraint);
/** * Tests that named region attributes are registered when the cache is * created. */ public void testRegisteringNamedRegionAttributes() { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs; String id1 = "id1"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setMirrorType(MirrorType.KEYS); cache.setRegionAttributes(id1, attrs); String id2 = "id2"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.DISTRIBUTED_NO_ACK); attrs.setMirrorType(MirrorType.KEYS_VALUES); attrs.setConcurrencyLevel(15); cache.setRegionAttributes(id2, attrs); String id3 = "id3"; attrs = new RegionAttributesCreation(cache); attrs.setScope(Scope.LOCAL); attrs.setValueConstraint(Integer.class); cache.setRegionAttributes(id3, attrs); testXml(cache); }
attr.setKeyConstraint(regDef.getKeyConstraint()); if (regDef.getValueConstraint() != null) attr.setValueConstraint(regDef.getValueConstraint()); if (regDef.getLoadFactor() != null) attr.setLoadFactor(regDef.getLoadFactor().floatValue());
attrs.setScope(Scope.LOCAL); attrs.setEarlyAck(true); attrs.setValueConstraint(String.class); Region subregion = root.createSubregion("subregion", attrs); attrs.setScope(Scope.DISTRIBUTED_ACK); attrs.setEarlyAck(false); attrs.setValueConstraint(Long.class); Region subregion2 = root.createSubregion("subregion2", attrs);
if (parentIsUserSpecified) { if (parentWithHas.hasValueConstraint()) { setValueConstraint(parent.getValueConstraint()); setValueConstraint(parent.getValueConstraint());
if (parentIsUserSpecified) { if (parentWithHas.hasValueConstraint()) { setValueConstraint(parent.getValueConstraint()); setValueConstraint(parent.getValueConstraint());