12
WildCAT A Generic Framework for Context-Aware Applications http:// wildcat.ow2.org

WildCAT A Generic Framework for Context-Aware Applications

Embed Size (px)

Citation preview

Page 1: WildCAT A Generic Framework for Context-Aware Applications

WildCATA Generic Framework for

Context-Aware Applications

http://wildcat.ow2.org

Page 2: WildCAT A Generic Framework for Context-Aware Applications

WildCAT in a nutshell• Generic framework for context-aware applications

– Sensor-based monitoring (generic POJOs)– Data aggregation

• Hierarchical data representation– Tree-oriented (Unix file system analogy)– Dynamically updated (at runtime)

• Data inspection– Synchronous (pull)– Asynchronous (push) –> event-based notification

• Distribution support (RMI and/or JMS)• Esper backend: open source Complex Event Processing (CEP) engine

– SQL-like query language for event processing– Event pattern matching, sliding window, etc.

2http://wildcat.ow2.org

Page 3: WildCAT A Generic Framework for Context-Aware Applications

• WildCAT context: 2 types of nodes– Resources (basic or symbolic links)– Attributes (hold values)

• Addressing resources– Path: "self://resources/computers/PC1#IP"– Symbolic link: "self://resources/bwp#Status " = "self://resources/printers/BWPrinter#Status"

• Composite attributes– + * / % || && – Query attributes

Modeling Data

3http://wildcat.ow2.org

Page 4: WildCAT A Generic Framework for Context-Aware Applications

Inspecting Data (Pull mode)• Generic API for data inspection

– Context API: the only entry point – CRUD operations on resources/attributes

• Context creationContext ctx = ContextFactory.getDefaultFactory().createContext();

• Getting & Setting attributes ctx.createAttribute("self://constants#hello", "Hello");

System.out.println("self://constants#hello = " + ctx.getValue("self://constants#hello"));

• Listing hierarchy content System.out.println("self:// :: "+ ctx.list("self://"));

• Symbolic links ctx.createSymbolicLink("self://demo/soft/link/toConstant", "self://constants");

4http://wildcat.ow2.org

Page 5: WildCAT A Generic Framework for Context-Aware Applications

Inspecting Data (Push mode)• Event-based notification: 2 types of events

– WHierarchyEvent : triggered by resources (hierarchy modifications)– WAttributeEvent : triggered by attributes (value changes)

• Action-based event handling:– WAction : action to be performed when an event is triggered– Event/Action programming model

5http://wildcat.ow2.org

public class MyAction extends WAction { //constructor public void onEvent() { System.err.println("My action performed"); }}

String query = "select * from WEvent";

WAction action = new MyAction("myAction","simple action to perform");

ctx.registerActions(query, action);

Define your action Register it to the event1 2

Page 6: WildCAT A Generic Framework for Context-Aware Applications

Inspecting Data (Push mode)• Event Query Language (EQL)

– Esper backend: open source Complex Event Processing (CEP) engine– SQL-like query language (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY)– Sliding windows– Pattern matching

• ExampleSELECT avg(value.load)? FROM WAttributeEvent(source="self://proc/cpu#info").win:length(5sec)

• Query Attributes – Holds a query result– Dynamically updated (at runtime)

6http://wildcat.ow2.org

Page 7: WildCAT A Generic Framework for Context-Aware Applications

EQL samples• Select 'second' from the resource-attribute 'self://date#time'

select value('second')? from WAttributeEvent(source = 'self://date#time')

• Select all 'A' events with the 'second' value < 30 select * from pattern[every A=WAttributeEvent(source = 'self://date#time', value('second')? < 30)]

• Select the max value of 'second' in a time window of 5 seconds select max(value('second')?) from WAttributeEvent(source = 'self://date#time').win:time(5)

• Select all clients with balance < 0 and then followed by balance < -500 after 5 seconds select * from pattern[every A=WAttributeEvent(source = 'self://bank/account/*', value('balance')? < 0 ) -> every B=WAttributeEvent(source = 'self://bank/account/*', value('balance')? < -500 )].win:length(5) where A.value('owner')?=B.value('owner')?

7http://wildcat.ow2.org

Page 8: WildCAT A Generic Framework for Context-Aware Applications

Distribution support

• Distributed contexts– Connected using symbolic links– Inter-context communication

• Communication modes– RMI , JMS, RMI+JMS– Registry, Dispatchers

8http://wildcat.ow2.org

Page 9: WildCAT A Generic Framework for Context-Aware Applications

WildCAT Sensors• Built-in Sensors

– Java world: Runtime, Date/Time, System properties, JMX, etc. – Linux only: Kernel version, CPU properties, Memory/CPU load, etc.

• User defined Sensors– POJOAttribute: class to extend to define a new wildcat sensor– getValue/setValue: methods to override for new sensor behavior

9http://wildcat.ow2.org

public class MySensor extends POJOAttribute { //state & constructor @Override public void setValue(Object value) {//method body}

@Override public Object getValue(){//method body}}

MySensor sensor = new MySensor();

ctx.attachAttribute(“self://resource#attribute”, sensor);

Define your sensor Attach it to an attribute1 2

Page 10: WildCAT A Generic Framework for Context-Aware Applications

WildCAT: The big picture

10http://wildcat.ow2.org

WSensor1

SELECT * FROM WEvent(source=‘self://r/#a2’)

WHEN event2 THEN action2

WSensor2 WSensor3

event3event2event1

event2

P

ush

(reg

iste

r li

sten

er)

Pu

ll(g

etV

alu

e)

CPU

Memory SunSpotCamera

Bandwith

Action2

WildCAT +

Esper

Application context

ApplicationApplication

Page 11: WildCAT A Generic Framework for Context-Aware Applications

WildCAT in action • ADT Galaxy project (http://galaxy.inria.fr), 2008-2010

• An open SOA platform– QoS monitoring for SOA/SCA application– BPEL execution monitoring for business processes

• OW2 JASMINe project (http://jasmine.ow2.org), since 2006• A smart tool for SOA platform management– JASMINe Monitoring - WildStat module (include WildCAT)

• ANR Selfware project, 2005-2008• A software infrastructure for building self-distributed applications– Smart probes to notify relevant events correlation

11http://wildcat.ow2.org

Page 12: WildCAT A Generic Framework for Context-Aware Applications

WildCAT card • General stats :

– Small footprint : 112 Ko + Esper 2.7 Mo– Small API : 12 interfaces, 50 Classes– Current stable version : 2.3.0– Current Esper version : 3.4.0– License : GPL v2

• Team– Thomas Ledoux (project leader)– Pierre Charles David (V1 initial API and Implementation)– Nicolas Loriant (V2 initial API and Implementation)– Loris Bouzonnet (Contributor)– Mahmoud Ben Hassine (Contributor)– Olivier Barais (Contributor)

• Home page & Contact– http://wildcat.ow2.org– [email protected]

12http://wildcat.ow2.org

Roadmap

V2.0.0 10/12/08

V2.1.1 05/02/09

V2.3.0 04/08/10

V3.0.0 Today (dev)

V1.0.0 18/12/06