Commit c0e666d2 authored by Gwenael Cattez's avatar Gwenael Cattez
Browse files

Manage MapEventBean behavior

parent 5d79f9e6
......@@ -20,6 +20,11 @@
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-runtime-factory</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.frascati.demo</groupId>
<artifactId>common-ws-notification</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.ow2.frascati.examples.test</groupId>
<artifactId>frascati-test</artifactId>
......
......@@ -29,6 +29,7 @@ package org.ow2.frascati.esper.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.ow2.frascati.esper.api.EventListener;
import org.ow2.frascati.esper.api.bean.CEPBean;
......@@ -38,6 +39,8 @@ import com.espertech.esper.client.EPServiceProvider;
import com.espertech.esper.client.EPStatement;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.client.StatementAwareUpdateListener;
import com.espertech.esper.event.bean.BeanEventBean;
import com.espertech.esper.event.map.MapEventBean;
/**
*
......@@ -57,13 +60,29 @@ public class EventListenerWrapper implements StatementAwareUpdateListener
public void update(EventBean[] newBeans, EventBean[] oldBeans, EPStatement statement, EPServiceProvider provider)
{
String eventID=statement.getName();
// System.out.println("EventID : "+eventID);
List<CEPBean> cepBeans = new ArrayList<CEPBean>();
CEPBean cepBean;
for(EventBean bean : newBeans)
{
cepBean=new JAXBBean(bean.getUnderlying());
cepBeans.add(cepBean);
if(bean instanceof MapEventBean)
{
Map<String,Object> map=((MapEventBean) bean).getProperties();
// System.out.println("MapEventBean");
for(String s : map.keySet())
{
BeanEventBean wrappedBean=(BeanEventBean) map.get(s);
// System.out.println(s+ " "+wrappedBean.getClass().getName()+" "+wrappedBean);
cepBean=new JAXBBean(wrappedBean.getUnderlying());
cepBeans.add(cepBean);
}
}
else
{
cepBean=new JAXBBean(bean.getUnderlying());
cepBeans.add(cepBean);
}
}
listener.update(eventID, cepBeans);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment