SlideShare a Scribd company logo
1 of 44
Download to read offline
Building complex and modular RIAs with
                         OSGi and Flex



                 francois.fornaciari@zenika.com




www.zenika.com
Agenda



•    Introduction
•    Flex and OSGi interactions
•    Application modularization
•    Demo
•    Conclusion




    www.zenika.com
What is Flex (1/2)



• Framework for building RIA
  •   Flash technology
  •   Free Software Development Kit (SDK)
  •   Flash Player (VM)
  •   Strong integration with Java
  •   Tooling
       •   Flash Builder : IDE based on Eclipse
       •   IntelliJ IDEA




 www.zenika.com
What is Flex (2/2)



•    MXML: XML-based language
•    ActionScript: ECMAScript-compliant scripting
•    Library of pre-built components
•    Compiler: create SWFs from MXML/ActionScript




    www.zenika.com
MXML



• XML-based language
• Declarative way to build applications
    <s:Application
       xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx">
      <s:Panel>
        <s:Label text="Label" />
        <s:Button label="Button" />
      </s:Panel>
    </s:Application>




 www.zenika.com
ActionScript



• Core of the Flex Framework
• ECMAScript-compliant scripting
• Familiar syntax
        package com.zenika.flex {
          public class MyClass interface MyInterface {
            public function MyClass() {

                    }
                    public function doSomething():String {

                }
            }
        }




 www.zenika.com
What is OSGi (1/3)



• A module system and service platform for the Java
  programming language
• OSGi framework specifications
  • Core Specification
  • Compendium Specification
  • Enterprise Specification




 www.zenika.com
What is OSGi (2/3)



• Service Oriented Architecture

                         Service
                         broker
      Lookup                                     Register
                        Specification


                         Binding
         Consumer                            Provider


 www.zenika.com
What is OSGi (3/3)



• Bundle
  • Deployment unit: JAR + MANIFEST
  • Functional unit (provides services)
• Application
  • Set of bundles
       •   Dynamically deployed
       •   Potentially shared between applications




 www.zenika.com
Purpose



• Presentation of the main design patterns for building
  complex and modular applications with Flex and OSGi
• Two axes
  • Communication between Flex and OSGi
  • Application modularization




 www.zenika.com
General architecture




  Client (browser)                                                 Server (Java)
                       Flex                      HTTPService        OSGi Framework
                                                 WebService
                                                 RemoteObject
                                                 Producer
     SWF Application

                       SWF Module

                                    SWF Module




                                                 Consumer




                                                                     Bundle

                                                                              Bundle

                                                                                       Bundle
www.zenika.com
Handling remote calls



• HTTPService, WebService, Remote Objects,
  Consumer/Producer
  • Asynchronous calls
       •   Result, Fault or Message handlers
  • Arguments and result types
       •   Strongly typed or generic objects
       •   XML format
  • Properties
       •   URL, destination, endpoint, id, …




 www.zenika.com
Service call example



 private function callService():void {
   var service:MyService = new MyService(destination);
   service.addEventListener(ResultEvent.RESULT, onResult);
   service.addEventListener(FaultEvent.FAULT, onFault);
   service.send();
 }

 private function onResult(event:ResultEvent):void {
   var result:MyObject = event.result as MyObject;
   ...
 }

 private function onFault(event:FaultEvent):void {...}




www.zenika.com
Communications (1/2)



• Accessing “non-OSGi services”
  • HTTPService
       •   Supported methods: GET | POST
       •   HEAD | OPTIONS | PUT | TRACE | DELETE only through the
           server-based proxy service
  • WebService
       •   Provides access to SOAP-based web services on remote servers
            •     ex: exposed through D-OSGi




 www.zenika.com
Communications (2/2)



• Accessing “OSGi services”
  • In a transparent way
  • Two communication types
       •   RemoteObject
           •      Simple call to an existing OSGi service
           •      Strongly-typed arguments and result or …
           •      … generic objects
                   • Unsafe access to properties and methods
                   • Introspection API
       •   Producer/Consumer
           •      Topic subscription




 www.zenika.com
AMF Protocol (1/2)



• Action Message Format (v3)
  • Binary format used to serialize ActionScript objects
       •   Optimized transferred data amount
  • Primarily used to exchange data between Adobe Flash
    applications and remote services
  • Specification since 2007
       •   Supported by many server-side languages and technologies:
           Java, .NET, PHP, …




 www.zenika.com
Integration frameworks



• Existing open source frameworks
 Name                    OSGi support      RemoteObject     Producer / Consumer

 AMF3 for OSGi (LGPL)    yes               yes              yes
 GraniteDS (LGPL)        yes (prototype)   yes (unstable)   no
 Spring Flex (ASL)       yes (Virgo)       yes              yes


• AMF3 for OSGi (Christopher Brind)
   • Easy to use
        •   Only 3 bundles to deploy
   • Robust



 www.zenika.com
AMF3 for OSGi



• OSGi bundles description
  • uk.co.arum.osgi.amf3
       •   Serialization-deserialization of AMF3 objects
  • uk.co.arum.osgi.amf3.http
       •   Registers an HTTP servlet that is capable of reading and writing
           AMF3 objects
  • uk.co.arum.osgi.amf3.flex.remoting
       •   Implements FlexRemoting over HTTP
       •   Provides support for channel based messaging




 www.zenika.com
Apache Felix projects (1/2)



• Core of the server-side application
  • Framework
  • File Install
       •   Directory based OSGi management agent
• Used internally by AMF3 for OSGi
  •   Declarative Service (SCR)
  •   Event Admin Service
  •   Log Service
  •   HTTP Service (Jetty)




 www.zenika.com
Apache Felix projects (2/2)



• Application-specific projects
   • Event Admin Service
       •   OSGi EventHandler receives messages from Flex Producers
       •   Messages posted by the OSGi EventAdmin service are received
           by Flex Consumers
   • iPOJO
       •   Used to declare OSGi components
       •   Support of annotations
       •   Extensible handlers




 www.zenika.com
Publishing OSGi services



• Additional service property
     • AMF_SERVICE_NAME
       •   Instantiated with the service class name

 @Component(name="MyService")
 @Provides
 public class MyServiceImpl implements MyService {

     @ServiceProperty(name="AMF_SERVICE_NAME")
     private String serviceName = MyService.class.getName();

     ...
 }




 www.zenika.com
Consuming OSGi services



• Flex RemoteObject
  • Endpoint: AMF3 servlet path
       ex: http://localhost:8080/amf3osgi
  • Destination: OSGi service class name

<s:RemoteObject id="myService"
                endpoint="/amf3osgi"
                destination="com.zenika.service.MyService">
   <mx:method name="doSometing"
              result="onResult(event)"
              fault="onFault(event)" />
</s:RemoteObject>




 www.zenika.com
Type-safe objects



• Method arguments and result




[RemoteClass(alias="com.zenika.systemmanager...SWFModule")]
[Bindable]
public class SWFModule




  www.zenika.com
Producer / Consumer (1/2)



• Bridge between Flex events and EventAdmin service
• Elements attributes
  • Consumer: callback when a message is received
  • Consumer and producer: destination

     <mx:Consumer message="onMessage(event)"
                  destination="events"
                  fault="onFault(event)" />
     <mx:Producer destination="events"
                  fault="onFault(event)" />




 www.zenika.com
Producer / Consumer (2/2)



• Destination configuration
  • Set of channels used to send messages to a target destination
       •   QoS: many channels for network failure tolerance

   var channelSet:ChannelSet = new ChannelSet();
   var channel:AMFChannel =
                new AMFChannel("events","/amf3osgi");
   channel.pollingInterval = 5000;
   channelSet.addChannel(channel);

   consumer.channelSet = channelSet;




 www.zenika.com
Sending messages (1/2)



• From OSGi
  • PublishedObjectEvent (channelID, object)
  • Extends org.osgi.service.event.Event
 @Bind
 public void bindEventAdmin(EventAdmin eventAdmin) {
   this.eventAdmin = eventAdmin;
 }

 private void sendMessage() {
   eventAdmin.postEvent(
     new PublishedObjectEvent("events", object));
 }




 www.zenika.com
Sending messages (2/2)



• From Flex
  • Sending AsyncMessage through the producer
       •   Body: object to send
       var message:AsyncMessage = new AsyncMessage();
       message.body= messageObject;
       producer.send(message);




 www.zenika.com
Receiving message (1/2)


 public class FlexEventHandler implements EventHandler {
   @ServiceProperty(name="event.topics")
   private String eventTopics =
    ".../amf3/flex/remoting/events/PublishedObjectEvent";

     public void handleEvent(Event event) {
       if (event instanceof PublishedObjectEvent) { ...}
     }
 }


All Flex messages
are received by
this handler



 www.zenika.com
Receiving message (2/2)


  • Message: typed-object
  • Start / cancel subscription

private function start():void {
    consumer.subscribe();
}
private function stop():void {
    consumer.unsubscribe();
}
private function onMessage(event:MessageEvent):void {
  var msg:MyMessage = event.message.body as MyMessage;
  ...
}




www.zenika.com
Some key elements



• We have seen how to:
  • Expose OSGi services to Flex
  • Interact with different service types
       •   Remote Objects
       •   Event-based messages
       •   Standard web services
  • Define strongly-typed objects
  • Handle events posted by the backend




 www.zenika.com
Flex modulary



• Flex modules
  • SWF files that can be loaded and unloaded at runtime by an
    application
  • Cannot be run independently
  • Applications can share modules
  • No need to load all modules at startup




 www.zenika.com
Benefits



• Split Flex application into several pieces
   • Smaller initial download size of the SWF
   • Shorter load time
   • Better encapsulation
• Load required modules only
• Unload modules at runtime
   • Free up memory and resources




 www.zenika.com
Main goal



• OSGi is the Java modularity
• Flex supports modules

• How can we build a complete modular application?




 www.zenika.com
Creating modules



• “Module” as root element
   <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      implements="...api.ModuleInterface"
      creationComplete="start()">

     <fx:Script>
       <![CDATA[
         public function start():void {...}
         public function stop():void {...}
       ]]>
     </fx:Script>

     <s:Label text="Label" />
   </mx:Module>



 www.zenika.com
Module lifecycle



• Start method is called when the module is loaded
• Stop method is called before unloading the module
  • Common interface between the application and the module

         package com.zenika.systemmanager.api {
           public interface ModuleInterface {
             function stop():void;
           }
         }




 www.zenika.com
Packaging


                            • Each bundle contains
                              • Business logic
                                 • OSGi services
     Application   Module
       bundle      bundle     • User interface
                                 • SWF file

         JAVA       JAVA    • Build may be done with
        (OSGi)     (OSGi)     Maven

          UI         UI
        (SWF)      (SWF)



www.zenika.com
Application bundle



• User Interface skeleton
• Able to retrieve list of available modules
   • OSGi service for getting module URLs
• Flex client notified when a module appears or
  disappears
   • Flex consumer is aware of events posted by the EventAdmin




 www.zenika.com
Technical view (1/3)



• Registers bundle resources into the HTTP Service
   • Main SWF, HTML files, …
• Listens to bundle arrival / departure
   • Implementation of the extender pattern
       •   Use of a BundeTracker for being notified of bundles declaring
           Flex modules
            •     MANIFEST.MF : SWF-Modules: [path]=[SWF name]
       •   Register/unregister SWFs into declared path
       •   Post event to notify Flex client




 www.zenika.com
Technical view (2/3)


var modules:ArrayCollection = event.result as
ArrayCollection;

for each(var module:SWFModule in modules) {
  var loader:ModuleLoader = new ModuleLoader(module.url);

    // Register event listeners
    loader.addEventListener(ModuleEvent.READY,
                            handleModuleReady);
    loader.addEventListener(ModuleEvent.ERROR,
                            handleModuleError);

    // Start the module loading
    loader.load();
}




www.zenika.com
Technical view (3/3)



• After bundle undeployment
  • Call the stop method
       •   Stop properly on-going processes
       •   Warning: OSGi services have already been unregistered
  • Unload associated modules
       •   Free-up memory and resources




 www.zenika.com
Module bundle



• Autonomous module
  • Contains its own UI and logic
  • Good isolation
  • Flex modules can easily be based upon OSGi services




 www.zenika.com
DĂ©mo

                 DEMO




www.zenika.com
Conclusion (1/2)



• Flex
  • Development of rich interfaces
  • Native support of modules
       •   Loading / unloading modules at runtime
• OSGi
  • The Dynamic Module System for Java
  • Service Oriented Architecture
       •   Service availability to Flex




 www.zenika.com
Conclusion (2/2)



• Seamless communications
  • Asynchronous remote calls
  • Notifications
• Integration
  • Application: set of autonomous bundles with their own
    interface and business logic




 www.zenika.com

More Related Content

What's hot

Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1ukdpe
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCFBarry Dorrans
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineGaruda Trainings
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIKevin Hazzard
 
Web services soap
Web services soapWeb services soap
Web services soapKhan625
 
Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIIMC Institute
 
The History and Status of Web Crypto API (2012)
The History and Status of Web Crypto API (2012)The History and Status of Web Crypto API (2012)
The History and Status of Web Crypto API (2012)Channy Yun
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
Design-Time Properties in Custom Pipeline Components
Design-Time Properties in Custom Pipeline ComponentsDesign-Time Properties in Custom Pipeline Components
Design-Time Properties in Custom Pipeline ComponentsDaniel Toomey
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdlKhan625
 
Polyakov how i will break your enterprise. esb security and more
Polyakov   how i will break your enterprise. esb security and morePolyakov   how i will break your enterprise. esb security and more
Polyakov how i will break your enterprise. esb security and moreDefconRussia
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
Net framework
Net frameworkNet framework
Net frameworkMahfuz1061
 

What's hot (19)

Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
Mike Taulty DevDays 2010 Silverlight 4 - What's New Part 1
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCF
 
Dot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement onlineDot net Online Training | .Net Training and Placement online
Dot net Online Training | .Net Training and Placement online
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
 
Web services soap
Web services soapWeb services soap
Web services soap
 
Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDI
 
WebServices
WebServicesWebServices
WebServices
 
Web services
Web servicesWeb services
Web services
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
The History and Status of Web Crypto API (2012)
The History and Status of Web Crypto API (2012)The History and Status of Web Crypto API (2012)
The History and Status of Web Crypto API (2012)
 
WCF
WCFWCF
WCF
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Design-Time Properties in Custom Pipeline Components
Design-Time Properties in Custom Pipeline ComponentsDesign-Time Properties in Custom Pipeline Components
Design-Time Properties in Custom Pipeline Components
 
Web services wsdl
Web services wsdlWeb services wsdl
Web services wsdl
 
Polyakov how i will break your enterprise. esb security and more
Polyakov   how i will break your enterprise. esb security and morePolyakov   how i will break your enterprise. esb security and more
Polyakov how i will break your enterprise. esb security and more
 
Web Services
Web ServicesWeb Services
Web Services
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
Net framework
Net frameworkNet framework
Net framework
 

Viewers also liked

WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App Factory
WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App FactoryWSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App Factory
WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App FactoryWSO2
 
Pre-Con Education: Building Advanced ITSM Workflows in CA Service Management
Pre-Con Education: Building Advanced ITSM Workflows in CA Service ManagementPre-Con Education: Building Advanced ITSM Workflows in CA Service Management
Pre-Con Education: Building Advanced ITSM Workflows in CA Service ManagementCA Technologies
 
Building complex and modular RIAs with OSGi and Flex
Building complex and modular RIAs with OSGi and FlexBuilding complex and modular RIAs with OSGi and Flex
Building complex and modular RIAs with OSGi and FlexCARA_Lyon
 
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...pdinauta
 
Fire Fighting systems - Advanced Services
Fire Fighting systems - Advanced ServicesFire Fighting systems - Advanced Services
Fire Fighting systems - Advanced ServicesPratibha Mohan
 
Intelligent Building (Dayabumi Complex)
Intelligent Building (Dayabumi Complex)Intelligent Building (Dayabumi Complex)
Intelligent Building (Dayabumi Complex)Ridhwan Zakaria
 
Fire fighting passive system
Fire fighting passive systemFire fighting passive system
Fire fighting passive systemNoorule Inie Osman
 
Topic 3 District Cooling System
Topic 3 District Cooling SystemTopic 3 District Cooling System
Topic 3 District Cooling Systempnnazz
 
Sewerage design
Sewerage designSewerage design
Sewerage designSharifah Ain
 
MEP- Building services
MEP- Building servicesMEP- Building services
MEP- Building servicesAniket Khandelwal
 
Curtain walls - Advanced structural systems
Curtain walls - Advanced structural systemsCurtain walls - Advanced structural systems
Curtain walls - Advanced structural systemsPratibha Mohan
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)Amazon Web Services
 

Viewers also liked (13)

WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App Factory
WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App FactoryWSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App Factory
WSO2Con US 2013 - Rapidly Building Complex Applications with WSO2 App Factory
 
Pre-Con Education: Building Advanced ITSM Workflows in CA Service Management
Pre-Con Education: Building Advanced ITSM Workflows in CA Service ManagementPre-Con Education: Building Advanced ITSM Workflows in CA Service Management
Pre-Con Education: Building Advanced ITSM Workflows in CA Service Management
 
Building complex and modular RIAs with OSGi and Flex
Building complex and modular RIAs with OSGi and FlexBuilding complex and modular RIAs with OSGi and Flex
Building complex and modular RIAs with OSGi and Flex
 
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...
Barile S., Polese F., Saviano M., Di Nauta P., Drawing boundaries in complex ...
 
Fire Fighting systems - Advanced Services
Fire Fighting systems - Advanced ServicesFire Fighting systems - Advanced Services
Fire Fighting systems - Advanced Services
 
Intelligent Building (Dayabumi Complex)
Intelligent Building (Dayabumi Complex)Intelligent Building (Dayabumi Complex)
Intelligent Building (Dayabumi Complex)
 
Fire fighting passive system
Fire fighting passive systemFire fighting passive system
Fire fighting passive system
 
Topic 3 District Cooling System
Topic 3 District Cooling SystemTopic 3 District Cooling System
Topic 3 District Cooling System
 
Sewerage design
Sewerage designSewerage design
Sewerage design
 
MEP- Building services
MEP- Building servicesMEP- Building services
MEP- Building services
 
Introduction To Building Services
Introduction To Building ServicesIntroduction To Building Services
Introduction To Building Services
 
Curtain walls - Advanced structural systems
Curtain walls - Advanced structural systemsCurtain walls - Advanced structural systems
Curtain walls - Advanced structural systems
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
 

Similar to OUGF OSGi/Flex

Apache conna2010 os-gi_flex-fornaciari
Apache conna2010 os-gi_flex-fornaciariApache conna2010 os-gi_flex-fornaciari
Apache conna2010 os-gi_flex-fornaciariZenika
 
AMF Flash and .NET
AMF Flash and .NETAMF Flash and .NET
AMF Flash and .NETYaniv Uriel
 
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...mfrancis
 
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptx
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptxIBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptx
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptxGeorg Ember
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule EsbAnand kalla
 
uMobile Development Strategies
uMobile Development StrategiesuMobile Development Strategies
uMobile Development StrategiesJasig uPortal Project
 
Java onebrazil hk2
Java onebrazil hk2Java onebrazil hk2
Java onebrazil hk2Jerome Dochez
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Securitychuckbt
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programminghotrannam
 
Convertigo Mobile Application Development platform for Enterprises
Convertigo Mobile Application Development platform for EnterprisesConvertigo Mobile Application Development platform for Enterprises
Convertigo Mobile Application Development platform for EnterprisesConvertigo | MADP & MBaaS
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpsonmfrancis
 
Collector Web Services
Collector Web ServicesCollector Web Services
Collector Web Servicespublisyst
 
SUGCON EU 2023 - Secure Composable SaaS.pptx
SUGCON EU 2023 - Secure Composable SaaS.pptxSUGCON EU 2023 - Secure Composable SaaS.pptx
SUGCON EU 2023 - Secure Composable SaaS.pptxVasiliy Fomichev
 
OSGi Cloud Ecosystems
OSGi Cloud EcosystemsOSGi Cloud Ecosystems
OSGi Cloud EcosystemsDavid Bosschaert
 
SkyeCORE - Rev Up Your OSGi Services!
SkyeCORE - Rev Up Your OSGi Services!SkyeCORE - Rev Up Your OSGi Services!
SkyeCORE - Rev Up Your OSGi Services!Wayne Williams
 
OSGi on Google Android using Apache Felix
OSGi on Google Android using Apache FelixOSGi on Google Android using Apache Felix
OSGi on Google Android using Apache FelixMarcel Offermans
 
Phonegap 2.x
Phonegap 2.xPhonegap 2.x
Phonegap 2.xBrian LeRoux
 

Similar to OUGF OSGi/Flex (20)

Apache conna2010 os-gi_flex-fornaciari
Apache conna2010 os-gi_flex-fornaciariApache conna2010 os-gi_flex-fornaciari
Apache conna2010 os-gi_flex-fornaciari
 
AMF Flash and .NET
AMF Flash and .NETAMF Flash and .NET
AMF Flash and .NET
 
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
Technical Specification Overview - OSGi World Congress 2002 Workshop Intro - ...
 
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptx
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptxIBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptx
IBM BP Session - Multiple CLoud Paks and Cloud Paks Foundational Services.pptx
 
SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
 
uMobile Development Strategies
uMobile Development StrategiesuMobile Development Strategies
uMobile Development Strategies
 
Distributing OSGi
Distributing OSGiDistributing OSGi
Distributing OSGi
 
Java onebrazil hk2
Java onebrazil hk2Java onebrazil hk2
Java onebrazil hk2
 
Html5 Application Security
Html5 Application SecurityHtml5 Application Security
Html5 Application Security
 
HTML5 Programming
HTML5 ProgrammingHTML5 Programming
HTML5 Programming
 
Flex alfresco
Flex   alfrescoFlex   alfresco
Flex alfresco
 
Convertigo Mobile Application Development platform for Enterprises
Convertigo Mobile Application Development platform for EnterprisesConvertigo Mobile Application Development platform for Enterprises
Convertigo Mobile Application Development platform for Enterprises
 
OSGi In Anger - Tara Simpson
OSGi In Anger - Tara SimpsonOSGi In Anger - Tara Simpson
OSGi In Anger - Tara Simpson
 
Collector Web Services
Collector Web ServicesCollector Web Services
Collector Web Services
 
SUGCON EU 2023 - Secure Composable SaaS.pptx
SUGCON EU 2023 - Secure Composable SaaS.pptxSUGCON EU 2023 - Secure Composable SaaS.pptx
SUGCON EU 2023 - Secure Composable SaaS.pptx
 
OSGi Cloud Ecosystems
OSGi Cloud EcosystemsOSGi Cloud Ecosystems
OSGi Cloud Ecosystems
 
SkyeCORE - Rev Up Your OSGi Services!
SkyeCORE - Rev Up Your OSGi Services!SkyeCORE - Rev Up Your OSGi Services!
SkyeCORE - Rev Up Your OSGi Services!
 
OSGi on Google Android using Apache Felix
OSGi on Google Android using Apache FelixOSGi on Google Android using Apache Felix
OSGi on Google Android using Apache Felix
 
Phonegap 2.x
Phonegap 2.xPhonegap 2.x
Phonegap 2.x
 
Enterprise service bus part 2
Enterprise service bus part 2Enterprise service bus part 2
Enterprise service bus part 2
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

OUGF OSGi/Flex

  • 1. Building complex and modular RIAs with OSGi and Flex francois.fornaciari@zenika.com www.zenika.com
  • 2. Agenda • Introduction • Flex and OSGi interactions • Application modularization • Demo • Conclusion www.zenika.com
  • 3. What is Flex (1/2) • Framework for building RIA • Flash technology • Free Software Development Kit (SDK) • Flash Player (VM) • Strong integration with Java • Tooling • Flash Builder : IDE based on Eclipse • IntelliJ IDEA www.zenika.com
  • 4. What is Flex (2/2) • MXML: XML-based language • ActionScript: ECMAScript-compliant scripting • Library of pre-built components • Compiler: create SWFs from MXML/ActionScript www.zenika.com
  • 5. MXML • XML-based language • Declarative way to build applications <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <s:Panel> <s:Label text="Label" /> <s:Button label="Button" /> </s:Panel> </s:Application> www.zenika.com
  • 6. ActionScript • Core of the Flex Framework • ECMAScript-compliant scripting • Familiar syntax package com.zenika.flex { public class MyClass interface MyInterface { public function MyClass() { } public function doSomething():String { } } } www.zenika.com
  • 7. What is OSGi (1/3) • A module system and service platform for the Java programming language • OSGi framework specifications • Core Specification • Compendium Specification • Enterprise Specification www.zenika.com
  • 8. What is OSGi (2/3) • Service Oriented Architecture Service broker Lookup Register Specification Binding Consumer Provider www.zenika.com
  • 9. What is OSGi (3/3) • Bundle • Deployment unit: JAR + MANIFEST • Functional unit (provides services) • Application • Set of bundles • Dynamically deployed • Potentially shared between applications www.zenika.com
  • 10. Purpose • Presentation of the main design patterns for building complex and modular applications with Flex and OSGi • Two axes • Communication between Flex and OSGi • Application modularization www.zenika.com
  • 11. General architecture Client (browser) Server (Java) Flex HTTPService OSGi Framework WebService RemoteObject Producer SWF Application SWF Module SWF Module Consumer Bundle Bundle Bundle www.zenika.com
  • 12. Handling remote calls • HTTPService, WebService, Remote Objects, Consumer/Producer • Asynchronous calls • Result, Fault or Message handlers • Arguments and result types • Strongly typed or generic objects • XML format • Properties • URL, destination, endpoint, id, … www.zenika.com
  • 13. Service call example private function callService():void { var service:MyService = new MyService(destination); service.addEventListener(ResultEvent.RESULT, onResult); service.addEventListener(FaultEvent.FAULT, onFault); service.send(); } private function onResult(event:ResultEvent):void { var result:MyObject = event.result as MyObject; ... } private function onFault(event:FaultEvent):void {...} www.zenika.com
  • 14. Communications (1/2) • Accessing “non-OSGi services” • HTTPService • Supported methods: GET | POST • HEAD | OPTIONS | PUT | TRACE | DELETE only through the server-based proxy service • WebService • Provides access to SOAP-based web services on remote servers • ex: exposed through D-OSGi www.zenika.com
  • 15. Communications (2/2) • Accessing “OSGi services” • In a transparent way • Two communication types • RemoteObject • Simple call to an existing OSGi service • Strongly-typed arguments and result or … • … generic objects • Unsafe access to properties and methods • Introspection API • Producer/Consumer • Topic subscription www.zenika.com
  • 16. AMF Protocol (1/2) • Action Message Format (v3) • Binary format used to serialize ActionScript objects • Optimized transferred data amount • Primarily used to exchange data between Adobe Flash applications and remote services • Specification since 2007 • Supported by many server-side languages and technologies: Java, .NET, PHP, … www.zenika.com
  • 17. Integration frameworks • Existing open source frameworks Name OSGi support RemoteObject Producer / Consumer AMF3 for OSGi (LGPL) yes yes yes GraniteDS (LGPL) yes (prototype) yes (unstable) no Spring Flex (ASL) yes (Virgo) yes yes • AMF3 for OSGi (Christopher Brind) • Easy to use • Only 3 bundles to deploy • Robust www.zenika.com
  • 18. AMF3 for OSGi • OSGi bundles description • uk.co.arum.osgi.amf3 • Serialization-deserialization of AMF3 objects • uk.co.arum.osgi.amf3.http • Registers an HTTP servlet that is capable of reading and writing AMF3 objects • uk.co.arum.osgi.amf3.flex.remoting • Implements FlexRemoting over HTTP • Provides support for channel based messaging www.zenika.com
  • 19. Apache Felix projects (1/2) • Core of the server-side application • Framework • File Install • Directory based OSGi management agent • Used internally by AMF3 for OSGi • Declarative Service (SCR) • Event Admin Service • Log Service • HTTP Service (Jetty) www.zenika.com
  • 20. Apache Felix projects (2/2) • Application-specific projects • Event Admin Service • OSGi EventHandler receives messages from Flex Producers • Messages posted by the OSGi EventAdmin service are received by Flex Consumers • iPOJO • Used to declare OSGi components • Support of annotations • Extensible handlers www.zenika.com
  • 21. Publishing OSGi services • Additional service property • AMF_SERVICE_NAME • Instantiated with the service class name @Component(name="MyService") @Provides public class MyServiceImpl implements MyService { @ServiceProperty(name="AMF_SERVICE_NAME") private String serviceName = MyService.class.getName(); ... } www.zenika.com
  • 22. Consuming OSGi services • Flex RemoteObject • Endpoint: AMF3 servlet path ex: http://localhost:8080/amf3osgi • Destination: OSGi service class name <s:RemoteObject id="myService" endpoint="/amf3osgi" destination="com.zenika.service.MyService"> <mx:method name="doSometing" result="onResult(event)" fault="onFault(event)" /> </s:RemoteObject> www.zenika.com
  • 23. Type-safe objects • Method arguments and result [RemoteClass(alias="com.zenika.systemmanager...SWFModule")] [Bindable] public class SWFModule www.zenika.com
  • 24. Producer / Consumer (1/2) • Bridge between Flex events and EventAdmin service • Elements attributes • Consumer: callback when a message is received • Consumer and producer: destination <mx:Consumer message="onMessage(event)" destination="events" fault="onFault(event)" /> <mx:Producer destination="events" fault="onFault(event)" /> www.zenika.com
  • 25. Producer / Consumer (2/2) • Destination configuration • Set of channels used to send messages to a target destination • QoS: many channels for network failure tolerance var channelSet:ChannelSet = new ChannelSet(); var channel:AMFChannel = new AMFChannel("events","/amf3osgi"); channel.pollingInterval = 5000; channelSet.addChannel(channel); consumer.channelSet = channelSet; www.zenika.com
  • 26. Sending messages (1/2) • From OSGi • PublishedObjectEvent (channelID, object) • Extends org.osgi.service.event.Event @Bind public void bindEventAdmin(EventAdmin eventAdmin) { this.eventAdmin = eventAdmin; } private void sendMessage() { eventAdmin.postEvent( new PublishedObjectEvent("events", object)); } www.zenika.com
  • 27. Sending messages (2/2) • From Flex • Sending AsyncMessage through the producer • Body: object to send var message:AsyncMessage = new AsyncMessage(); message.body= messageObject; producer.send(message); www.zenika.com
  • 28. Receiving message (1/2) public class FlexEventHandler implements EventHandler { @ServiceProperty(name="event.topics") private String eventTopics = ".../amf3/flex/remoting/events/PublishedObjectEvent"; public void handleEvent(Event event) { if (event instanceof PublishedObjectEvent) { ...} } } All Flex messages are received by this handler www.zenika.com
  • 29. Receiving message (2/2) • Message: typed-object • Start / cancel subscription private function start():void { consumer.subscribe(); } private function stop():void { consumer.unsubscribe(); } private function onMessage(event:MessageEvent):void { var msg:MyMessage = event.message.body as MyMessage; ... } www.zenika.com
  • 30. Some key elements • We have seen how to: • Expose OSGi services to Flex • Interact with different service types • Remote Objects • Event-based messages • Standard web services • Define strongly-typed objects • Handle events posted by the backend www.zenika.com
  • 31. Flex modulary • Flex modules • SWF files that can be loaded and unloaded at runtime by an application • Cannot be run independently • Applications can share modules • No need to load all modules at startup www.zenika.com
  • 32. Benefits • Split Flex application into several pieces • Smaller initial download size of the SWF • Shorter load time • Better encapsulation • Load required modules only • Unload modules at runtime • Free up memory and resources www.zenika.com
  • 33. Main goal • OSGi is the Java modularity • Flex supports modules • How can we build a complete modular application? www.zenika.com
  • 34. Creating modules • “Module” as root element <mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" implements="...api.ModuleInterface" creationComplete="start()"> <fx:Script> <![CDATA[ public function start():void {...} public function stop():void {...} ]]> </fx:Script> <s:Label text="Label" /> </mx:Module> www.zenika.com
  • 35. Module lifecycle • Start method is called when the module is loaded • Stop method is called before unloading the module • Common interface between the application and the module package com.zenika.systemmanager.api { public interface ModuleInterface { function stop():void; } } www.zenika.com
  • 36. Packaging • Each bundle contains • Business logic • OSGi services Application Module bundle bundle • User interface • SWF file JAVA JAVA • Build may be done with (OSGi) (OSGi) Maven UI UI (SWF) (SWF) www.zenika.com
  • 37. Application bundle • User Interface skeleton • Able to retrieve list of available modules • OSGi service for getting module URLs • Flex client notified when a module appears or disappears • Flex consumer is aware of events posted by the EventAdmin www.zenika.com
  • 38. Technical view (1/3) • Registers bundle resources into the HTTP Service • Main SWF, HTML files, … • Listens to bundle arrival / departure • Implementation of the extender pattern • Use of a BundeTracker for being notified of bundles declaring Flex modules • MANIFEST.MF : SWF-Modules: [path]=[SWF name] • Register/unregister SWFs into declared path • Post event to notify Flex client www.zenika.com
  • 39. Technical view (2/3) var modules:ArrayCollection = event.result as ArrayCollection; for each(var module:SWFModule in modules) { var loader:ModuleLoader = new ModuleLoader(module.url); // Register event listeners loader.addEventListener(ModuleEvent.READY, handleModuleReady); loader.addEventListener(ModuleEvent.ERROR, handleModuleError); // Start the module loading loader.load(); } www.zenika.com
  • 40. Technical view (3/3) • After bundle undeployment • Call the stop method • Stop properly on-going processes • Warning: OSGi services have already been unregistered • Unload associated modules • Free-up memory and resources www.zenika.com
  • 41. Module bundle • Autonomous module • Contains its own UI and logic • Good isolation • Flex modules can easily be based upon OSGi services www.zenika.com
  • 42. DĂ©mo DEMO www.zenika.com
  • 43. Conclusion (1/2) • Flex • Development of rich interfaces • Native support of modules • Loading / unloading modules at runtime • OSGi • The Dynamic Module System for Java • Service Oriented Architecture • Service availability to Flex www.zenika.com
  • 44. Conclusion (2/2) • Seamless communications • Asynchronous remote calls • Notifications • Integration • Application: set of autonomous bundles with their own interface and business logic www.zenika.com