/** * When a <code>partition-resolver</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The * <code>PartitionResolver</code> is instantiated and initialized with the * parameters, if appropriate. */ private void endPartitionResolver() { Declarable d = createDeclarable(); if (!(d instanceof PartitionResolver)) { throw new CacheXmlException( LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1 .toLocalizedString(new Object[] { d.getClass().getName(), "PartitionResolver"})); } PartitionAttributesImpl pai = peekPartitionAttributesImpl(PARTITION_ATTRIBUTES); pai.setPartitionResolver((PartitionResolver) d); }
/** * When a <code>partition-listener</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The * <code>PartitionListener</code> is instantiated and initialized with the * parameters, if appropriate. */ private void endPartitionListener() { Declarable d = createDeclarable(); if (!(d instanceof PartitionListener)) { throw new CacheXmlException( LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1 .toLocalizedString(new Object[] { d.getClass().getName(), "PartitionListener"})); } PartitionAttributesImpl pai = peekPartitionAttributesImpl(PARTITION_ATTRIBUTES); pai.addPartitionListener((PartitionListener) d); }
/** * When a <code>partition-listener</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The * <code>PartitionListener</code> is instantiated and initialized with the * parameters, if appropriate. */ private void endPartitionListener() { Declarable d = createDeclarable(); if (!(d instanceof PartitionListener)) { throw new CacheXmlException( LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1 .toLocalizedString(new Object[] { d.getClass().getName(), "PartitionListener"})); } PartitionAttributesImpl pai = peekPartitionAttributesImpl(PARTITION_ATTRIBUTES); pai.addPartitionListener((PartitionListener) d); }
/** * Process either the <code>local-properties</code> or <code>global-properties</code> for a * {@link com.gemstone.gemfire.internal.cache.PartitionedRegion} * @param globalOrLocal either the string {@link CacheXml#LOCAL_PROPERTIES} or {@link CacheXml#GLOBAL_PROPERTIES} */ private void endPartitionProperites(String globalOrLocal) { Properties props = new Properties(); Object top = stack.pop(); while (! top.equals(globalOrLocal)) { if (!(top instanceof Parameter)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_ONLY_A_PARAMETER_IS_ALLOWED_IN_THE_CONTEXT_OF_0.toLocalizedString(globalOrLocal)); } Parameter param = (Parameter) top; props.put(param.getName(), param.getValue()); top = stack.pop(); } if (globalOrLocal.equals(GLOBAL_PROPERTIES)) { PartitionAttributesImpl pai = peekPartitionAttributesImpl(GLOBAL_PROPERTIES); pai.setGlobalProperties(props); } else if (globalOrLocal.equals(LOCAL_PROPERTIES)) { PartitionAttributesImpl pai = peekPartitionAttributesImpl(LOCAL_PROPERTIES); pai.setLocalProperties(props); } else { Assert.assertTrue(false, "Argument globalOrLocal has unexpected value " + globalOrLocal); } }
/** * When a <code>partition-resolver</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The * <code>PartitionResolver</code> is instantiated and initialized with the * parameters, if appropriate. */ private void endPartitionResolver() { Declarable d = createDeclarable(); if (!(d instanceof PartitionResolver)) { throw new CacheXmlException( LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1 .toLocalizedString(new Object[] { d.getClass().getName(), "PartitionResolver"})); } PartitionAttributesImpl pai = peekPartitionAttributesImpl(PARTITION_ATTRIBUTES); pai.setPartitionResolver((PartitionResolver) d); }
/** * Process either the <code>local-properties</code> or <code>global-properties</code> for a * {@link com.gemstone.gemfire.internal.cache.PartitionedRegion} * @param globalOrLocal either the string {@link CacheXml#LOCAL_PROPERTIES} or {@link CacheXml#GLOBAL_PROPERTIES} */ private void endPartitionProperites(String globalOrLocal) { Properties props = new Properties(); Object top = stack.pop(); while (! top.equals(globalOrLocal)) { if (!(top instanceof Parameter)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_ONLY_A_PARAMETER_IS_ALLOWED_IN_THE_CONTEXT_OF_0.toLocalizedString(globalOrLocal)); } Parameter param = (Parameter) top; props.put(param.getName(), param.getValue()); top = stack.pop(); } if (globalOrLocal.equals(GLOBAL_PROPERTIES)) { PartitionAttributesImpl pai = peekPartitionAttributesImpl(GLOBAL_PROPERTIES); pai.setGlobalProperties(props); } else if (globalOrLocal.equals(LOCAL_PROPERTIES)) { PartitionAttributesImpl pai = peekPartitionAttributesImpl(LOCAL_PROPERTIES); pai.setLocalProperties(props); } else { Assert.assertTrue(false, "Argument globalOrLocal has unexpected value " + globalOrLocal); } }