GlassFish Developing an Application Server in Open Source Santiago Pericas-Geertsen Sun Microsystems, Inc. http://weblogs.java.net/blog/spericas/ Santiago.PericasGeertsen@sun.com 1 1
Who am I? BA from ITBA MA and PhD from Boston University With Sun for over 6 years Part of Glassfish team > Worked on numerous projects: XSLTC (XSLT Compiler in JDK), JAXP, Fast Web Services, Fast Infoset, JAX-WS, XML Performance, Japex, MEP,... > Currently tech lead of JAXP and MEP product 2
Part I - Glassfish Application Server and Community 3
What is GlassFish? A Community > Users, Partners, Testers, Developers,... > Started in 2005 on java.net Application Server (version 2) > Enterprise Quality and Open Source (CDDL & GPL v2) > Java EE 5 Reference Implementation > Full Commercial Support from Sun Growing organically into other Middleware Areas Leverages Sun's experience in other Java, Middleware, SDK Key part of Sun's Open Source Business Model 4
Glassfish Ecosystem Java EE RI & SDK Sun GlassFishJava EE RI & SDK Enterprise Server 2.x Derby MQ Project GlassFish Open Data Sync Sailfin Portal Server Open ESB Users and Other Groups 5
Frameworks and Applications Quercus PHP OSWorkFlow OSCache Integration ORB Apache Httpd DOJO Facelets Shale Project Tango CJUG-Classifieds BIRT MyFaces ADF SiteMesh JSPwiki SEAM MC4J jbpm WebDAV Tapestry AJAX StringBeans Portal BlogTrader Wicket Equinox Java WSDP WebSphere MQ Dalma EHCache6
GlassFish v2 Features Java EE 5 compliant Metro:.NET 3.0 web services interoperability Clustering Architecture Support for scripting languages Modular and ultra fast web tier Seamless IDE and tools integration > NetBeans, Eclipse, IntelliJ, Ant, Maven Support for the latest technologies (e.g., JAX-RS) Available as subscription or paid product 7
Java EE 5 = (J2EE 1.4).next Java EE 5 Theme: Ease of Development POJO-based programming > More freedom, fewer requirements Extensive use of annotations > Reduced need for deployment descriptors > Annotations are the default Resource Injection New APIs and frameworks 8
.NET Interoperability using Metro High level web services stack Fully interoperable with.net 3.0 Security, Reliability and Transactions Fully integrated into Netbeans 9
Metro Overview (.NET Interop) Security Reliability Transactions SOAP... HTTP WSDL Web Services Core JAXB JAXP SAAJ... XML Processing Metro GlassFish Web Services Stack metro.dev.java.net 10
Clustering Architecture Enhances scalability and availability > Transparent failures > Ability to add more nodes to cluster Runtime view of cluster > Router/Failover/Load Balancing module > Management module > Application state repository (ring configuration) 11
Clustering Architecture HTTP(S) JMS RMI/IIOP AS AS Node A AS AS Node B... AS AS AS Node C Clustered Instances Management Message Routing / Failover / Load Balancing HA Application State Repository 12
Ajax and Scripting Activities Dynamic Languages > glassfish-scripting.dev.java.net jmaki - http://ajax.dev.java.net > Very easily encapsulates Ajax widgets DynaFaces - http://jsf-extensions.dev.java.net > Ajax and JavaServer Faces 13
Web Tier JSP Container > 10x perf. improvement in JSP compilation (JSR-199) Grizzly > Easy-to-use, highly scalable and customizable HTTP Framework > Based on java.nio > Integrates with current Apache Tomcat HTTP Connector 14
World Record Performance SpecjAppServer 2004 SPECjAppServer 2004 Results 900 800 > July 2007: #1 score on T2000 > 883.66 JOPS@Standard for GlassFish v2 > Improved in areas not covered by benchmark > 10% faster than BEA WebLogic > 30% faster than IBM WebSphere 6.1 700 600? 500 400 300 200 100 0 Sun BEA IBM JBoss Disclaimers: SPEC and the benchmark name SPECjAppServer 2004 are registered trademarks of the Standard Performance Evaluation Corporation. Competitive benchmark results stated above reflect results published on www.spec.org as of 11/21/07. The comparison presented is based on GlassFish v2 UR1 run on 6 Sun SPARC Enterprise T5120 (1 chip, 8 cores/chip, 8 threads/core) 1.4GHz 8,439.36 SPECjAppServer2004 JOPS@Standard. For the latest SPECjAppServer 2004 benchmark results, visit http://www.spec.org/. 15
GlassFish Adoption Millions of downloads Dozens of external committers Over 8,000 members Excellent analyst reviews > Gartner, Forrester, etc... 16
Some Adoption Indicators 2.5m+ hits in 13 months 310k+ different IPs 150k registrations in 7 months 4.5m+ downloads in 12 months 17
After this Presentation... 18
Who else is using GlassFish... 19
GlassFish Deployment blogs.sun.com/stories 20
How to Save 3 Million Dollars? 21
So Why GlassFish? Java EE 5 (vs. Tomcat, JBoss, Websphere) Performance! (vs. JBoss) Administration (vs. JBoss, Tomcat) Enterprise-ready (vs. JBoss, Tomcat) Enterprise support (vs. Tomcat) Ecosystem: OpenSSO, OpenESB, etc... Community (vs. Weblogic, Websphere) Enterprise Features at Open Source price! 22
Reference http://glassfish.org http://blogs.sun.com/theaquarium http://blogs.sun.com/stories http://blogs.sun.com/glassfishforbusiness http://wiki.glassfish.java.net Fast, Easy & Reliable Modular, Embedable, Extensible 23
Part II Technology Highlight JAX-RS and Jersey 24
Introduction to REST Give everything an ID Link things together Use standard methods (HTTP) Allow for multiple representations Stateless communications 25
Give Everything an ID ID is a URI > http://mycompany.com/customers/corporationx > http://mycompany.com/products/125 > http://mycompany.com/orders/5455 26
Link Things Together Customer order #5455 <order self="http://mycompany.com/orders/5455"> <customer ref="http://mycompany.com/customers/corporationx"/> <product ref="http://mycompany.com/products/125"/> <amount value="3"/> </order> New identifiers are created http://mycompany.com/orders/5455/customer http://mycompany.com/orders/5455/product 27
Use Standard Methods Method Purpose GET Read, possibly cached POST Create without a known ID PUT Update or create with a known ID DELETE Remove 28
Multiple Representations Offer data in a variety of formats > XML > JSON > (X)HTML Maximize reach Support content negotiation > Accept header GET /foo Accept: application/json > URI-based GET /foo.json 29
Stateless Communications Long lived identifiers Avoid sessions Self-contained requests 30
REST using JAX-RS Operations such as, GET http://mycompany.com/orders/5455 PUT http://mycompany.com/customers/corporationx are mapped to resource class methods Mapping is controlled using Java annotations Resource classes are deployed as web applications in Glassfish 31
Example Using JAX-RS @Path("orders/{order_id}") public class OrderResource { @GET @ProduceMime( application/xml ) String getorder( @PathParam("order_id") String id) { return <order>... </order> ; }... 32
Example Using JAX-RS (contd.) @GET @ProduceMime( application/html ) String getorderhtml( @PathParam("order_id") String id) { return <html><h1>order id: + id + </h1>...</html> ; } 33
Example Using JAX-RS (contd.) @Path( customer ) CustomerResource getcustomer( @PathParam("order_id") String id) { return new CustomerResource( getorder(id).getcustomer()); }... } 34
Conclusions Glassfish community is growing rapidly > And you should be part of it! World class performance and J2EE 5.0 compliance Glassfish v3 already under way All the latest technologies including RESTful web services are available in Glassfish and Netbeans Download and try it now! 35
Thank You Santiago Pericas-Geertsen Sun Microsystems, Inc. http://weblogs.java.net/blog/spericas/ Santiago.PericasGeertsen@sun.com 36