private void generateGatewayTransportFilter(GatewayTransportFilter gef) throws SAXException { handler.startElement("", GATEWAY_TRANSPORT_FILTER, GATEWAY_TRANSPORT_FILTER, EMPTY); String className = gef.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 (gef instanceof Declarable2) { props = ((Declarable2) gef).getConfig(); generate(props, null); } handler.endElement("", GATEWAY_TRANSPORT_FILTER, GATEWAY_TRANSPORT_FILTER); }
private void generateGatewayEventSubstitutionFilter(GatewayEventSubstitutionFilter filter) throws SAXException { handler.startElement("", GATEWAY_EVENT_SUBSTITUTION_FILTER, GATEWAY_EVENT_SUBSTITUTION_FILTER, EMPTY); String className = filter.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 (filter instanceof Declarable2) { props = ((Declarable2) filter).getConfig(); generate(props, null); } handler.endElement("", GATEWAY_EVENT_SUBSTITUTION_FILTER, GATEWAY_EVENT_SUBSTITUTION_FILTER); }
private void generateGatewayEventFilter(GatewayEventFilter gef) throws SAXException { handler.startElement("", GATEWAY_EVENT_FILTER, GATEWAY_EVENT_FILTER, EMPTY); String className = gef.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 (gef instanceof Declarable2) { props = ((Declarable2) gef).getConfig(); generate(props, null); } handler.endElement("", GATEWAY_EVENT_FILTER, GATEWAY_EVENT_FILTER); }
private void generate(Declarable d, boolean includeDeclarable) throws SAXException { if (includeDeclarable) { handler.startElement("", DECLARABLE, DECLARABLE, EMPTY); } String className = d.getClass().getName(); handler.startElement("", CLASS_NAME, CLASS_NAME, EMPTY); handler.characters(className.toCharArray(), 0, className.length()); handler.endElement("", CLASS_NAME, CLASS_NAME); if (d instanceof Declarable2) { Properties props = ((Declarable2) d).getConfig(); generate(props, null); } if (includeDeclarable) { handler.endElement("", DECLARABLE, DECLARABLE); } }
/** * Generate XML for partition-listener element in PartitionedRegion Attributes */ private void generate(String kind, PartitionListener pl) throws SAXException { if (pl == null) return; handler.startElement("", kind, kind, EMPTY); String className = pl.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 (pl instanceof Declarable2) { props = ((Declarable2) pl).getConfig(); generate(props, null); } handler.endElement("", kind, kind); }
/** * Generate XML for partition-resolver element in PartitionedRegion Attributes */ private void generate(String kind, PartitionResolver rr) throws SAXException { if (rr == null) return; handler.startElement("", kind, kind, EMPTY); String className = rr.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 (rr instanceof Declarable2) { props = ((Declarable2) rr).getConfig(); generate(props, null); } handler.endElement("", kind, kind); }
Properties props = ((Declarable2) declarable).getConfig(); if (props == null) { return;
/** * 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 = ((InternalCache) cache).getDeclarableProperties((Declarable) callback); } generate(props, null); handler.endElement("", kind, kind); }
@Override public CliFunctionResult executeFunction(final FunctionContext context) { Cache cache = context.getCache(); DistributedMember member = cache.getDistributedSystem().getDistributedMember(); // Identify by name if the name is non-trivial. Otherwise, use the ID String memberId = !member.getName().equals("") ? member.getName() : member.getId(); Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues(); List<AsyncEventQueueDetails> details = asyncEventQueues.stream().map(queue -> { AsyncEventListener listener = queue.getAsyncEventListener(); Properties listenerProperties = new Properties(); if (listener instanceof Declarable2) { listenerProperties = ((Declarable2) listener).getConfig(); } return new AsyncEventQueueDetails(queue.getId(), queue.getBatchSize(), queue.isPersistent(), queue.getDiskStoreName(), queue.getMaximumQueueMemory(), listener.getClass().getName(), listenerProperties); }).collect(Collectors.toList()); return new CliFunctionResult(memberId, details); } }
when(index.getFieldNames()).thenReturn(fields); when(index.getLuceneSerializer()).thenReturn(mySerializer); when(((Declarable2) mySerializer).getConfig()).thenReturn(props);