ApacheCon NA11 - Apache Celix, Universal OSGi?

821 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
821
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
10
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ApacheCon NA11 - Apache Celix, Universal OSGi?

  1. 1. Apache  Celix Universal  OSGi? Alexander  Broekhuis   alexander.broekhuis@luminis.eu
  2. 2. Introduc<on• Alexander  Broekhuis • Started  as  Java  Engineer • Programming  C  since  2010• At  Luminis  since  2008 • Small  SoAware  House • Research  and  innovaEon  oriented • Involved  in  Open  Source  (Apache)• Apache  commiKer  since  2010
  3. 3. Agenda• IntroducEon• History• OSGi  in  C• Remote  Services• Development• Universal  OSGi• Status
  4. 4. Introduc<on• OSGi  specificaEon  implemented  in  C • Adapted  where  needed• Focussed  on  Embedded  Dynamic  Systems• Based  on  Apache  Felix• Remote  Services • Distributed  Systems • Interoperability  with  Java
  5. 5. History• Started  in  2010• Middleware • Mixed  Java/C  environment • Based  on  (de-­‐facto)  standards• Open  Source • Generic  Middleware  -­‐>  No  core  business • Benefits  others,  but  also  benefits  FROM  others
  6. 6. OSGi  is:• component  based  framework• allows  dynamic  assembly  of  components• Java,  so  independent  of  operaEng  systemOSGi  technology  is  the  dynamic  module  system  for  Java™OSGi  technology  is  Universal  Middleware.OSGi  technology  provides  a  service-­‐oriented,  component-­‐based  environment  for  developers  and  offers  standardized  ways  to  manage  the  so@ware  lifecycle.  These  capabiliBes  greatly  increase  the  value  of  a  wide  range  of  computers  and  devices  that  use  the  Java™  plaForm.
  7. 7. OSGi "-)*+(( !"#$%&&($ "-)*+(($.)*+,* )*+,* )*+,/-0 ,$)1(3$. +&/3$ $-. 4-"-)*+(( )*122"-0 )*12 4-"-)*+(($. !"#$%&()*+,-
  8. 8. OSGi !"#$%& !"#$%& !"#$% &"#$%()*!! "-)*+(( !"#$%&&($ +%,()*!! "-)*+(($.)*+,* )*+,* )*+,/-0 !"#$%&! ("#$%)*+,&-,.!! ,$)1(3$. +&/3$ /0,%(1!"%*&-,.!! $-. 4-"-)*+(( )*122"-0 )*12 ("$%.*23,&-,.!! 4-"-)*+(($. !"#$%&!&#!() *+,-."#$&+/.!! !"#$%&()*+,-
  9. 9. OSGi !"#$%& !"#$%& !"#$% &"#$%()*!! +%,()*!! !"#$%&! ("#$%)*+,&-,.!! /0,%(1!"%*&-,.!! ("$%.*23,&-,.!! !"#$%&!&#!() *+,-."#$&+/.!! !"#$%&()*+,-
  10. 10. OSGi !"#$%&"(")%*+#, !+-#" !"#$%& !"#$%& !"#$% &"#$%()*!! !"#$%&&$())*&+,(-./%0!$1012-)3"24$1*&+,(-./5 +%,()*!! !"#$%&,.%4)-(/-63"24$17.2-18-&.2-18-95 &.2-18-:/1;%)-1/<1/,%&16<-./1:&$()):;1-=(0169>2"$$> 21?<-./1@0!$699A !"#$%&! B ("#$%)*+,&-,.!! !"#$%&,.%4)-.!63"24$17.2-18-&.2-18-95 /0,%(1!"%*&-,.!! B B ("$%.*23,&-,.!! !"#$%&!&#!() *+,-."#$&+/.!! !"#$%&()*+,-
  11. 11. Benefits• Making  products  with  many  variaEons• Improving  quality  through  re-­‐use• Speed:  Eme  to  market
  12. 12. OSGi  in  C• Follows  the  OSGi  SpecificaEon • A  Service  Registry  for  tracking  services • Bundle  AcEvators  for  registering  services • Bundle  Lifecycle  for  tracking  Bundle  state• Structs  instead  of  Interfaces • Using  funcEon  pointers  to  forward  calls
  13. 13. Services  in  C• Service • Struct  with  funcEon  pointers• AcEvator • start  /  stop Activator <struct>• Celix create + start Service registerService + stop • bundleContext create pointer • registry Celix Component • etc.. getService depends
  14. 14. Services  in  C  -­‐  BundleAc<vator Java - BundleActivator@Overridepublic void start(BundleContext context) throws Exception { System.out.println("Hello " + m_word);} C - BundleActivator celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) { struct userData * data = (struct userData *) userData; printf("Hello %sn", data->word); return CELIX_SUCCESS; }
  15. 15. Services  in  C  -­‐  Service  registra<on Java - Register servicecontext.registerService( ShellService.class.getName(), new ShellServiceImpl(), null); C - Register service SHELL_SERVICE shellService = (SHELL_SERVICE) apr_palloc(pool, (sizeof (*shellService)); shellService->shell = shell; shellService->getCommands = shell_getCommands; shellService->getCommandDescription = shell_getCommandDescription; shellService->getCommandUsage = shell_getCommandUsage; shellService->getCommandReference = shell_getCommandReference; shellService->executeCommand = shell_executeCommand; SERVICE_REGISTRATION registration = NULL; status = bundleContext_registerService( context, SHELL_SERVICE_NAME, shellService, NULL, &registration);
  16. 16. Dynamic  Assembly• Dynamic  Loading • Library Depends • Using  dlfcn.h • dlopen  /  dlclose   <shared object> <shared object> Celix Initializes Provider Realizes • dlsym <struct> Uses Provider Service Initializes <shared object> Consumer Depends
  17. 17. Deployment• Bundling • Zip  file  with  Shared  Object • (.so,  .dll,  .dylib,  ...) • Manifest • Import  /  Export• RunEme • Extracted  to  cache
  18. 18. Demo• Paint  ApplicaEon • From  OSGi  in  AcEon• Install  /  Start  /  Stop  bundles
  19. 19. Remote  Services• Remote  Service  Admin • Enterprise  SpecificaEon• Interoperability• Protocol • SOAP? • REST/JSON • Hessian
  20. 20. Remote  Services «service» Server Server Client imported = "true" «service» Server ServerStub ServerProxy Registry remote = "true" «track» Remote Proxy Publisher Publisher «service» «service» Discovery Discovery Service Service
  21. 21. Remote  Services «service» Server Server Client imported = "true" «service» Server ServerStub ServerProxy Registry remote = "true" «track» Remote Proxy Publisher Publisher «service» «service» Stubs Discovery Proxies Discovery Service Service
  22. 22. Remote  Services  in  Celix• REST/JSON • Basic  implementaEon  working• Hessian • Basic  (de)serializaEon  implementaEon  made• Todo • Generate  code  for  endpoints  (stubs/proxies) • Test/Implement  interoperability  with  Java
  23. 23. Demo  -­‐  Remote  Services• Calculator  Example  Service struct example_service { example_t example; celix_status_t (*add)(example_t example, double a, double b, double *result); celix_status_t (*sub)(example_t example, double a, double b, double *result); celix_status_t (*sqrt)(example_t example, double a, double *result); };• Calculator  Shell  Commands • add  /  sub  /  sqrt• Endpoints  using  REST  /  JSON • Embedded  Mongoose  webserver
  24. 24. Demo  -­‐  Remote  Services• Calculator  Example  Service struct example_service { example_t example; celix_status_t (*add)(example_t example, double a, double b, double *result); celix_status_t (*sub)(example_t example, double a, double b, double *result); celix_status_t (*sqrt)(example_t example, double a, double *result); };• Calculator  Shell  Commands • add  /  sub  /  sqrt• Endpoints  using  REST  /  JSON • Embedded  Mongoose  webserver
  25. 25. PlaJorm  Support• Apache  Portable  RunEme • Linux,  Unix,  Windows,  etc • Memory  pool • File  handling • Threads• No  RealTime/Embedded • Reuse  APR  API
  26. 26. Building• CMake • Cross  pladorm  /  MulE  IDE• Framework • Standard  library• Bundle  macros • Create  bundle  zip • Add  library  and  resources
  27. 27. Universal  OSGi• RFP-­‐89 • Proposed  to  the  mailing  list  in  2007 • Since  then  remained  silent • Ongoing  effort  to  pick  up  again• Supported  Languages • C++  /  .NET  language  (C#)  /  ECMAScript • What  about  C?• Interest  from  Community?
  28. 28. Universal  OSGi  -­‐  Celix• NaEve  port  in  C• Status • Based  on  the  R4  SpecificaEon • Deployable  bundles • Bundle  lifecycle • Service  registry • Framework  API • Standards  for  IPC  and  communicaEons • Remote  Services
  29. 29. Status  -­‐  Framework• Dynamic  Loading  of  Libraries• Service  Registry  for  Querying  and  Registering• Bundles  with  Manifest  for  Deployment• Service  Tracker  for  tracking  Services• Bundle  State  and  Life  Cycle• Bundle  Cache  for  Storing  State
  30. 30. Status  -­‐  Extras• Shell  ImplementaEon  for  InspecEng  Bundles • ps/start/stop/install/update/uninstall  commands• Dependency  Manager  for  Dependencies • Simple  ImplementaEon • StaEc  Linked• Open  Source  at  Apache • Currently  in  the  Incubator
  31. 31. Apache  Celix• Roadmap • ...   • Deployment  Admin • Remote  Services • ConfiguraEon  Admin • Event  Admin• Looking  for • Users  /  Testers  /  CommiKers
  32. 32. Links• Original  Proposal: • hKp://wiki.apache.org/incubator/CelixProposal• Incubator  Mailing  List  Archive: • hKp://incubator.markmail.org/search/?q=Celix• IncubaEon  Status: • hKp://incubator.apache.org/projects/celix.html• Project  Page: • hKp://incubator.apache.org/celix/

×