public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); // the actual builder or parser DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new CacheXmlParser()); return builder; }
/** * Parse XML data in the <code>InputStream</code> * * using {@link #parse(InputStream, LogWriterI18n)}. */ public static CacheXmlParser parse(InputStream is) { return parse(is, null); }
@Override public void characters(char[] ch, int start, int length) throws SAXException { handler.characters(ch, start, length); }
private void endAsyncEventListener() { Declarable d = createDeclarable(); if (!(d instanceof AsyncEventListener)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_ASYNCEVENTLISTENER.toLocalizedString(d.getClass().getName())); } AsyncEventQueueCreation eventChannel = peekAsyncEventQueueContext(ASYNC_EVENT_LISTENER); eventChannel.setAsyncEventListener((AsyncEventListener) d); }
private void endGatewayEventFilter() { Declarable d = createDeclarable(); if (!(d instanceof GatewayEventFilter)) { throw new CacheXmlException( LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_1 .toLocalizedString(new Object[] { d.getClass().getName(), "GatewayEventFilter"})); } GatewaySenderFactory senderFactory = peekGatewaySender(GATEWAY_EVENT_FILTER); senderFactory.addGatewayEventFilter((GatewayEventFilter)d); }
/** * When a <code>cache-listener</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The cache listener is * instantiated and initialized with the parameters, if appropriate. */ private void endCacheListener() { Declarable d = createDeclarable(); if (!(d instanceof CacheListener)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_CACHELISTENER.toLocalizedString(d.getClass().getName())); } RegionAttributesCreation attrs = peekRegionAttributesContext(CACHE_LISTENER); attrs.addCacheListener((CacheListener) d); }
endCache(); endClientCache(); endCacheServer(); endCacheServer(); } else if (qName.equals(LOAD_PROBE)) { endLoadProbe(); }else if(qName.equals(CLIENT_SUBSCRIPTION)){ endClientHaQueue(); endPool(); endDynamicRegionFactory(); endGatewayHub(); endSerialGatewaySender(); endGatewayReceiver(); endGatewayEventFilter(); endGatewayTransportFilter(); endGateway(); endGatewayListener();
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (qName.equals(CACHE)) { startCache(atts); startClientCache(atts); startCacheServer(atts); startCacheServer(atts); startPool(atts); startClientHaQueue(atts); startDynamicRegionFactory(atts); startGatewayHub(atts); startGatewaySender(atts); startGatewayReceiver(atts); startGateway(atts); startGatewayEndpoint(atts); startGatewayQueue(atts); } else if (qName.equals(ASYNC_EVENT_QUEUE)) { startAsyncEventQueue(atts);
/** * When we have finished a <code>declarable</code>, instantiate an instance * of the {@link Declarable}and push it on the stack. */ private void endDeclarable() { Declarable d = createDeclarable(); stack.push(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); }
CacheXmlParser handler = new CacheXmlParser(); handler.setLogWriter(logwriter); try { SAXParserFactory factory = SAXParserFactory.newInstance();
CacheXmlParser parser = CacheXmlParser.parse(fis); CacheCreation dummyCache = parser.getCacheCreation(); List dummyCacheServers = dummyCache.getBridgeServers(); if (dummyCacheServers != null) {
endCache(); endClientCache(); endCacheServer(); endCacheServer(); } else if (qName.equals(LOAD_PROBE)) { endLoadProbe(); }else if(qName.equals(CLIENT_SUBSCRIPTION)){ endClientHaQueue(); endPool(); endDynamicRegionFactory(); endSerialGatewaySender(); endGatewayReceiver(); endGatewayEventFilter(); endGatewayEventSubstitutionFilter(); endGatewayTransportFilter(); endAsyncEventQueue(); endRegion();
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if (qName.equals(CACHE)) { startCache(atts); startClientCache(atts); startCacheServer(atts); startCacheServer(atts); startPool(atts); startClientHaQueue(atts); startDynamicRegionFactory(atts); startGatewaySender(atts); startGatewayReceiver(atts); startAsyncEventQueue(atts); doLocator(atts); startRegion(atts); startRegion(atts); startRegionAttributes(atts);
/** * When we have finished a <code>declarable</code>, instantiate an instance * of the {@link Declarable}and push it on the stack. */ private void endDeclarable() { Declarable d = createDeclarable(); stack.push(d); }
/** * When a <code>cache-listener</code> element is finished, the {@link * Parameter}s and class names are popped off the stack. The cache listener is * instantiated and initialized with the parameters, if appropriate. */ private void endCacheListener() { Declarable d = createDeclarable(); if (!(d instanceof CacheListener)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_CACHELISTENER.toLocalizedString(d.getClass().getName())); } RegionAttributesCreation attrs = peekRegionAttributesContext(CACHE_LISTENER); attrs.addCacheListener((CacheListener) 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); }
private void endAsyncEventListener() { Declarable d = createDeclarable(); if (!(d instanceof AsyncEventListener)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_ASYNCEVENTLISTENER.toLocalizedString(d.getClass().getName())); } AsyncEventQueueCreation eventChannel = peekAsyncEventQueueContext(ASYNC_EVENT_LISTENER); eventChannel.setAsyncEventListener((AsyncEventListener) d); }