CS5233 Components – Models and Engineering (Komponententechnologien) Master of Science (Informatik)
Total Page:16
File Type:pdf, Size:1020Kb
Prof. Dr. Th. Letschert CS5233 Components – Models and Engineering (Komponententechnologien) Master of Science (Informatik) OSGI - Introduction Seite 1 OSGI – what, why and who What OSGi stands for once: OSGi : Open Service Gateway Initiative now: OSGi is a name for a Dynamic Module System for Java Slides on OSGi are based on – OSGi Alliance: OSGi Service Platform Core Specification OSGi 2009 – J. McAffer, P. Vanderlei, S. Archer: OSGi and Equinox, Addison-Wesley 2010 – Wütherich/Hartmann/Kolb/Lübken, Die OSGI Service Platform – Dpunkt Verlag, 2008 Seite 2 OSGI – what, why and who What OSGi is: OSGi is about building systems from components OSGi - Components work together in a system can be managed (installed / removed) … at runtime Seite 3 OSGI – what, why and who What OSGi is: OSGi is a component framework for Java OSGi-components are called bundles are units of resources can be installed have managed mutual dependencies are independent units can export services and run processes run in an OSGi-container Seite 4 OSGI – what, why and who http://www.osgi.org What OSGi is: OSGi is a (a set of) specification(s) Alcatel-Lucent Aplix Corporation by the OSGi-Alliance (founded 1999) Deutsche Telekom Ericsson Mobile Platforms AB with wide adoption outside the alliance Hitachi, Ltd. IBM Corporation developed in expert groups LinkedIn Makewave Core platform (CPEG) Mitsubishi Electric Corporation (VEG) OSGi in vehicles NEC Corporation Vehicle NTT Mobile (MEG) OSGi in mobile devices Oracle Corporation Paremus, Ltd. Enterprise (EEG) OSGi in enterprise solutions Progress Software ProSyst Software GmbH Residential (REG) OSGi in home automation Qualcomm Red Hat structured into 2 documents SAP AG Siemens AG Core Specification : framework Siemens Enterprise Communications Service Compendium : standard services Software AG Sonatype Inc. actual version 4.1 SpringSource (a Division of VMware) Sun Microsystems, Inc. Telcordia Technologies, Inc. TIBCO Software Inc. Westell Inc. Seite 5 OSGI – what, why and who Where OSGi came from Requirement for a component model for devices Installable Software services Software deployment and management Security Originally aimed at home automation Set top boxes, DSL-Modems, ··· building equipment and appliances Used in several areas for years automotive mobile devices Adopted by Eclipse for Eclipse 3.0 OSGi Scenario: Refrigerator that runs Currently widespread use software form different vendors. Each of them may independently install new version of software modules. Seite 6 OSGI – what, why and who OSGi and Java OSGi has a focus on Java Bundles usually contain class-files Bundles may contain JNI code e.g. SWT-bundles in Eclipse Communication with non-Java devises is possible Script language support may be provided Java execution environment Requirements on a JVM to support OSGi framworks fulfilled by several JVMs (SE und ME) related JSRs: JSR 232: Mobile operational Management JSR 291: Dynamic component support for Java SE Seite 7 OSGI – what, why and who OSGi and Eclipse Eclipse is a main adopter of OSGi Eclipse and OSGi in 2003 OSGi: a consortium of vendors in the area of embedded systems with the aim to provide a platform for inter-vendor compatible components called bundles. Eclipse: a consortium of vendors in the area of software tools with the aim to provide a platform for inter-vendor compatible components called plugins. 2003: Eclipse Project Equinox initiated Aim: Resolve problems of Eclipse's runtime behavior Leverage of (then) current work on management and provisioning Available technologies considered JMX Java Management Extensions Avalon Component framework : Apache project, 1999 – 2004, still active follower projects eg. Excalibur . OSGi Decision to use OSGi A number of changes and extension of the OSGi specification where developed Based on IBMs OSGi-Impl. SMF (Service Management Framework), Equinox runtime was developed and replaced Eclipse runtime Seite 8 OSGI – what, why and who OSGi and Eclipse Eclipse and OSGi together changed the (software) world Eclipse ~> OSGi OSGi: from niche to mainstream: a mature good technology became the marketing it deserved OSGi got a complete new market: all mayor Java application server are (or are in the process of being) ported to OSGi OSGi ~> Eclipse gain of a mature component model Eclipse/Equinox adoption outside Eclipse (embedded systems) OSGi + Eclipse Proof for everyone: Working runtime component systems can exist OSGi is not the first component system but it is the first with wide range of followers OSGi's original target market - “home gateways” - never where of any relevance but the strict constraints of them forced the development of a technology of widespread usage Seite 9 OSGI – what, why and who OSGi Survey Service platform: Container, Bundles, Services OSGi Service Platform: Component technology consisting of Bundle ~ Component Set of classes and resources that have defined interfaces (provided / used services) may be installed (deployed) / de-installed at runtime Service ~ Component interface Services are provided by bundles that register them with the container Services are used by bundles that request them from the container Some Services are standard-services provided by the container Container ~ OSGi Framework Runtime environment for bundles Life-cycle management of bundles Service-management Provider of standard services Seite 10 OSGI – what, why and who OSGi Survey OSGi application A set of bundles each bundle may contribute in any way: provide libraries, start threads, open sockets, open DBs, ···· no “main”-bundle: all bundles are peers no hierarchy: no bundle within a bundle Bundle B Bundle A Bundle D Bundle C OSGi-Application Seite 11 OSGI – what, why and who OSGi Survey OSGi application vs Java application OSGi-Application: A set of bundles with mutual dependencies declared and resolved through defined interfaces Java application: Dependencies are between (more granule) classes. They are declared using class-names and resolved using names, the position of a package / jar within the classpath, the loader that was used to load the using class, the loader that was used to load the used class, ··· Jar Bundle B package Bundle A class Bundle D Bundle C OSGi-Application Java-Application Seite 12 OSGI – what, why and who OSGi Survey Logical Layers according to the OSGi Specification Module Layer Defines bundles: the basic components Life-cycle Management Layer Life-cycle of bundles: states, actions, state transitions Service Layer Service definition, how to provide or use services Security Layer Security related definitions OSGi Framework Services S e Service Layer c u Lifecycle Mngmt r t Module Layer y Execution Environment Seite 13 OSGI – what, why and who OSGi adoption OSGi is a technology for enterprise servers Enterprise servers based on OSGi ➢ IBM WebSphere Application Server ➢ Sun Glassfish V3 ➢ Oracle WebLogic Server ➢ Redhat JBoss ➢ SAP Netweaver Application Server (announced) ➢ ··· Seite 14 OSGI – what, why and who OSGi adoption OSGi is a technology for automotive electronics ➢ BMW ➢ Bombardier ➢ Siemens VDO ➢ Volvo ➢ Windriver ➢ ··· Seite 15 OSGI – what, why and who What do you need: an OSGi container (open source examples): http://eclipse.org/equinox/ ➢ Equinox OSGi-container implementation developed and used by Eclipse http://felix.apache.org/ ➢ Apache Felix OSGi-container implementation http://www.knopflerfish.org/ by the Apache Foundation ➢ Knopflerfish OSGi-container implementation developed by Makewave ➢ ... Seite 16 OSGI – what, why and who OSGi with Equinox / The console see Equinox QuickStart Guide http://eclipse.org/equinox/documents/quickstart.php Equinox is part of Eclipse and can be activated without further downloads – Start the Equinox osgi-console: java -jar /path/to/eclipse/plugins/org.eclipse.osgi_3.5.2.jar -console osgi> – This starts the equinox implementation of the OSGi container and opens a console – The console may also be used with eclipse itself: /path/to/eclipse/eclipse -console Seite 17 OSGI – what, why and who OSGi with Equinox / The console Commands (Examples) – help List all available commands. – ss List of all bundles together with their state and id. – ss <string> List all bundles with names containing that string. – start <id> Start up the bundle with a given id. – stop <id> Stop the bundle with the given id. – install <url> Install the bundle that the URL refers to. – uninstall <id> Uninstall the bundle with the given id. – diag <id> Show resolution problems for bundle with given id. – exit Exit For more information use the help command Seite 18 Th Letschert OSGI – what, why and who OSGi with Equinox / The console Usage Example: install http-server as eclipse bundles > java -jar org.eclipse.osgi_3.5.2.jar -console osgi> install file:/path/to/eclipse/plugins/org.eclipse.osgi.services_3.2.0.v20090520-1800.jar Bundle id is 1 osgi> install file:/path/to/eclipse/plugins/org.eclipse.equinox.ds_1.1.1.R35x_v20090806.jar Bundle id is 2 osgi> install file:/path/to/eclipse/plugins/javax.servlet_2.5.0.v200806031605.jar Bundle id is 3 osgi> install file:/path/to/eclipse/plugins/org.eclipse.equinox.util_1.0.100.v20090520-1800.jar Bundle id is 4 osgi> install \ file:/path/to/eclipse/plugins/org.eclipse.equinox.http.servlet_1.0.200.v20090520-1800.jar Bundle id is 5 osgi> install file:/path/to/eclipse/plugins/org.mortbay.jetty.util_6.1.15.v200905182336.jar Bundle id is 6 osgi> install file:/path/to/eclipse/plugins/org.mortbay.jetty.server_6.1.15.v200905151201.jar Bundle id is 7 osgi> setprop