Eclipse Runtime (OSGi) als Plattform eines Swing Rich Client Andreas Mösching Senior IT Architekt Hewlett-Packard (Schweiz) GmbH HP Banking Service Center Bern andreas.moesching@rtc.ch
Zu meiner Person Verantwortlich für den Bau von Softwarekomponenten (FWs), für die Aus- und Weiterentwicklung von IBIS Architektur und Design-Beratung Verantwortlich für die Migration des IBIS3GDesktops auf die Eclipse Runtime (OSGi)
IBIS3G Bankenplattform Die Bankenplattform IBIS3G deckt alle wichtigen Geschäftsfelder von Kantonal- und Universalbanken ab: Vom Kundenberater am Schalter bis hin zum Management.
IBIS3G Desktop
Herausforderungen Hoher Speicherbedarf Sehr grosser Klassenpfad Keine Kontrolle der Abhängigkeiten Nebeneffekte bei Änderungen in den Frameworks Instabil
Modularisierung in JAVA Module in Java Methoden Klassen Packages JAR s EAR s JSR 291: Dynamic Component Support for Java Establish a JCP specification for a dynamic component framework supporting existing Java SE environments based on the OSGi dynamic component model specifications.
OSGi Framework Besteht aus 4 Schichten Execution Environment Module Life-cycle Service
OSGi Framework Ein Bundle repräsentiert ein Modul/Komponente Ein Bundle ist ein JAR mit Manifest-File Das Manifest-File eines Bundles enthält: Beschreibung des Bundles Version Exported Packages (Public API) Required-Bundles (Abhängigkeiten) Activator (für die Kontrolle des Lifecycles) Programm Code (*.class Files)
OSGi Framework
OSGi Framework Bundle Life Cycle Installed: lesen des Manifests, registrieren der Extensions Resolved: alle Abhängigkeiten alle vorhanden Starting: eager/lazy activation Active
OSGi Framework Jedes Bundle hat einen Single Class Loader Der Bundle Class Space enthält folgende Classes: The parent class loader (normalerweise java.* packages aus dem boot classpath) All Required bundles The bundle's class path (public and private packages) Innerhalb des Bundle Class Space sollte ein Package nur genau einmal vorkommen
OSGi Framework A public private D public private B public private C public private
IBIS3G Desktop Modularisierung Sämtliche JAR s müssen als Bundle definiert werden Verwendete open Source SW muss auch als Bundle vorliegen www.eclipse.org/orbit ist ein Repository von bundled versions of third party libraries Wir unterscheiden zwei Arten von Bundles Source Bundles Plug-In Projekt basierend auf Source Code Binary Bundles Plugin-In als Wrapper eines JARs Bundling by Wrapping
IBIS3G Desktop Modularisierung (Layers) IBISDesktop basiert auf einer Schichten Architektur Jede Schicht ist in einem Feature definiert Runtime Feature SDK Feature Der automatische PDE-Build bildet basierend auf Features Täglich Builds (Nightly) Release Builds
IBIS3G Desktop Modularisierung (Layers) Product Integration Layers (Applications) konto_gui wvko_gui... JFW JMW / Infra Rosi Runtime (Eclipse)
IBIS3G Desktop Modularisierung (JARs) wvko_gui JFW wvko_gui public ch.rtc.jfw.desktop public desktop.xml xy.class
IBIS3G Desktop Modularisierung (Bundles) wvko_gui public wvko_gui JFW private ch.rtc.jfw.desktop public private
IBIS3G Desktop Modularisierung (Bundles) wvko_gui public Extension private Extension Point Registry Extension Point ch.rtc.jfw.desktop public private
IBIS3G Desktop Applikationsentwicklung... PDE JDT Host Platform Team Workspace Source Bundle 3 Source Bundle 2 Source Bundle 1 Eclipse Runtime / Resources OSGi (Equinox) compiles against Target Platform... Binary Bundle C Binary Bundle B Binary Bundle A OSGi (Equinox)
IBIS3G Desktop Applikationsentwicklung Host Platform Product Integration... PDE JDT Team Workspace Source Bundle 3 Source Bundle 2 Source Bundle 1 Eclipse Runtime / Resources OSGi (Equinox) compiles against Layers (Applications) konto_gui wvko_gui... JFW JMW / Infra Rosi Runtime (Eclipse)
IBIS3G Desktop Applikationsentwicklung Plattform Abstraction Layer (PAL) Kapselung der Eclipse-Runtime, OSGi Services Mittels PAL ist es möglich den Desktop herkömmlich (JVM) oder mit der Eclipse- Runtime zu starten Während der Migration war es nötig, mit beiden Modi fahren zu können Beinhaltet Helper für den Zugriff auf Eclipse oder Equinox Dienste
IBIS3G Desktop Applikationsentwicklung Starten des IBISDesktops Headless RCP Application public class Application implements IApplication { public Object start(iapplicationcontext context) throws Exception { args = context.getarguments(). get(iapplicationcontext.application_args); BaDsk_IBISDesktop.main(args);...... return IApplication.EXIT_OK; }
IBIS3G Desktop Produkt Erstellt wir ein komplettes vollständiges Produkt
Hürden bei der Modularisierung Java Reflection Zirkuläre Abhängigkeiten Doppelte Klassennamen Protected Zugriffe über mehrere JARs hinweg Unbekannte Abhängigkeiten Namenskonvention, Package Namen
Fortschritte durch die strenge Modularisierung Abhängigkeiten sind klar Die Entwickler sehen die Abhängigkeiten direkt Optimale Werkzeugunterstützung IBIS Desktop startet schneller Basis für ein umfangreiches Refactoring der FW gelegt Migration der Applikationen auf neue FW (API) kann schrittweise erfolgen Erstellen und Verteilen der Runtime bedeutend einfacher