Upload
jz
View
216
Download
0
Embed Size (px)
Citation preview
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
1/46
Modele komponentoweSCA, OSGi, Distributed OSGi i
OSGi Enterprise
aJava EE
Jacek Laskowskihttp://www.JacekLaskowski.pl
Wersja z 26 marzec 2010 o 15:50:32
http://www.jaceklaskowski.pl/http://www.jaceklaskowski.pl/7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
2/46
Ja...cek Laskowski
Pasjonat Korporacyjnej Javy (Java EE) i okolic Zaoyciel i liderWarszawa Java User Group Czonek grup rozwojowych Apache OpenEJB,
Apache Geronimo i in. BlogerNotatnika Projektanta Java EE
http://www.JacekLaskowski.pl Subowo: Specjalista od oprogramowania
IBM WebSphere (BPM) w IBM Polska
http://www.jaceklaskowski.pl/http://www.jaceklaskowski.pl/7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
3/46
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
4/46
Pawe Stawicki napisa...
Ja bym chtnie zobaczy, jak si to wszystko
"skada do kupy". Sporo tu elementw, o ktrychmam co najwyej blade pojcie i ciekaw jestem,
jak je wszystkie razem skonfigurowa, poczy izbudowa aplikacj.
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
5/46
Zacznijmy od pocztku.Krciutko
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
6/46
Interfejs to zbir metod
z okrelonym sposobem ich wykonania(transport)
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
7/46
Usuga to funkcjonalnodostpna za pomoc jednoznacznie
zdefiniowanego interfejsu(w tym i transportu)
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
8/46
Komponent to modu systemuudostpniajcy usugi
bez odkrywania szczegwich implementacjijednostka funkcjonalna/usugowa
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
9/46
Model komponentowy to zbir zasadokrelajcych
ramy poprawnego funkcjonowaniakomponentw
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
10/46
CORBACommon Object Request Broker Architecture
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
11/46
Rnice midzy...model komponentowy to model aplikacyjny?
A co ze szkielet (framework) i rusztowanie(scaffolding)
?
Nomenklatura i semantyka
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
12/46
A wszystko zaczo si od...?
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
13/46
package pl.jaceklaskowski.greeter;
publicinterface Greeter { public String sayHelloTo(String who);}
package pl.jaceklaskowski.greeter.impl;publicclass PolishGreeter implements Greeter { @Override
public String sayHelloTo(String who) { return"Witaj " + who;
}
}
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
14/46
Brawa dla czowieka-kompilatora!
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
15/46
JavaBeans aka POJO
JavaBeans technology is the componentarchitecture for the Java 2 Platform, Standard
Edition (J2SE). JavaBeans components (beans)are reusable software programs that you candevelop and assemble easily to create
sophisticated applications.
Za http://java.sun.com/javase/technologies/desktop/javabeans/index.jsp
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
16/46
Pniej, znaczne skomplikowanie z...
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
17/46
POJO + META-INF/ejb-jar.xml
...
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
18/46
Enterprise JavaBeans (EJB)
Enterprise JavaBeans (EJB) technology is theserver-side component architecture for Java
Platform, Enterprise Edition (Java EE). EJB
technology enables rapid and simplifieddevelopment of distributed, transactional, secure
and portable applications based on Javatechnology.
Za http://java.sun.com/products/ejb/
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
19/46
Aby pniej uproci?
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
20/46
POJO + META-INF/beans.xml
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
21/46
Spring Framework
Springisa layered Java/J2EEapplication platform.
Spring includes: The most complete lightweightcontainer, providing centralized, automated
configuration and wiring of your applicationobjects. The container is non-invasive, capable of
assembling a complex system from a set ofloosely-coupled components (POJOs) in a
consistent and transparent fashion.
Za http://www.springsource.org/about
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
22/46
Ale nie tylko!POJO + adnotacje rulez :-)
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
23/46
Java Enterprise Edition (Java EE)
Java Platform, Enterprise Edition (Java EE) isthe industry standard forenterprise Java
computing.
The Java Platform, Enterprise Edition (JavaEE) reduces the cost and complexity of
developingmultitier, enterprise services.
Za http://java.sun.com/javaee/ orazJava Platform, Enterprise Edition (Java EE) Specification, v6
http://java.sun.com/javaee/http://java.sun.com/javaee/7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
24/46
A w tle tli si coraz janiej...
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
25/46
Manifest-Version: 1.0Bundle-ManifestVersion: 2Bundle-Name: Greeter ServiceBundle-SymbolicName: pl.jaceklaskowski.greeter.Greeter
Bundle-Version: 1.0.0Export-Package: pl.jaceklaskowski.greeter
POJO + META-INF/MANIFEST.MF
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
26/46
OSGi
OSGitechnology is the dynamic module systemfor Java. The OSGi Service Platform provides
functionality to Java that makes Java the premierenvironment for software integration and thus for
development.
Za http://www.osgi.org/About/Technology
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
27/46
OSGi warstwami
Za OSGi Service Platform Release 4 Version 4.2 Core Specification
registerService(String,Object,Dictionary)
registerService(String
[],Object,Dictionary)
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
28/46
Majc podstawyw postaci Java EE, Spring i OSGi
zaczyna si prawdziwa,deklaratywna zabawa...
META-INF/spring/simpleservice.xml
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
29/46
META-INF/spring/simpleservice-osgi.xml
http://www.springframework.org/schema/beanshttp://www.w3.org/2001/XMLSchema-instancehttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/beanshttp://www.w3.org/2001/XMLSchema-instancehttp://www.springframework.org/schema/osgihttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/osgihttp://www.springframework.org/schema/osgi/spring-osgi.xsdhttp://www.springframework.org/schema/osgi/spring-osgi.xsdhttp://www.springframework.org/schema/osgihttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/osgihttp://www.w3.org/2001/XMLSchema-instancehttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.w3.org/2001/XMLSchema-instancehttp://www.springframework.org/schema/beans7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
30/46
Spring Dynamic Modules for OSGi(tm) ServicePlatforms
=Spring Framework + OSGi
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
31/46
OSGI-INF/blueprint/blueprint.xml
http://www.osgi.org/xmlns/blueprint/v1.0.0http://www.osgi.org/xmlns/blueprint/v1.0.07/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
32/46
OSGi Blueprint Container
Blueprint Containerspecification defines adependency injection framework, specificallyforOSGi bundles, that understands the unique
dynamic nature of services.
This Blueprint Container specification is derivedfrom the Spring Dynamic Modules project.
Za 121. Blueprint Container Specification w OSGi Service PlatformRelease 4 Version 4.2 Enterprise Specification
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
33/46
Wychodzimy poza ramy pojedynczej JVM...
Gotowi?
bli l A ti t i l t B dl A ti t {
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
34/46
public class Activator implements BundleActivator {
private ServiceRegistration registration;
public void start(BundleContext bc) throws Exception {
Dictionary props = new Hashtable();
props.put("service.exported.interfaces", "*");props.put("service.exported.configs",
"org.apache.cxf.ws");props.put("org.apache.cxf.ws.address",
"http://localhost:9090/greeter");
registration =bc.registerService(GreeterService.class.getName(),
new GreeterServiceImpl(), props);
}
public void stop(BundleContext bc) throws Exception {registration.unregister();
}}
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
35/46
Distributed OSGito potoczna nazwa dla
Remote Services (OSGi Compendium spec)
orazRemote Service Admin Service (OSGi
Enterprise spec)
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
36/46
Enterprise OSGito zbir specyfikacji w
OSGi Service Platform Release 4 Version 4.2
Enterprise SpecificationdlaBlueprint Container, Remote Service Admin
Service, JTA, JMX, JDBC, JNDI, JPA, Web i SCA
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
37/46
Kto wspomnia o SCA?! W kocu!
Service Component Architecture
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
38/46
Service Component Architecture(SCA)
Service Component Architecture (SCA) is a setof specifications which describe a modelfor
building applications and systems using a
Service-Oriented Architecture. SCA extends andcomplements prior approaches to implementing
services, and SCA builds on open standards suchas Web services.
Za http://www.osoa.org/display/Main/Service+Component+Architecture+Home
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
39/46
POJO + META-INF/*.composite
SCA OSGi S i i J EE
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
40/46
SCA, OSGi, Spring i Java EE
W OSGi Enterprise SCA Configuration TypeSpecification
W SCA implementation.*:
*.jee, *.web i *.ejb dla artefaktw Java EE *.osgi, *.java i *.spring dla OSGi, Java i Spring
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
41/46
Wicej kodu zamiast gadania?!
Musz Was rozczarowa, wicej nie bdzie,bo nie ma by!
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
42/46
Podsumow(yw)anie
P i d kl t
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
43/46
Programowanie deklaratywne
POJO Adnotacje Pliki konfiguracyjne (czsto opcjonalne)
META-INF/beans.xml,WEB-INF/applicationContext.xml Spring
META-INF/MANIFEST.MF OSGi
META-INF/*.composite SCA META-INF/ejb-jar.xml EJB (Java EE)
d i k h i i
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
44/46
rodowiska uruchomieniowe
OSGi Apache Felix, Eclipse Equinox Distributed OSGi (d-OSGi) Apache CXF,
Eclipse ECF
Enterprise OSGi (ent-OSGi) Apache Aries,Eclipse Virgo (Spring-DM) SCA Apache Tuscany, Eclipse SCA Tools
D l l kt
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
45/46
Dalsza lektura
OSGi Service Platform Release 4 Version 4.2Core Specificationhttp://www.osgi.org/Download/File?url=/download/r4v42/r4.core.pdf
OSGi Service Platform Release 4 Version 4.2
Compendium Specificationhttp://www.osgi.org/Download/File?url=/download/r4v42/r4.cmpn.pdf OSGi Service Platform Release 4 Version 4.2
Enterprise Specificationhttp://www.osgi.org/Download/File?url=/download/r4v42/r4.enterprise.pdf
Service Component Architecture Specificationshttp://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
7/28/2019 JacekLaskowski 4Developers Modele SCA OSGi a JavaEE 26.03.2010
46/46
Modele komponentoweSCA, OSGi, Distributed OSGi iOSGi Enterprise
aJava EE
Jacek Laskowskihttp://www.JacekLaskowski.pl