SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
OSGi on Scala
                                Ease OSGi development with a Scala DSL
                                           Heiko Seeberger




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   2009-06-22
Sonntag, 21. Juni 2009
OSGi on Scala




                                                                        Why?



          •       Scala is a great language
                •        Runs on JVM & fully interoperable with Java

                •        Object-functional programming style => Best of OO and FP

                •        Scalable and flexible language => Domain Specific Languages

          •       Let’s put OSGi on Scala to ease OSGi development




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   2
Sonntag, 21. Juni 2009
OSGi on Scala




                                                            ScalaModules




          •       Scala DSL for OSGi

          •       Ease service handling

          •       Smooth ugly parts of the API, e.g. null references




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   3
Sonntag, 21. Juni 2009
OSGi on Scala




                                                                Live Demo
                                                           Should I really dare?

                                                                            YES!




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   4
Sonntag, 21. Juni 2009
OSGi on Scala




             Start Scala REPL with appropriate Classpath



           tmp$ scala -cp felix.jar:scalamodules-core-...jar:scalamodules-util-...jar
           Welcome to Scala version 2.7.5.final (Java HotSpot(TM) Client VM, Java 1.5.0_19).
           Type in expressions to have them evaluated.
           Type :help for more information.




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   5
Sonntag, 21. Juni 2009
OSGi on Scala




                                 Import Felix and ScalaModules



                                 scala> import org.apache.felix.framework._
                                 import org.apache.felix.framework._

                                 scala> import org.scalamodules.core.RichBundleContext._
                                 import org.scalamodules.core.RichBundleContext._




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   6
Sonntag, 21. Juni 2009
OSGi on Scala




                            Start Felix and get BundleContext



                    scala> val felix = new Felix(null)
                    felix: org.apache.felix.framework.Felix = org.apache.felix.framework [0]

                    scala> felix.start

                    scala> val ctx = felix.getBundleContext
                    ctx: org.osgi.framework.BundleContext = org...BundleContextImpl@d9367a




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   7
Sonntag, 21. Juni 2009
OSGi on Scala




                         Define a Service Interface and Object



                              scala> trait Greeting { def hello: String }
                              defined trait Greeting

                              scala> val greeting = new Greeting { def hello = "Hello!" }
                              greeting: java.lang.Object with Greeting = $anon$1@8ed249




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   8
Sonntag, 21. Juni 2009
OSGi on Scala




                                         Try to consume a Service



                         scala> ctx getOne classOf[Greeting] andApply { _.hello } match {
                              |   case Some(s) => println(s)
                              |   case None    => println("No Greeting service available!")
                              | }
                         No Greeting service available!




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   9
Sonntag, 21. Juni 2009
OSGi on Scala




            Try to provide a Service with illegal Interface



    scala> ctx registers classOf[String] theService greeting
    <console>:13: error: value registers is not a member of org.osgi.framework.BundleContext
           ctx registers classOf[String] theService greeting
               ^




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   10
Sonntag, 21. Juni 2009
OSGi on Scala




                                       Provide a Service correctly




         scala> ctx registerAs classOf[Greeting] theService greeting
         res3: org.osgi.framework.ServiceRegistration = org...ServiceRegistrationImpl@ed63a3




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   11
Sonntag, 21. Juni 2009
OSGi on Scala




                         Try to consume a Service once more



                         scala> ctx getOne classOf[Greeting] andApply { _.hello } match {
                              |   case Some(s) => println(s)
                              |   case None    => println("No Greeting service available!")
                              | }
                         Hello!




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   12
Sonntag, 21. Juni 2009
OSGi on Scala




                              What else can ScalaModules do?




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   13
Sonntag, 21. Juni 2009
OSGi on Scala




                             Provide a Service with Properties




                                    context registerAs classOf[Greeting] withProperties
                                     ("name" -> "welcome") theService greeting




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   14
Sonntag, 21. Juni 2009
OSGi on Scala




                Consume multiple Service applying a Filter



                         context getMany classOf[Greeting] withFilter "(name=*)" andApply {
                           _.welcome
                         } match {
                           case None           => noGreetingService()
                           case Some(welcomes) => welcomes.foreach { println }
                         }




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   15
Sonntag, 21. Juni 2009
OSGi on Scala




                                                          Track Services



            context track classOf[Greeting] on {
              case Adding(greeting, _)   => println("Adding Greeting: " + greeting.welcome)
              case Removed(greeting, _) => println("Removed Greeting: " + greeting.goodbye)
            }




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   16
Sonntag, 21. Juni 2009
OSGi on Scala




                                               Service Dependencies



                 context registerAs classOf[Command] dependOn classOf[Greeting] theService {
                   greeting => new Command {
                     ...
                   }
                 }




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   17
Sonntag, 21. Juni 2009
OSGi on Scala




                                                    And much more ...




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   18
Sonntag, 21. Juni 2009
OSGi on Scala




                                                 How to get started?



          •       www.scalamodules.org

          •       Wiki / Getting Started

          •       Reference Guide

          •       Contact: seeberger@weiglewilczek.com




© 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License.   19
Sonntag, 21. Juni 2009

Weitere ähnliche Inhalte

Ähnlich wie OSGi DevCon Europe 09 - OSGi on Scala

Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGiMarek Koniew
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerSam Brannen
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deploymentThilo Utke
 
JAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsJAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsHeiko Seeberger
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...Vadym Kazulkin
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Reviewnjbartlett
 
Deploying and running Grails in the cloud
Deploying and running Grails in the cloudDeploying and running Grails in the cloud
Deploying and running Grails in the cloudPhilip Stehlik
 
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...mfrancis
 
The OSGi Framework Multiplication
The OSGi Framework MultiplicationThe OSGi Framework Multiplication
The OSGi Framework MultiplicationClément Escoffier
 
AWS DevDay Berlin - Automating building blocks choices you will face with con...
AWS DevDay Berlin - Automating building blocks choices you will face with con...AWS DevDay Berlin - Automating building blocks choices you will face with con...
AWS DevDay Berlin - Automating building blocks choices you will face with con...Cobus Bernard
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the CloudBert Ertman
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi WebinarWSO2
 
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdfAndrey Devyatkin
 
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...mfrancis
 

Ähnlich wie OSGi DevCon Europe 09 - OSGi on Scala (20)

Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGi
 
Enterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm ServerEnterprise Applications With OSGi and SpringSource dm Server
Enterprise Applications With OSGi and SpringSource dm Server
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deployment
 
Groovy in 15 minutes
Groovy in 15 minutesGroovy in 15 minutes
Groovy in 15 minutes
 
JAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components ModelsJAX 09 - OSGi Service Components Models
JAX 09 - OSGi Service Components Models
 
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
Cloud PaaS with Java
Cloud PaaS with JavaCloud PaaS with Java
Cloud PaaS with Java
 
Deploying and running Grails in the cloud
Deploying and running Grails in the cloudDeploying and running Grails in the cloud
Deploying and running Grails in the cloud
 
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph!  ...
Bytecode Weaving in OSGi – Enhance Your Classes, Not Your Dependency graph! ...
 
GlassFish v3 - Architecture
GlassFish v3 - ArchitectureGlassFish v3 - Architecture
GlassFish v3 - Architecture
 
The OSGi Framework Multiplication
The OSGi Framework MultiplicationThe OSGi Framework Multiplication
The OSGi Framework Multiplication
 
AWS DevDay Berlin - Automating building blocks choices you will face with con...
AWS DevDay Berlin - Automating building blocks choices you will face with con...AWS DevDay Berlin - Automating building blocks choices you will face with con...
AWS DevDay Berlin - Automating building blocks choices you will face with con...
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the Cloud
 
Osgi Webinar
Osgi WebinarOsgi Webinar
Osgi Webinar
 
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf
2023-09-28-AWS Las Palmas UG - Dynamic Anti-Frigile Systems.pdf
 
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
TRESOR: The modular cloud - Building a domain specific cloud platform with OS...
 
Tales from the OSGi trenches
Tales from the OSGi trenchesTales from the OSGi trenches
Tales from the OSGi trenches
 
"Messaging with Quarkus"
"Messaging with Quarkus""Messaging with Quarkus"
"Messaging with Quarkus"
 
"Messaging with Quarkus"
"Messaging with Quarkus""Messaging with Quarkus"
"Messaging with Quarkus"
 

Mehr von Heiko Seeberger

RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?Heiko Seeberger
 
JM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewJM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewHeiko Seeberger
 
Eclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractEclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractHeiko Seeberger
 
Eclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiEclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiHeiko Seeberger
 
Eclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingEclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingHeiko Seeberger
 
Eclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxEclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxHeiko Seeberger
 
Eclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterEclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterHeiko Seeberger
 
EclipseCon 08 - Agile RCP
EclipseCon 08 - Agile RCPEclipseCon 08 - Agile RCP
EclipseCon 08 - Agile RCPHeiko Seeberger
 
W-JAX 07 - AOP im Einsatz mit OSGi und RCP
W-JAX 07 - AOP im Einsatz mit OSGi und RCPW-JAX 07 - AOP im Einsatz mit OSGi und RCP
W-JAX 07 - AOP im Einsatz mit OSGi und RCPHeiko Seeberger
 
W-JAX 08 - Declarative Services versus Spring Dynamic Modules
W-JAX 08 - Declarative Services versus Spring Dynamic ModulesW-JAX 08 - Declarative Services versus Spring Dynamic Modules
W-JAX 08 - Declarative Services versus Spring Dynamic ModulesHeiko Seeberger
 
JAX 08 - Experiences using Equinox Aspects in a real-world Project
JAX 08 - Experiences using Equinox Aspects in a real-world ProjectJAX 08 - Experiences using Equinox Aspects in a real-world Project
JAX 08 - Experiences using Equinox Aspects in a real-world ProjectHeiko Seeberger
 

Mehr von Heiko Seeberger (20)

JavaSPEKTRUM - Scala 3
JavaSPEKTRUM - Scala 3JavaSPEKTRUM - Scala 3
JavaSPEKTRUM - Scala 3
 
JavaSPEKTRUM - Scala 2
JavaSPEKTRUM - Scala 2JavaSPEKTRUM - Scala 2
JavaSPEKTRUM - Scala 2
 
JavaSPEKTRUM - Scala 1
JavaSPEKTRUM - Scala 1JavaSPEKTRUM - Scala 1
JavaSPEKTRUM - Scala 1
 
RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?RheinJUG 2010 - Sprechen Sie Scala?
RheinJUG 2010 - Sprechen Sie Scala?
 
W-JAX 09 - ScalaModules
W-JAX 09 - ScalaModulesW-JAX 09 - ScalaModules
W-JAX 09 - ScalaModules
 
W-JAX 09 - Lift
W-JAX 09 - LiftW-JAX 09 - Lift
W-JAX 09 - Lift
 
JM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala ReviewJM 08/09 - Beginning Scala Review
JM 08/09 - Beginning Scala Review
 
JM 08/09 - ScalaModules
JM 08/09 - ScalaModulesJM 08/09 - ScalaModules
JM 08/09 - ScalaModules
 
JAX 09 - OSGi on Scala
JAX 09 - OSGi on ScalaJAX 09 - OSGi on Scala
JAX 09 - OSGi on Scala
 
JAX 08 - Agile RCP
JAX 08 - Agile RCPJAX 08 - Agile RCP
JAX 08 - Agile RCP
 
Eclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by ContractEclipse Magazin 12 - Design by Contract
Eclipse Magazin 12 - Design by Contract
 
JUGM 07 - AspectJ
JUGM 07 - AspectJJUGM 07 - AspectJ
JUGM 07 - AspectJ
 
Eclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der DreiEclipse Magazin 16 - Die Stärke der Drei
Eclipse Magazin 16 - Die Stärke der Drei
 
Eclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance LoggingEclipse Magazin15 - Performance Logging
Eclipse Magazin15 - Performance Logging
 
Eclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on EquinoxEclipse Magazin 14 - Getting hooked on Equinox
Eclipse Magazin 14 - Getting hooked on Equinox
 
Eclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matterEclipse Magazin 12 - Security does matter
Eclipse Magazin 12 - Security does matter
 
EclipseCon 08 - Agile RCP
EclipseCon 08 - Agile RCPEclipseCon 08 - Agile RCP
EclipseCon 08 - Agile RCP
 
W-JAX 07 - AOP im Einsatz mit OSGi und RCP
W-JAX 07 - AOP im Einsatz mit OSGi und RCPW-JAX 07 - AOP im Einsatz mit OSGi und RCP
W-JAX 07 - AOP im Einsatz mit OSGi und RCP
 
W-JAX 08 - Declarative Services versus Spring Dynamic Modules
W-JAX 08 - Declarative Services versus Spring Dynamic ModulesW-JAX 08 - Declarative Services versus Spring Dynamic Modules
W-JAX 08 - Declarative Services versus Spring Dynamic Modules
 
JAX 08 - Experiences using Equinox Aspects in a real-world Project
JAX 08 - Experiences using Equinox Aspects in a real-world ProjectJAX 08 - Experiences using Equinox Aspects in a real-world Project
JAX 08 - Experiences using Equinox Aspects in a real-world Project
 

Kürzlich hochgeladen

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Kürzlich hochgeladen (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

OSGi DevCon Europe 09 - OSGi on Scala

  • 1. OSGi on Scala Ease OSGi development with a Scala DSL Heiko Seeberger © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 2009-06-22 Sonntag, 21. Juni 2009
  • 2. OSGi on Scala Why? • Scala is a great language • Runs on JVM & fully interoperable with Java • Object-functional programming style => Best of OO and FP • Scalable and flexible language => Domain Specific Languages • Let’s put OSGi on Scala to ease OSGi development © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 2 Sonntag, 21. Juni 2009
  • 3. OSGi on Scala ScalaModules • Scala DSL for OSGi • Ease service handling • Smooth ugly parts of the API, e.g. null references © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 3 Sonntag, 21. Juni 2009
  • 4. OSGi on Scala Live Demo Should I really dare? YES! © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 4 Sonntag, 21. Juni 2009
  • 5. OSGi on Scala Start Scala REPL with appropriate Classpath tmp$ scala -cp felix.jar:scalamodules-core-...jar:scalamodules-util-...jar Welcome to Scala version 2.7.5.final (Java HotSpot(TM) Client VM, Java 1.5.0_19). Type in expressions to have them evaluated. Type :help for more information. © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 5 Sonntag, 21. Juni 2009
  • 6. OSGi on Scala Import Felix and ScalaModules scala> import org.apache.felix.framework._ import org.apache.felix.framework._ scala> import org.scalamodules.core.RichBundleContext._ import org.scalamodules.core.RichBundleContext._ © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 6 Sonntag, 21. Juni 2009
  • 7. OSGi on Scala Start Felix and get BundleContext scala> val felix = new Felix(null) felix: org.apache.felix.framework.Felix = org.apache.felix.framework [0] scala> felix.start scala> val ctx = felix.getBundleContext ctx: org.osgi.framework.BundleContext = org...BundleContextImpl@d9367a © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 7 Sonntag, 21. Juni 2009
  • 8. OSGi on Scala Define a Service Interface and Object scala> trait Greeting { def hello: String } defined trait Greeting scala> val greeting = new Greeting { def hello = "Hello!" } greeting: java.lang.Object with Greeting = $anon$1@8ed249 © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 8 Sonntag, 21. Juni 2009
  • 9. OSGi on Scala Try to consume a Service scala> ctx getOne classOf[Greeting] andApply { _.hello } match { | case Some(s) => println(s) | case None => println("No Greeting service available!") | } No Greeting service available! © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 9 Sonntag, 21. Juni 2009
  • 10. OSGi on Scala Try to provide a Service with illegal Interface scala> ctx registers classOf[String] theService greeting <console>:13: error: value registers is not a member of org.osgi.framework.BundleContext ctx registers classOf[String] theService greeting ^ © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 10 Sonntag, 21. Juni 2009
  • 11. OSGi on Scala Provide a Service correctly scala> ctx registerAs classOf[Greeting] theService greeting res3: org.osgi.framework.ServiceRegistration = org...ServiceRegistrationImpl@ed63a3 © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 11 Sonntag, 21. Juni 2009
  • 12. OSGi on Scala Try to consume a Service once more scala> ctx getOne classOf[Greeting] andApply { _.hello } match { | case Some(s) => println(s) | case None => println("No Greeting service available!") | } Hello! © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 12 Sonntag, 21. Juni 2009
  • 13. OSGi on Scala What else can ScalaModules do? © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 13 Sonntag, 21. Juni 2009
  • 14. OSGi on Scala Provide a Service with Properties context registerAs classOf[Greeting] withProperties ("name" -> "welcome") theService greeting © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 14 Sonntag, 21. Juni 2009
  • 15. OSGi on Scala Consume multiple Service applying a Filter context getMany classOf[Greeting] withFilter "(name=*)" andApply { _.welcome } match { case None => noGreetingService() case Some(welcomes) => welcomes.foreach { println } } © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 15 Sonntag, 21. Juni 2009
  • 16. OSGi on Scala Track Services context track classOf[Greeting] on { case Adding(greeting, _) => println("Adding Greeting: " + greeting.welcome) case Removed(greeting, _) => println("Removed Greeting: " + greeting.goodbye) } © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 16 Sonntag, 21. Juni 2009
  • 17. OSGi on Scala Service Dependencies context registerAs classOf[Command] dependOn classOf[Greeting] theService { greeting => new Command { ... } } © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 17 Sonntag, 21. Juni 2009
  • 18. OSGi on Scala And much more ... © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 18 Sonntag, 21. Juni 2009
  • 19. OSGi on Scala How to get started? • www.scalamodules.org • Wiki / Getting Started • Reference Guide • Contact: seeberger@weiglewilczek.com © 2009 WeigleWilczek. Released under the Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Germany License. 19 Sonntag, 21. Juni 2009