Esper事件处理引擎_4_XML 数据结构处理
2014-07-30 20:52
351 查看
参考博客栏目 :http://blog.csdn.net/column/details/esper.html
Esper 事件引擎栏目:http://blog.csdn.net/xiaohulunb/article/category/2436609
GitHub代码地址:https://github.com/xiaohulu/my_note/tree/master/src/main/java/com/framework_technology/esper
代码引用的 xml/xsd 以 GitHub中为主。
Esper 事件引擎栏目:http://blog.csdn.net/xiaohulunb/article/category/2436609
GitHub代码地址:https://github.com/xiaohulu/my_note/tree/master/src/main/java/com/framework_technology/esper
XML 数据结构
测试未成功,待解决代码引用的 xml/xsd 以 GitHub中为主。
package com.framework_technology.esper.event_type; import com.espertech.esper.client.ConfigurationEventTypeXMLDOM; import com.espertech.esper.client.EPServiceProvider; import com.espertech.esper.client.EPServiceProviderManager; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; import java.io.StringReader; import java.net.URL; /** * Created by IntelliJ IDEA. * User: wei.Li * Date: 14-7-28 * Time: 17:57 * TODO unfinished */ public class XML_EventType { public void getA() throws ParserConfigurationException, IOException, SAXException { URL schemaURL = this.getClass().getClassLoader().getResource("sensor.xsd"); URL xml = this.getClass().getClassLoader().getResource("sensor.xml"); EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider(); ConfigurationEventTypeXMLDOM sensorcfg = new ConfigurationEventTypeXMLDOM(); sensorcfg.setRootElementName("Sensor"); sensorcfg.setSchemaResource(schemaURL.toString()); epService.getEPAdministrator().getConfiguration() .addEventType("SensorEvent", sensorcfg); String epl = "select ID, Observation.Command, Observation.ID, " + " Observation.Tag[0].ID, Observation.Tag[1].ID" + "from SensorEvent"; InputSource source = new InputSource(new StringReader(xml.toString())); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); builderFactory.setNamespaceAware(true); Document doc = builderFactory.newDocumentBuilder().parse(source); epService.getEPRuntime().sendEvent(doc); } public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException { XML_EventType xml_eventType = new XML_EventType(); xml_eventType.getA(); } }
相关文章推荐
- Esper事件处理引擎_1_JavaBean 数据结构处理
- Esper事件处理引擎_2_Map 数据结构处理
- Esper事件处理引擎_5_EPL 语法_1_基本语法
- Esper事件处理引擎_10_EPL 语法___View 窗口视图条件语法
- Esper事件处理引擎_10_EPL 语法___View 窗口视图条件语法
- 复杂事件处理引擎—Esper 处理模型
- Esper事件处理引擎_6_EPL 语法_2_Context 上下文_1_simple
- Esper事件处理引擎_16_EPL 语法_8_NamedWindow
- esper(复杂事件处理引擎)简介
- 复杂事件处理引擎—Esper 处理模型
- Esper事件处理引擎_8_EPL 语法_2_Context 上下文_2_条件控制
- Esper事件处理引擎_14_EPL 语法_7_Patterns_1_模式匹配
- Esper事件处理引擎_11_EPL 语法_4_InsertInto 流对流的插入操作
- Esper事件处理引擎_9_EPL 语法_2_Context 上下文_3_过滤条件
- Esper事件处理引擎_13_EPL 语法_6_Annotation注解使用
- 复杂事件处理引擎—Esper入门
- 复杂事件处理引擎—Esper参考(事件部分)
- 复杂事件处理引擎—Esper入门
- Esper事件处理引擎_12_EPL 语法_5_Subqueries子查询
- 复杂事件处理引擎—Esper入门(第二弹)