/** * Generates XML for a <code>CacheCallback</code> */ private void generate(String kind, Object callback) throws SAXException { if (callback == null) { return; } handler.startElement("", kind, kind, EMPTY); String className = callback.getClass().getName(); handler.startElement("", CLASS_NAME, CLASS_NAME, EMPTY); handler.characters(className.toCharArray(), 0, className.length()); handler.endElement("", CLASS_NAME, CLASS_NAME); Properties props = null; if (callback instanceof Declarable2) { props = ((Declarable2) callback).getConfig(); } else if (callback instanceof ReflectionBasedAutoSerializer) { props = ((ReflectionBasedAutoSerializer) callback).getConfig(); } else if (callback instanceof Declarable && cache instanceof GemFireCacheImpl) { props = ((GemFireCacheImpl) cache).getDeclarableProperties((Declarable) callback); } generate(props, null); handler.endElement("", kind, kind); }
public void testGetConfig() throws Exception { setupSerializer(); Properties props = new Properties(); props.put("classes", "Pdx#exclude=string.*#exclude=badField, Pdx#identity=id.*, PdxAuto#exclude=long.*#identity=id.*"); serializer.init(props); Properties result = serializer.getConfig(); assertEquals("Pdx, PdxAuto, Pdx#identity=id.*, PdxAuto#identity=id.*, Pdx#exclude=string.*, Pdx#exclude=badField, PdxAuto#exclude=long.*", result.getProperty("classes")); manager.resetCaches(); serializer.init(result); result = serializer.getConfig(); assertEquals("Pdx, PdxAuto, Pdx#identity=id.*, PdxAuto#identity=id.*, Pdx#exclude=string.*, Pdx#exclude=badField, PdxAuto#exclude=long.*", result.getProperty("classes")); }
/** * Generates XML for a <code>CacheCallback</code> */ private void generate(String kind, Object callback) throws SAXException { if (callback == null) { return; } handler.startElement("", kind, kind, EMPTY); String className = callback.getClass().getName(); handler.startElement("", CLASS_NAME, CLASS_NAME, EMPTY); handler.characters(className.toCharArray(), 0, className.length()); handler.endElement("", CLASS_NAME, CLASS_NAME); Properties props = null; if (callback instanceof Declarable2) { props = ((Declarable2) callback).getConfig(); } else if (callback instanceof BridgeWriter) { props = ((BridgeWriter) callback).getProperties(); } else if (callback instanceof BridgeLoader) { props = ((BridgeLoader) callback).getProperties(); } else if (callback instanceof ReflectionBasedAutoSerializer) { props = ((ReflectionBasedAutoSerializer) callback).getConfig(); } else if (callback instanceof Declarable && cache instanceof GemFireCacheImpl) { props = ((GemFireCacheImpl) cache).getDeclarableProperties((Declarable) callback); } generate(props, null); handler.endElement("", kind, kind); }