Java ME 8 – Back to Embedded!?

Werbung
Java ME 8 – Back to Embedded!?
Ein Überblick über die Java ME 8 Technologie
Sebastian Greiner
aformatik Training & Consulting GmbH & Co. KG
[email protected]
xing.to/SebastianGreiner
23.06.2016
aformatik.® - Sebastian Greiner
1
Themenüberblick
• Überblick
• Plattformen
• Bestandteile der Java ME 8
• Connected Limited Device Configuration (CLDC) v8
• Generic Connection Framework (GFC) v8
• Java ME Embedded Profile (MEEP) v8
• Aufbau einer Java ME Applikation
• Codebeispiele
• Einschätzung
23.06.2016
aformatik.® - Sebastian Greiner
2
Ressourcen
Das Java Universum
Java ME
23.06.2016
Java SE
aformatik.® - Sebastian Greiner
Java EE
3
Was will die Java ME 8 sein?
Oracle Java ME Embedded is a Java runtime that leverages the core Java ME technologies
deployed in billions of devices around the world in the Internet of Things. The Java ME
specifications are designed to be rich in functionality, portable to a wide range of devices,
flexible, and secure while being very resource-efficient and keeping the demands on the
underlying platform low.
-Oracle- http://www.oracle.com/technetwork/java/embedded/javame/index.html
23.06.2016
aformatik.® - Sebastian Greiner
4
Was will die Java ME 8 sein?
• Runtime für Milliarden von Embedded Systems
• Plattform für das „Internet of Things“
• Für eine Vielzahl von Controllern
• Flexibel
• Sicher
• Ressourcenschonend
• Runtime mit niedrigen Anforderungen
23.06.2016
aformatik.® - Sebastian Greiner
5
Java ME 8 – Key Features
• Angeglichen an die Java SE
• Einheitliche Entwicklung für eine Vielzahl von Controllern
• Unterstützung von verschiedenen Hardwareleistungen
• Zugriff auf Hardware
• Modularität
• Security Modell
23.06.2016
aformatik.® - Sebastian Greiner
6
Unterstützte Controller
Raspberry Pi (ca. 40€)
Intel® Galileo Gen 2 (ca. 70€)
Quelle: Wikipedia – Raspberry Pi
URL:
https://upload.wikimedia.org/wikipedia/commons/thumb
/3/31/Raspberry_Pi_2_Model_B_v1.1_top_new_%28bg_c
ut_out%29.jpg/800px-Raspberry_Pi_2_Model_B_v1.1_top
_new_%28bg_cut_out%29.jpg
Quelle: Intel
URL:
http://www.intel.com/content/dam/www/public/us/en/images
/product/ark-shop/galileo-board-box-man-ark.png
23.06.2016
aformatik.® - Sebastian Greiner
Freescale (ca. 20€)
URL: http://sigma.octopart.com/24896109/image/FreescaleSemiconductor-FRDM-K64F.jpg
7
Java ME 8
Applikation
Weitere APIs
GCF 8
MEEP 8
Security
Device IO
Java VM CLDC 8
OS / Hardware
23.06.2016
aformatik.® - Sebastian Greiner
8
CLDC 8
Connected Limited Device Configuration
• echte Teilmenge der Java SE 8 + weitere Features
• CLDC Full API
• Alle Funktionalitäten der CLDC implementiert
• Für die meisten Embedded Geräte geeignet
• Grundlage für weitere APIs
• CLDC Compact API
• Teilmenge der CLDC Full API
• Für Embedded Geräte mit schwacher HW
23.06.2016
API
Sprache
Java SE 8
Java SE 8
CLDC 8
Full API
CLDC 8
CLDC 8
Compact
API
aformatik.® - Sebastian Greiner
9
CLDC 8 - Einschränkungen
Connected Limited Device Configuration
APIs
teilweise unterstützt
Math API
Security API
Collection API
…
nicht unterstützt
Reflection
Runtime Annotations
Benutzerdefinierte
Classloader
…
23.06.2016
aformatik.® - Sebastian Greiner
Sprache
Lambda Expressions
10
GCF 8
Generic Connection Framework
• Bestandteil der CLDC 8
• Unterstützte Protokolle (Auszug)
•
•
•
•
Files
TCP/IP Sockets
HTTP(S)
Communication Port (COM)
• IP v4/v6
• X509 Zertifikate
• Access Point
23.06.2016
aformatik.® - Sebastian Greiner
11
Device I/O
• Definiert APIs zur Kommunikation mit Hardwarekomponenten
• Plattformunabhängiger Zugriff
• Implementierung hängt von der verfügbaren Hardware ab
• Geplant für die Java SE
• Unterstützt
•
•
•
•
•
•
GPIO
SPI
I²C
AD/DA-Wandler
PWM
…
23.06.2016
aformatik.® - Sebastian Greiner
12
MEEP 8
Java ME Embedded Profile
Java ME Embedded Profile 8
API
23.06.2016
Hardwareprofile
Security
aformatik.® - Sebastian Greiner
Module/
Abhängikeiten
13
API (Auszug)
Java ME Embedded Profile
MEEP 8
Midlet
23.06.2016
Cellular
Events
Power
Media
(Audio)
Line-Oriented
UI
optional
optional
optional
optional
optional
aformatik.® - Sebastian Greiner
14
Profiles
MEEP 8
Full Profile Set
Java ME Embedded Profile
optional
APIs
Profile
RAM
ROM
Minimal
128 KB
512 KB/1 MB
Standard
512 KB
2 MB
Full
2 MB
4 MB
optional
APIs
Verwendung
MEEP 8
Standard Profile Set
Smart Sensors
optional
package
Multifunktionsgeräte
optional
package
optional
package
MEEP 8
Minimal Profile Set
CLDC 8
23.06.2016
aformatik.® - Sebastian Greiner
15
Client Security Domains
Controller
Domain A
• Isolierte Einheit
• Jede App gehört einer Security Domain an
• Security Domain definiert Berechtigungen
App 1
• Vordefinierte Domains:
• Manufacturer
Domain B
• Wird vom Hersteller vordefiniert
• Sollte nicht geändert werden
• Operator
• Untrusted
App 2
App 3
• Alle Applikationen ohne (vertrauenswürdiges) Zertifikat
23.06.2016
aformatik.® - Sebastian Greiner
16
Security (Programmentwicklung)
1. Erstellen
Unternehmen
App.
Zertifikat
Runtime
3. Signieren
4. Installieren
Anwendung
Root Zertifikate de CA
2. Zertifizieren
Certificate Authority
23.06.2016
aformatik.® - Sebastian Greiner
17
Security (Programmausführung)
App.
Zertifikat
6. Verifiziert
5. Verifiziert
7. Security Domain
Root
Zertifikat
23.06.2016
Security Policy
Anwendung
aformatik.® - Sebastian Greiner
18
LIBlet
Modularisierung in Java ME
• Für wiederverwendbare Funktionalitäten
• Abhängigkeiten in der Manifest-Datei
• versionengenau
• optional oder erforderlich
• Eigene Security-Domain
• Services (via ServiceProvider)
24.06.2016
aformatik.® - Sebastian Greiner
19
MEEP 8
Full Profile Set
Kompatibilität
optional
APIs
optional
APIs
• Viele Standard-APIs sind mit Java ME kompatibel
•
•
•
•
XML API (JSR 280)
JSON API
OAuth 2 API
…
MEEP 8
Standard Profile Set
optional
package
optional
package
optional
package
MEEP 8
Minimal Profile Set
CLDC 8
23.06.2016
aformatik.® - Sebastian Greiner
20
Entwicklung
• Plug-In für Eclipse und Netbeans
• Emulator
• Java ME SDK
• Java ME Embedded
23.06.2016
aformatik.® - Sebastian Greiner
21
Aufbau einer Java ME App
• Manifest-Datei
MIDlet-Version: 1.0.0
MIDlet-Vendor: MIDlet Suite Vendor
MIDlet-Jar-URL: TestProjekt.jar
MicroEdition-Configuration: CLDC-1.8
MIDlet-1: TestMidlet,,de.aformatik.TestMidlet
MicroEdition-Profile: MEEP-8.0
MIDlet-Name: TestProjekt MIDlet Suite
23.06.2016
aformatik.® - Sebastian Greiner
22
Aufbau einer Java ME App
• Manifest-Datei
• Midlet
public class TestMidlet extends MIDlet {
public TestMidlet()
{
}
@Override
protected void startApp() throws MIDletStateChangeException
{
}
@Override
protected void destroyApp(boolean unconditional) throws MIDletStateChangeException
{
}
}
23.06.2016
aformatik.® - Sebastian Greiner
23
LifeCycle einer Java ME App
App installieren
Mit Fehler
Ohne Fehler
Paused
Deinstallieren
App starten
void startApp()
Ohne Fehler
Aktive
23.06.2016
Mit Fehler
App beenden
void destroyApp(boolean)
aformatik.® - Sebastian Greiner
Destroyed
24
Demo
23.06.2016
aformatik.® - Sebastian Greiner
25
Kritik
• Geringe Verbreitung
• Literatur nur von Oracle
• Keine Konkurrenz zu C++
(Hardwareanforderung/Vielseitigkeit)
• Keine Echtzeitmöglichkeit
Quelle: Google Trends (Stand Mai 2016)
URL: https://www.google.de/trends/explore#q=Java%20ME%208
• Viele Controller bietet zu wenig Speicher
• Beispiel: Atmel X MEGA 256A3-TQ
• Preis: ca. 12€
• ROM: 264 kB
• RAM: 16 kB
Quelle: Reichelt
URL: https://cdn-reichelt.de/bilder/web/xxl_ws/A300/TQFP-64.png
23.06.2016
aformatik.® - Sebastian Greiner
26
Was ist nun die Java ME 8
• Runtime für Milliarden von Embedded Systems
• Internet of Things
• Für eine Vielzahl von Controllern
• Flexibel
• Sicher
• Ressourcenschonend
• Runtime mit niedrigen Anforderungen
23.06.2016
aformatik.® - Sebastian Greiner
27
Neue Chancen durch die Java ME
• Einheitliche Entwicklung von Server bis Mikrocontroller
• Portierung von Java SE Komponenten auf Java ME
• Niedrige Entwicklungskosten
• Plattformunabhängigkeit
23.06.2016
aformatik.® - Sebastian Greiner
28
Aufgaben von Oracle
• Volle Sprachunterstützung
• Geringere Hardwareanforderungen
• Unterstützung von mehr Controllern
• Verbreitung fördern
• Klärung der Zukunft der Java ME
24.06.2016
aformatik.® - Sebastian Greiner
29
Java ME 8 – Back to Embedded!?
Ein Überblick über die Java ME 8 Technologie
Sebastian Greiner
aformatik Training & Consulting GmbH & Co. KG
[email protected]
xing.to/SebastianGreiner
23.06.2016
aformatik.® - Sebastian Greiner
30
Herunterladen