26
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Home Security System Java Embedded in Action Łukasz Romaszewski ISV Migration Consultant Oracle November 22, 2014

Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Embed Size (px)

Citation preview

Page 1: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Home Security System Java Embedded in Action

Łukasz Romaszewski ISV Migration Consultant Oracle November 22, 2014

Page 2: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Page 3: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java in the Internet of Things One Language, One Platform, Runs Everywhere

3

Enterprise Data & Applications

Cloud for Embedded

Devices

Meters

Smart Appliances & electronics

Personal Devices

Med-Large Embedded / Multi-function Devices

VoIP Comm

Industrial controls / Network Appliances

Management / Monitoring / Operations

Sensors / Microcontrollers

Connected Vehicles

Page 4: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

The Spectrum of Java Embedded

4

Small Embedded

Medium Embedded

Large Embedded

Platform Footprint

Device CPU/ GPU/I-O

50KB-1MB

1MB-10MB

10MB-100MB

Page 5: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java Embedded in Practice Example Devices

5

• ATMs

• Parking Meters

• POS Systems

• Lottery/Gaming Systems

• Multi Function Printers

• Intelligent Power Module

• Netbooks

• Routers & Switches

• Storage Appliances

• Network Management Systems

• Medical Imaging Systems

• Radar Systems

• Industrial PCs

• Factory Automation Systems

• Geo-Imaging Devices

• Smart Meters

• RFID Readers

• Video Conferencing Systems

• In-Flight Entertainment Systems

• Video Streaming Systems

• Electronic Voting Systems

• Voice Messaging Systems

• Security Systems

Page 6: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java Embedded Suite On-device Java Platform

Page 7: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Introducing Oracle Java Embedded Suite

7

Enterprise Data & Applications

Java Embedded Suite

Embedded

DB

• Includes capabilities to support today’s intelligent devices

• Java Embedded runtime plus full SQL DB and Web Server/Services

Page 8: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Oracle Java Embedded Suite (JES) JES consist of three parts:

•Java SE Embedded •Java Standard Edition for embedded devices

•Java DB •Java SQL Database (Derby)

•Glasfish Embedded •Subset of JEE Web Profile

•Servlet container

•RESTful web services

8

OS & Hardware

Java SE Embedded

Java DB (SQL Database)

Glassfish (Web Server)

Your applications

Page 9: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

JES - Sample Deployment Architecture JES Deployment

•JES acting as a concentrator (hub) of multiple edge devices

•Collects and forwards the data and messages to the backend

•Performs local analytics

•Hosts web services and applications

•Backend system gets aggregated and pre-processed data

10

Page 10: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Oracle Event Processing for Java Embedded On-device event processing

Page 11: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Complex Event Processing (CEP) Complex Event Processing

•Method of tracking and analyzing data combined from multiple streams to infer events or patterns that suggest more complicated circumstances

•Goal is to identify business meaning of events (such as opportunities or threats) and respond to them as quickly as possible.

12

Event Patterns

Event Stream Fine-grained simple events from sensors

and edge devices

Complex Events Machine module non-functional, power outage, device tampering,

etc.

Page 12: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Complex Event Processing (CEP) CEP event patterns

•Filtering: New stream filtered for specific criteria, e.g. temperature > 200 F

•Correlation & Aggregation: Scrolling, time-based window metrics, e.g. average heart pulse rate in the last 3 days

•Pattern Matching: Notification of detected event patterns, e.g. machine events A, B and C occurred within 15 minute window

•Geospatial, Predictive Modeling and beyond

Immediate recognition of geographical movement patterns, apply historical business intelligence models using data mining algorithms

13

Event Patterns

Event Stream Fine-grained simple events from sensors

and edge devices

Complex Events Machine module non-functional, power outage, device tampering,

etc.

Page 13: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Input

Adapter Channel

Input

Adapter Channel

Business

Logic (CQL)

Channel

Channel

Channel

Output

Adapter

Output

Adapter

Oracle Event Processing Application

DB

Input adapters connect to data sources Channels help control the flow of data and can be tuned for optimal performance Databases, Coherence caches, Hadoop (HDFS) and NoSQL database can be referenced directly in CQL processors CQL processors contain filtering, correlation, aggregation and pattern matching business logic Output adapters send data and alerts to downstream systems and business processes

Business

Logic (CQL)

Business

Logic (CQL)

Big Data

Coherence

14

Page 14: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

High-Performance In-Memory Data Processing

Input Adapter

Data

Input Adapter

Data

Channel Business

Logic (CQL)

Channel

Data

Data

Analytics

Channel Business

Logic (CQL)

Enrich Output Adapter

Data Data Data Data

Analytics: Continuously Sliding Windows of Streaming Data, Filtering, Correlations, Calculations, Aggregations, Pattern Matching, Missing Event Detection, Spatial Analysis, etc.

Enrichment: Integrate with data from DB, Coherence, NoSQL, Hadoop etc.

Oracle Event Processing 15

Page 15: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

OEP

Oracle Event Processing: From Noise to Value

Connecting the Internet-of-Things to Your Enterprise

Distributed Intelligence

• Filtering • Correlation • Aggregation • Pattern matching

Devices / Gateways

SOA

Internet of Things SOA / Enterprise

“Sea of data”

Macro-event High-value Actionable In-context

OEP embedded OEP

• High Volume

• Continuous Streaming • Sub-Millisecond Latency • Disparate Sources • Time-Window Processing • Pattern Matching

• High Availability / Scalability • Unique Coherence Integration • Geospatial, Geo-fencing • Big Data & IoT Integration

• Action!

16

Page 16: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Complex Event Processing vs „old school” database

Inverted Database

Data is ‘static’

Queries are ‘dynamic’

• Data (event) is ‘dynamic’

• Queries are ‘static’

Page 17: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

OEP for Java Embedded Components Architecture OEP Architecture

•OEP is a collection of OSGi bundles.

•OEP supports dynamic deployment of OEP applications (also packaged as OSGi bundles).

•Modular architecture simplifies customization of OEP for different environments

•Core OEP programming model is uniform (Java, CQL) across all environments.

18

Modular Architecture based on OSGi

OSGi Module Framework

Module management,

lifecycle & classloading Core service registry

OEP Server Modules (OSGi bundles)

CQL Engine Config &

Admin Logging Adapters . . .

OEP Applications (OSGi bundles)

Application 1 Application 2 . . .

Embedded JRE JavaDB

Java Embedded Suite

OEP Embedded

Page 18: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Continuous Query Language (CQL)

• CQL is based on standard SQL with extensions for streaming data

– CQL queries support filtering, partitioning, aggregation, correlation (joins across streams), and pattern matching on streaming and relational data

– Extends standard SQL by adding notion of Stream, operators for mapping between relations and streams, and extensions for pattern matching

– Window operator (e.g. RANGE 1 MINUTE) transforms stream into a relation

• Example:

SELECT AVG(temperature) AS avgTemp, tempSensorId

FROM temperatureInputStream[RANGE 1 MINUTE]

GROUP BY tempSensorId

19

Page 19: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Demo Using JES + OEP + USB webcamera on Raspberry Pi to create smart home security system

Page 20: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Home Surveillance System Concept

Oracle Confidential – Internal/Restricted/Highly Restricted 22

Secure VPN

Internet

Data Center OEP + BAM + BPM

Push

House owner

Thief

USB web camera

Raspberry Pi + JES + OEP Embedded

Page 21: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Home Surveillance System – Incident Processing

Oracle Confidential – Internal/Restricted/Highly Restricted 23

Data Center OEP + BAM + BPM

House owner

Owner confirms the incident using MAF application

Operator dispatches the incident to a

brigade

System generates a task for an

operator

The nearest brigade takes the

task

Page 22: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

What do we need? Demo Environment:

•Raspberry Pi Model B •Debian Wheezy (armel version) http://bit.ly/1jpsN7s

•Java Embedded Suite http://bit.ly/Rw0e1d

•Oracle Event Processing Embedded http://bit.ly/1kjMenb

•Free Webcam Capture library from SarXos http://bit.ly/1zKleCy

•USB web camera •From any store, starting from 5 Euro

•Deliberately low resolution (it works mainly as a motion detector)

•Any iOS or Android device •Optional push notification service

24

Push

Page 23: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Let’s see how it works...

Page 24: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Q&A

26

Lukasz Romaszewski Oracle ISV Migration Center FMW Consultant [email protected] ISV Migration Center blog: http://blogs.oracle.com/imc

Page 25: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Snapshots from JavaCamp #13

Page 26: Łukasz Romaszewski on Internet of Things Raspberry Pi and Java Embedded JavaCamp #13