“OSGi at the UK’s Biggest Science Lab.” goo.gl/1f5HnD
DLS
Movie 1 Electron Journey DLS
Movie 2 – experiment DLS
MX Robots Movie 3 – Robot Arm DLS
Software Generic Data Acquisition or GDA Java Server -> 3 million lines -> static classpath Thick Java Client (written in RCP) Legacy System - inherited from a previous synchrotron ‘Run from Source’ Culture Software
The Creeping Cost of Support Cost Support of Acquisition >> Proportion of Development << Different APIs that do similar things Overly Interconnected Projects and Classes Improper Encapsulation Poor Unit Tests Development Coordination = Hard Software
The Mapping Project nD scanning Move Sample – Not Machine Scan Path Analysis – Run fast stuff New file format Multiple languages and layers Online Analysis Required Examples VMXi – Automated, versatile and crystal friendly Spectroscopy of 2D samples Software
VMXi – Early Prototype Work 2015/16 Movie 4 - VMXi
Mapping – Early Prototype Movie 5 – Mapping
Software
OSGi OSGi
Real world problem #1: Integration We made a single product! OSGi = Big Footprint, Small Running Memory Run from source hard! Investigated and deployed JRebel OSGi
Real world problem #2: Multiple configurations Single Product : Multiple Configurations Wanted to keep Spring Spring makes objects after OSGi Services OSGi breaks up classloader - Spring No Like Solution? Eclipse Buddy which is an Equinox Feature OSGi
Real world problem #3: Migrating to bundles Modularity! >> No more ‘core’ bundles which glue things Bundles which use things and those which provide things org.eclipse.scanning.server has TWO bundle dependencies Create API bundles with NO dependencies OSGi Services -> implement interfaces Gradual Migration Practical Solution -> Needs Developer Participation OSGi
Real world problem #4: The static, non-modular algorithm GDA8 Scanning System Many ‘static’ parts Non-modular Unable to work with new NeXus API Slow in some cases Not Deprecated in 9 GDA9 / Solstice Scan Service based, Modular Instance !Singletons Annotations !Interfaces NeXus API++ Fast and Scalable Executor Based Less Features Malcolm OSGi
Real world problem #5: Cardinality In OSGi you have the following options for a cardinality of a service: 0..1 (meaning zero or one service instances) 0..n (meaning zero to n) 1..1 (one and if it is not available, things start to fail) 1..n (one or more) 1..1 and static can block errors injecting services in funny ways OSGi
Real world problem #6: Declarative services Do not ignore OSGi messages Some serious Some ignorable!! -Dequinox.ds.print=true 0..1 cardinality for a service not yet available - Not an error !ENTRY org.eclipse.equinox.ds 1 0 2016-11-08 10:25:48.544 !MESSAGE Could not bind a reference of component Scanning Servlet Services. OSGi
Real world problem #7: The hidden cost of TDD Modularity -> Easy and Complete Unit Testing Services easy parts to Mock out Unit Test Examples Scannable Service Runnable Device (Detectors!) Service End to end NeXus scans 1000’s new tests = BUILD PROBLEM Modular Product + Github + Travis CI = Sub-builds, No Waiting OSGi
Software Front-End Mapping Movie 6 – Front End
Conclusions OSGi made Acquisition Server Modular Service Oriented in Architecture Fast Startup Industry Standard Mature, Online Help Great Easy to do Opportunity to increase tests New Features Added! (Scanning + NeXus + UI)