Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
frascati
frascati
Commits
c0e666d2
Commit
c0e666d2
authored
Jul 30, 2012
by
Gwenael Cattez
Browse files
Manage MapEventBean behavior
parent
5d79f9e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
demo/common/common-cep/common-cep-engine/pom.xml
View file @
c0e666d2
...
...
@@ -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>
...
...
demo/common/common-cep/common-cep-engine/src/main/java/org/ow2/frascati/esper/impl/EventListenerWrapper.java
View file @
c0e666d2
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment