Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
frascati
frascati
Commits
8bb0ff04
Commit
8bb0ff04
authored
Jun 19, 2012
by
Gwenael Cattez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New version of the Fire Detector with CEP engine
parent
d4a8e89f
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1077 additions
and
0 deletions
+1077
-0
demo/common/twitter/src/main/java/org/ow2/frascati/demo/twitter/TwitterImpl.java
.../main/java/org/ow2/frascati/demo/twitter/TwitterImpl.java
+2
-0
demo/fire-emergency/fire-detector-cep/pom.xml
demo/fire-emergency/fire-detector-cep/pom.xml
+86
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/FireDetectorSystem.java
...java/org/ow2/frascati/esper/alert/FireDetectorSystem.java
+68
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/AlarmLauncherListener.java
.../frascati/esper/alert/listener/AlarmLauncherListener.java
+71
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/COListener.java
...ava/org/ow2/frascati/esper/alert/listener/COListener.java
+60
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/HeatListener.java
...a/org/ow2/frascati/esper/alert/listener/HeatListener.java
+60
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/bean/COBean.java
...cep/src/main/java/org/ow2/frascati/esper/bean/COBean.java
+60
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/bean/HeatBean.java
...p/src/main/java/org/ow2/frascati/esper/bean/HeatBean.java
+59
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/simulator/EventSimulator.java
.../main/java/org/ow2/frascati/simulator/EventSimulator.java
+296
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/simulator/EventSimulatorItf.java
...in/java/org/ow2/frascati/simulator/EventSimulatorItf.java
+37
-0
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/simulator/JSliderChangeListener.java
...ava/org/ow2/frascati/simulator/JSliderChangeListener.java
+55
-0
demo/fire-emergency/fire-detector-cep/src/main/resources/alarm-launcher.composite
...-detector-cep/src/main/resources/alarm-launcher.composite
+48
-0
demo/fire-emergency/fire-detector-cep/src/main/resources/co-detector.composite
...ire-detector-cep/src/main/resources/co-detector.composite
+44
-0
demo/fire-emergency/fire-detector-cep/src/main/resources/fire-detector-cep.composite
...tector-cep/src/main/resources/fire-detector-cep.composite
+79
-0
demo/fire-emergency/fire-detector-cep/src/main/resources/heat-detector.composite
...e-detector-cep/src/main/resources/heat-detector.composite
+44
-0
demo/fire-emergency/fire-detector-cep/src/test/resources/logging.properties
...y/fire-detector-cep/src/test/resources/logging.properties
+0
-0
demo/fire-emergency/pom.xml
demo/fire-emergency/pom.xml
+1
-0
demo/pom.xml
demo/pom.xml
+7
-0
No files found.
demo/common/twitter/src/main/java/org/ow2/frascati/demo/twitter/TwitterImpl.java
View file @
8bb0ff04
...
...
@@ -25,6 +25,7 @@
package
org.ow2.frascati.demo.twitter
;
import
org.eclipse.jetty.util.log.Log
;
import
org.osoa.sca.annotations.EagerInit
;
import
org.osoa.sca.annotations.Init
;
import
org.osoa.sca.annotations.Property
;
...
...
@@ -122,6 +123,7 @@ public class TwitterImpl implements ITwitter
{
try
{
Log
.
info
(
""
);
twitter
.
sendDirectMessage
(
receiver
,
message
);
}
catch
(
TwitterException
e
)
...
...
demo/fire-emergency/fire-detector-cep/pom.xml
0 → 100644
View file @
8bb0ff04
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<artifactId>
fire-emergency
</artifactId>
<groupId>
org.ow2.frascati.demo
</groupId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
..
</relativePath>
</parent>
<artifactId>
fire-detector-cep
</artifactId>
<name>
Fire Emergency Fire Detector CEP version
</name>
<properties>
<composite.file>
fire-detector-cep
</composite.file>
<composite.file.local>
fire-detector-cep
</composite.file.local>
<composite.file.deploy>
fire-detector-cep
</composite.file.deploy>
<service>
event-simulator
</service>
<method>
simulate
</method>
</properties>
<build>
<plugins>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
1.5
</source>
<target>
1.5
</target>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<systemProperties>
<property>
<name>
java.util.logging.config.file
</name>
<value>
${basedir}/src/test/resources/logging.properties
</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
org.ow2.frascati.soceda
</groupId>
<artifactId>
soceda-cep-engine
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.ow2.frascati
</groupId>
<artifactId>
frascati-explorer-api
</artifactId>
<version>
1.5-SNAPSHOT
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.ow2.frascati
</groupId>
<artifactId>
frascati-binding-rest
</artifactId>
</dependency>
<dependency>
<groupId>
org.ow2.frascati
</groupId>
<artifactId>
frascati-binding-ws
</artifactId>
</dependency>
<dependency>
<groupId>
org.ow2.frascati.gcs
</groupId>
<artifactId>
frascati-binding-jgroups
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/FireDetectorSystem.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.alert
;
import
org.objectweb.fractal.api.Component
;
import
org.ow2.frascati.FraSCAti
;
import
org.ow2.frascati.util.FrascatiException
;
/**
*
*/
public
class
FireDetectorSystem
{
public
static
final
String
COMPOSITE
=
"fire-detector-cep.composite"
;
public
static
FraSCAti
frascati
;
public
static
Component
composite
;
/**
* Museum demo startup
*
* @param args
* @throws FrascatiException
* @throws InterruptedException
*/
public
static
void
main
(
String
[]
args
)
throws
FrascatiException
,
InterruptedException
{
frascati
=
FraSCAti
.
newFraSCAti
();
composite
=
frascati
.
getComposite
(
COMPOSITE
);
System
.
out
.
println
(
"Get Esper Engine Service"
);
// Runnable visitorService = (Runnable) frascati.getService(composite, "visitors-local-run", Runnable.class);
// Runnable guardianService = (Runnable) frascati.getService(composite, "guardians-local-run", Runnable.class);
// visitorService.run();
// guardianService.run();
System
.
out
.
println
(
"Send Terminal Event"
);
Thread
.
currentThread
().
join
();
}
}
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/AlarmLauncherListener.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.alert.listener
;
import
java.util.Date
;
import
itemis.demo.Alarm
;
import
itemis.demo.AlarmListener
;
import
org.osoa.sca.annotations.Reference
;
import
org.osoa.sca.annotations.Scope
;
import
org.ow2.frascati.esper.api.EsperEngine
;
import
org.ow2.frascati.esper.impl.EventListener
;
import
com.espertech.esper.client.EventBean
;
/**
*
*/
@Scope
(
"COMPOSITE"
)
public
class
AlarmLauncherListener
extends
EventListener
{
@Reference
private
EsperEngine
engineLocal
;
@Reference
(
required
=
false
)
private
AlarmListener
alarmListener
;
public
void
update
(
EventBean
[]
newEvents
,
EventBean
[]
oldEvents
)
{
String
id
;
Date
timestamp
;
for
(
EventBean
tmpBean
:
newEvents
)
{
id
=(
String
)
tmpBean
.
get
(
"percentCO"
);
timestamp
=(
Date
)
tmpBean
.
get
(
"timestamp"
);
System
.
out
.
println
(
"[AlarmListener] receive alarm from "
+
id
+
" at "
+
timestamp
+
", forward it on JChannel"
);
Alarm
alarm
=
new
Alarm
();
alarm
.
setId
(
id
);
alarm
.
setTimestramp
(
timestamp
);
alarmListener
.
notifyAlarm
(
alarm
);
}
}
}
\ No newline at end of file
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/COListener.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.alert.listener
;
import
java.util.Date
;
import
org.osoa.sca.annotations.Reference
;
import
org.osoa.sca.annotations.Scope
;
import
org.ow2.frascati.esper.api.EsperEngine
;
import
org.ow2.frascati.esper.impl.EventListener
;
import
com.espertech.esper.client.EventBean
;
/**
*
*/
@Scope
(
"COMPOSITE"
)
public
class
COListener
extends
EventListener
{
@Reference
private
EsperEngine
engineLocal
;
public
void
update
(
EventBean
[]
newEvents
,
EventBean
[]
oldEvents
)
{
float
percentCO
;
Date
timestamp
;
for
(
EventBean
tmpBean
:
newEvents
)
{
percentCO
=(
Float
)
tmpBean
.
get
(
"percentCO"
);
timestamp
=(
Date
)
tmpBean
.
get
(
"timestamp"
);
System
.
out
.
println
(
"[COListener] "
+
percentCO
+
" percent of CO at "
+
timestamp
);
}
}
}
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/alert/listener/HeatListener.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.alert.listener
;
import
java.util.Date
;
import
org.osoa.sca.annotations.Reference
;
import
org.osoa.sca.annotations.Scope
;
import
org.ow2.frascati.esper.api.EsperEngine
;
import
org.ow2.frascati.esper.impl.EventListener
;
import
com.espertech.esper.client.EventBean
;
/**
*
*/
@Scope
(
"COMPOSITE"
)
public
class
HeatListener
extends
EventListener
{
@Reference
private
EsperEngine
engineLocal
;
public
void
update
(
EventBean
[]
newEvents
,
EventBean
[]
oldEvents
)
{
float
celciusTemperature
;
Date
timestamp
;
for
(
EventBean
tmpBean
:
newEvents
)
{
celciusTemperature
=(
Float
)
tmpBean
.
get
(
"celciusTemperature"
);
timestamp
=(
Date
)
tmpBean
.
get
(
"timestamp"
);
System
.
out
.
println
(
"[HeatListener] "
+
celciusTemperature
+
" celcius degrees at "
+
timestamp
);
}
}
}
\ No newline at end of file
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/bean/COBean.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.bean
;
import
java.util.Date
;
/**
*
*/
public
class
COBean
{
protected
float
percentCO
;
protected
Date
timestamp
;
public
float
getPercentCO
()
{
return
percentCO
;
}
public
void
setPercentCO
(
float
percentCO
)
{
this
.
percentCO
=
percentCO
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
}
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/esper/bean/HeatBean.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.esper.bean
;
import
java.util.Date
;
/**
*
*/
public
class
HeatBean
{
protected
float
celciusTemperature
;
protected
Date
timestamp
;
public
float
getCelciusTemperature
()
{
return
celciusTemperature
;
}
public
void
setCelciusTemperature
(
float
celciusTemperature
)
{
this
.
celciusTemperature
=
celciusTemperature
;
}
public
Date
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
Date
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
}
demo/fire-emergency/fire-detector-cep/src/main/java/org/ow2/frascati/simulator/EventSimulator.java
0 → 100644
View file @
8bb0ff04
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: frascati@ow2.org
*
* Author: Gwénaël Cattez
*
* Contributor(s):
*
*/
package
org.ow2.frascati.simulator
;
import
java.awt.BorderLayout
;
import
java.awt.Color
;
import
java.awt.Container
;
import
java.awt.Dimension
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.util.Calendar
;
import
java.util.GregorianCalendar
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
javax.swing.BorderFactory
;
import
javax.swing.BoxLayout
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JPanel
;
import
javax.swing.JSlider
;
import
javax.swing.JTextField
;
import
javax.swing.WindowConstants
;
import
javax.swing.border.TitledBorder
;
import
org.osoa.sca.annotations.EagerInit
;
import
org.osoa.sca.annotations.Reference
;
import
org.osoa.sca.annotations.Scope
;
import
org.ow2.frascati.esper.api.EsperEngine
;
import
org.ow2.frascati.esper.bean.COBean
;
import
org.ow2.frascati.esper.bean.HeatBean
;
/**
*
*/
@EagerInit
@Scope
(
"COMPOSITE"
)
public
class
EventSimulator
extends
JFrame
implements
EventSimulatorItf
{
private
static
final
long
serialVersionUID
=
-
2978491459900654150L
;
private
static
final
long
EVENT_DELAY
=
3000
;
private
static
final
int
MIN_CO_VALUE
=
0
;
private
static
final
int
MAX_CO_VALUE
=
20
;
private
static
final
int
DEFAULT_CO_FLOOR
=
10
;
private
static
final
int
DEFAULT_COMBINE_CO_FLOOR
=
5
;
private
static
final
int
MIN_TEMPERATURE_VALUE
=
15
;
private
static
final
int
MAX_TEMPERATURE_VALUE
=
80
;
private
static
final
int
DEFAULT_TEMPERATURE_FLOOR
=
50
;
private
static
final
int
DEFAULT_COMBINE_TEMPERATURE_FLOOR
=
40
;
private
int
currentCOValue
;
private
int
currentTemperatureValue
;
@Reference
private
EsperEngine
engineLocal
;
public
EventSimulator
()
{
initComponent
();
this
.
currentCOValue
=
MIN_CO_VALUE