Getting Started with Eclipse RT
360 likes | 535 Vues
Getting Started with Eclipse RT. Shaun Smith Hugues Malphettes Greg Wilkins Doug Clarke . About Us. Hugues Malphettes Software engineer at Intalio Based in the Bay Area. Eclipse BPMN original committer Jetty and Orbit committer. Agenda. JPA in OSGi with EclipseLink
Getting Started with Eclipse RT
E N D
Presentation Transcript
Getting Started with Eclipse RT Shaun Smith Hugues Malphettes Greg Wilkins Doug Clarke
About Us • Hugues Malphettes • Software engineer at Intalio • Based in the Bay Area. • Eclipse BPMN original committer • Jetty and Orbit committer.
Agenda JPA in OSGi with EclipseLink Web-applications in OSGi with Jetty Show-down: JSF backed by JPA and run with Jetty purely with OSGi bundles.
Part I: JPA in OSGi with EclipseLink Shaun's slides
Part II: Web-applications in OSGi with Jetty Hugues Malphettes hmalphettes@intalio.com Greg Wilkins gregw@webtide.com
Jetty-OSGi: why Jetty Architecture Application Server? Software Component? Eclipse plugins are great: Development environment Run / Debug in place Complexity scales thanks to OSGi Back to J2EE? Asked to build a set of well integrated web-applications Required to support existing web-applications
Agenda: Jetty OSGi Web-Bundle: presentation and first demo Runtime environment Jetty-OSGi: Architecture Debugging a runtimeSlides and samples:http://www.intalio.org/public/maven2/org/intalio/osgi/eclipse-con/
Web-Bundle: presentation OSGi's RFC66 Bundle's internals coincide with a WAR/WEB-INF /web.xml /lib /classesindex.html… And with an OSGi manifest:/META-INF/MANIFEST.MF New header: WebContext-Path: /theContextPath
Jetty-OSGi Bootstrap jetty from an OSGi container Support for web-bundles RFC-66 style Support legacy J2EE applications
Web-Bundle: fast track Eclipse-3.6M6 PDE Install Jetty SDK: http://download.eclipse.org/jetty/nightly/jetty7/ Make a new OSGi project
Web-Bundle: fast track Choose the Plugin Template: “RFC66”
Web-Bundle: fast track Investigate the structure of the bundle and the headers in the MANIFEST.MF
Web-Bundle: fast track Right-click on the project and choose “Run As.../Jetty on OSGi.”
Web-Bundle: Fast Track Run / debug in place just like an eclipse plugin Hint: include the entire target platform to access all sources
Web-Bundle: the SDK is optional The SDK only helps with The project template The launch configuration When the SDK is not in place: org.eclipse.jetty.osgi.boot should be set to start -Djetty.home=path/to/jetty/home
Web-Bundle: Target Platform Use a target platform instead of the bundles defined in the eclipse installation Unzip jetty-osgi-min.zip Import the jettyhome-min project into the workspace
Web-Bundle: Target Platform Investigate the default jetty-home setup. The minimum target-platform consists ofjetty's jars, the servlet jar and the osgi jar. Run the web-bundle from PDE Using a standard OSGi launcher The web-bundle is started by default
Web-Bundle: Launch Configuration Jetty-OSGi SDK provides some additional UI
Runtime Export the web-bundle with the sources “Deploy” both the bundle and the source in the runtime:copy them in the plugins folder
Runtime Start on the command line: ./start.sh Try the runtime. 404. Type in the OSGi console “ss” Start the web-bundle if it is not Active.
Runtime Use the OSGi console and type 'services' look at the deployed web-app
Round trip back to PDE Back to PDE. Delete or rename the web-bundle. Import as project with sources the testbundle and org.eclipse.osgi
Round trip back to PDE Show the BundleLoader and put a system error there when the servlet is loaded.
Jetty OSGi: Architecture From J2EE to OSGi Supporting J2EE apps
Traditional J2EE webapp container Hierarchical classloader Each web-app lives in a safe silo decoupled from one other start.jar: bootstrap Shared libraries: lib/ext ... Web-application WEB-INF/lib WEB-INF/classes • Communication between webapps is hard • Share libraries with everyone or no one Web-application #2
Jetty Running inside OSGi Bootstrap Jetty from OSGi Support the Web-Bundles via the Web-Extender OSGI container Jetty bootstrapper Jetty bundles & dependencies Web-extender Web-Bundle
Web-Bundles OSGi benefits: Shared libraries Webapp starting order: Web-Bundle-3 starts before Web-Bundle-2 Logging Web-Bundle 1 Shared-A JPA Web-Bundle 2 Shared B Web-Bundle 3
Web-Bundle deployment Similar to the HttpService: bundleContext.register(ContextHandler.class.getName, …)a service tracker will deploy the corresponding Web-app Web-Bundle support via an extender:A BundleListener registers the ContextHandler service to deploy Web-Bundles. Examples: Custom service tracker to monitor webapps deployment Multiple webapps in a bunlde Custom path to the base resources for a webapp
Jetty in OSGi: supporting J2EE features Bootstrap Jetty from OSGi Setup the J2EE classloaders and traditional web-app deployers Setup the context-classloader during the execution of a webapp OSGI container Jetty bundles Jetty bootstrapper Optional Bundles: JSP, JSF, Central Logging Legacy shared libraries: lib/ext Legacy Web-application WEB-INF/lib WEB-INF/classes
Jetty in OSGi: complete picture OSGI container Jetty bundles Jetty bootstrap Optional Bundles: JSP, JSF, Central Logging Legacy shared libraries: lib/ext Web-Bundle Legacy Web-application WEB-INF/lib WEB-INF/classes
OSGi and J2EE OSGi bundle in PDE Execute in place Debug in place Thousands of plugins, no duplication Tight integration OSGi services: direct access to the objects Encapsulation Libraries and services provided by the platform vendor • J2EE • Build, deploy, execute • Remote debug • 100s of libraries often duplicated • Loosely coupled silos • Web-apps send messages to on another or use EJB Beans • Static layers confined by a hierarchical class-loader • Libraries and services provided by the app developer.
Jetty-OSGi default runtime Jetty-OSGi runtime package Similar to a standard jetty distribution Support for all the traditional J2EE features: Shared libraries Legacy J2EE webapps Central logging with slf4j and logback Jetty – JNDI, Policies... JSP-2.1 JSF: Sun's MyFaces (or Apache MyFaces) Examples: Jasig's CAS (spring web-flow), active-MQ's console ...
Part III: JSF webapp on Jetty with a JPA model with EclipseLink: 100% OSGi Demo
Next steps Manage multiple instances of jetty Contribute JSP and other dependencies to Orbit Refactor the jetty features Support for servlet-3 features: anotations etc Make sure Gemini can use jetty Work on tycho to build those web-bundles What would you like to see?
Q & A You can reach us on IRC@Freenode #jetty Thank you!