/** * When we have finished a <code>parameter</code> element, create a * {@link Parameter}from the top two elements of the stack. */ private void endParameter() { Object value = stack.pop(); String name = (String) stack.pop(); stack.push(new Parameter(name, value)); }
/** * 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); } }
/** * 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); } }
private void endInitializer() { Properties props = new Properties(); Object top = stack.pop(); while (top instanceof Parameter) { Parameter param = (Parameter) top; props.put(param.getName(), param.getValue()); top = stack.pop(); } Assert.assertTrue(top instanceof String); String className = (String) top; Object o; try { Class c = InternalDataSerializer.getCachedClass(className); o = c.newInstance(); } catch (Exception ex) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_WHILE_INSTANTIATING_A_0.toLocalizedString(className), ex); } if (!(o instanceof Declarable)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_CLASS_0_IS_NOT_AN_INSTANCE_OF_DECLARABLE.toLocalizedString(className)); } Declarable d = (Declarable) o; this.cache.setInitializer(d, props); }
private void endInitializer() { Properties props = new Properties(); Object top = stack.pop(); while (top instanceof Parameter) { Parameter param = (Parameter) top; props.put(param.getName(), param.getValue()); top = stack.pop(); } Assert.assertTrue(top instanceof String); String className = (String) top; Object o; try { Class c = InternalDataSerializer.getCachedClass(className); o = c.newInstance(); } catch (Exception ex) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_WHILE_INSTANTIATING_A_0.toLocalizedString(className), ex); } if (!(o instanceof Declarable)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_CLASS_0_IS_NOT_AN_INSTANCE_OF_DECLARABLE.toLocalizedString(className)); } Declarable d = (Declarable) o; this.cache.setInitializer(d, props); }
/** * When we have finished a <code>parameter</code> element, create a * {@link Parameter}from the top two elements of the stack. */ private void endParameter() { Object value = stack.pop(); String name = (String) stack.pop(); stack.push(new Parameter(name, value)); }