Java EE and Glassfish

download Java EE and Glassfish

If you can't read please download the document

Transcript of Java EE and Glassfish

  • 1. GlassFish and the Future of Java EE Carol McDonald Java Architect Sun Microsystems, Inc. 1

2. Agenda Java EE 5 Overview GlassFish v2 Today Java EE 6 and Future GlassFish v3 The Future Summary and Resources 3. History of Enterprise JavaEase of Development 6 Java EE 5WebEase of Services 5 DevelopmentJ2EE 1.4 Annotations`Web Services, EJB 3.0 4Robustness Management, Persistence APIEnterprise Java J2EE 1.3 Deployment, New and PlatformUpdated 3 CMP,Async. Connector Web Services Connector J2EE 1.2 Architecture JavaServer Faces 2Servlet, JSP, EJB, JMS 1 JPE RMI/IIOPProject 0 May 1998Dec 1999 Sept 2001 Nov 2003March 2005 4. Java EE 5 Overview 5. Java EE 5.0 SummaryHow is it easier?J2EE 1.4 Java EE Deployment Java language descriptorsannotations @ Required container Plain Old Java interfaces Objects (POJOs) JNDI Lookups DependencyInjection Deployment descriptor, interfaces More and betterdefaults No Supported UI FrameworkJava Server Faces(JSF) 6. Catalog Sample Java EE ApplicationRegistration Application Managed BeanEntity ClassItemDB ManagedBean Catalog Session BeanJSF Components 7. Entity Classes Use JPA to map/retrieve data from the database as Java Object ItemID NAMEDESC URL @Entitypublic class Item {@Idint id;String name;String descr;String url;} 8. Catalog Statelesst eSession EJB, JPA Query e p e n d e n c yS t a l e s s S e s s io n DIn j e c t io nB e a n A n n o t a t io n@Stateless public class Catalog implements CatalogService { @PersistenceContext(unitName=PetCatalogPu) EntityManager em;@TransactionAttribute(NOT_SUPPORTED)public List getItems(int firstItem,int batchSize) {Query q = em.createQuery ("select i from Item as i");q.setMaxResults(batchSize);q.setFirstResult(firstItem);List items= q.getResultList();return items;} } 9. Catalog Sample Java EE ApplicationRegistration Application Managed BeanEntity ClassItemDB ManagedBean Catalog Session BeanJSF Components 10. Managed Bean: ItemControllerpublic class ItemController { D e p e n d e n c y In j e c t io nprivate DataModel model;private int batchSize = 10;private int firstItem = 0;@EJB private CatalogService catalog; public DataModel getItems() { model = new ListDataModel( catalog.getItems( firstItem,batchSize);return model;}... 11. list.jsp Page ... ... 12. Glassfish and MySQL Part 2 13. Demo Netbeans 6.5 JPA entity JSF pages generation from DB tables 14. Java EE 5 WebServices 15. Catalog Sample JAX-WS ApplicationRegistration Application Managed Bean Entity ClassItem DBSOAPManagedBean Catalog EJB Web ServiceWeb ServiceJSF Components Client 16. Catalog EJB Web Service @WebService @Stateless public class Catalog implements CatalogServicepublic List getItems{... } } public methods become web service operations WSDL/Schema generated at deploy time automatically 17. D e p e n d e n c y In j e c t io n Web Service Client public class ItemController {@WebServiceRef(wsdlLocation="http://host/Catalog/Service?wsdl")private CatalogService service;public DataModel getItems() { // Call Web Service Operation service.Catalog port = service.getCatalogPort(); List result = port.getItems(first, size); return new ListDataModel(result); } } 18. Glassfish and MySQL Part 3 19. Demo Netbeans 6.5 Glassfish v2 JAX-WS 20. RESTful Web Services with JAX-RS (JavaEE 6 but in Glassfish v2) 21. RESTful CatalogRIA App RESTDataBase Registration Application Persistence-tierWeb ServicesJAX-RS classEntity ClassItem DB HTTPItemsConverterItemsResourceJAXB classJavaFX 22. RESTful Catalog Web ServiceHTTP GEThttp://petstore/catalog/resources/items/ Ad d re s s a b l e ClientRe s o u rc e s Response XML items Server We b C o n t a in e rhttp://host/catalog/images/anthony.jpgFriendly Cat307.10feline01 23. JAX-RS: Clear mapping to REST concepts High level, Declarative Uses @ annotation in POJOs Resources: what are the URIs? @Path("/items/{id}") Methods: what are the HTTP methods?@GETpublic XXX find() Representations: what are the formats? @Consumes("application/xml") @Produces("application/json") 24. RESTful Catalog Items Resource retrieves updates a collection of Item entities/items URI for a list of ItemsRegistration Application Item resource retrieves or updates one Item entity/item/1 URI for item 1JAX-RS class Entity ClassItem DBHTTP ItemsConverter ItemsResourceJAXB classJavaFX 25. Get Items resourceresponds to the URI http://host/catalog/items/ @Path("/items/")method public class ItemsResource { responds to HTTP GETRepresentation @GET @Produces("application/json")responds with JSON public ItemsConverter get(){ return new ItemsConverter(getEntities());}Performs JPAQuery, returns listof entities 26. Glassfish and MySQL Part 4 27. Demo Netbeans 6.5 Glassfish v2 JAX-RS 28. GlassFish V2 29. What is GlassFish ? Its a A Community Users, Partners, Testers, Developers, ... Started in 2005 on java.net Application Server Enterprise Quality and Open Source (CDDL & GPL v2) Java EE 5 v2 Java EE 6 v3 Full Commercial Support from Sun 30. Timeline of Project GlassFishTomcat Jasper Catalinav3JSTLStrutsv1 v2 Preludev3 GlassFish CrimsonUR1 UR2Launchv2.1 XSLTCXalan XercesJAXBJuneMaySept.Nov Dec Mid-2009 JAX-RPC 20052006 2007 2008 2008JSF 31. GlassFish Adoption 8M million downloads in the last year 150k registrations in 7 months Dozens of external committers Active Usage Over 7,000 members2000000 Strong and growing partner 18000001600000 ecosystem140000012000001000000 800000 600000 400000 2000000Fe Ma Ap Ma Ju Jul Au Se Oc No De Jab r r y n 07 g p t v c n07 07 07 07 07 07 07 07 07 07 08 32. GlassFish V2 Features 33. GlassFish v2: Web-based Administration 34. GlassFish v2 for Enterprises Management & MonitoringGraphical, command-line, tools, ANT ... JMX and Centralized Call Flow Self-management Diagnostic reports 35. GlassFish v2 for Enterprises Management & MonitoringGraphical, command-line, tools, ANT ... JMX and Centralized Call Flow Self-management Diagnostic reports 36. Ease-of-use Update Center 37. SPECjAppServer 2004 Results Best-In-Class Performance1000 900SPECjAppServer 800 700? 600 500 July 2007 Record setting performance400 300 20010% faster than BEA WebLogic 9.2 on identical 100server0 Sun BEA IBM JBos Fastest complete open source resultGlassFish v2, OpenSolaris, Java 6, PostgreSQ Best Price Performance Ever 2% cost of Dell, 5% cost of HP (Oracle) 13 times better price/performance 38. Web Services SOAP, Security, Reliability .NET interoperability CommonsSMTPSecurityReliability Transactions ...SpringJSONSOAP WSDL HTTP Web Services Core JAXB JAXPSAAJ ...XML Processing Metro GlassFish Web Services Stackmetro.dev.java.net 39. Dynamic Languages & Frameworks Ajax Framework http://glassfish-scripting.dev.java.netjMaki 40. GlassFish v2: IDE Support 41. Clustering And Load BalancingHTTP(S) JMSRMI/IIOPRuntimeClusterMessage Routing / Failover / Load Balancing member discovery &health Management monitoring AS ASAS AS AS AS Instances Clustered through. . . AS ShoalNode ANode BNode C HA Application State Repository 42. Memory Replication for High AvailabilityExample: MaximizeAvailability on 4 instanceTypical cluster topologycluster on 2nodes(machines) Instance 1 Instance 2 Instance 3 Instance 4 Machine 1Machine 2 43. Comet: the server pushes data to the client over along-lived HTTP connection GlassFish supports CometServerClientClient1 2 44. Ajax Push and HTTP keep-aliveComet: server pushes data to the client over a previously opened connectionHTTP/1.1 Keep-Alive or Persistent Connection: keeps connection open until message or timeoutLong Poll: Send a request to the server, request waits for an event, then response sent 45. GlassFish Grizzly CometNIO: non-blocking socketsARP Asynchronous Request Processing: Doesn't block a thread per http request availability of threads gives scalability 46. Demo Comet Slide Show Allows creation of event-driven web application which are hosted in browser 47. RESTful Web Services and Comet http://developers.sun.com/appserver/reference/techart/cometslideshow.html 48. GlassFish Eco-System 49. OpenESB JBI support OpenESB 2.0 Install, admin, and monitoring integrated in GlassFish v2 Basis for Java CAPS Release 6 Tools support NetBeans SOA 6.0Service Engines Binding Components Many components available from https://open-esb.dev.java.net/Components.html 50. Extended GlassFish: OpenSSO Open SSO: Single Sign On Web Access Identity Federation Management 51. Extended GlassFishOpenPortal Standards: Portlets (2.0), Web Services for Remote Portlets, Identity: OpenSSO https://portal.dev.java.net/OpenDS 100% Java LDAPv3 Directory Service https://opends.dev.java.net/ 52. The SailFin Project Bridging the HTTP and SIP protocols Ericsson SIP Servlet Contribution is available at: http://sailfin.dev.java.net Visit, Download, Try, Join Milestone 1 available Built on GlassFish v2 53. (Some) Distributions & ContributorsJava EE SDKGlassFishEnterpriseDerbyMQProject GlassFish Portal ServerOpen ESB Users and Other Groups 54. Frameworks and Applications Quercus PHPOSWorkFlow OSCacheIntegration ORBProject Tango Apache HttpdCJUG-ClassifiedsBIRT jBPM DOJO FaceletsMyFaces ADFShaleSiteMesh WebDAV JSPwikiSEAM Tapestry MC4JStringBeans PortalAJAX BlogTraderWicket Equinox Java WSDPDalmaWebSphere MQ EHCache 55. GlassFish Deployment blogs.sun.com/stories 56. GlassFish Partners Targeted at ISVs, Hosting partners & Other solution providers Profile in Partner Showcase Banner Advertising on GlassFish community and blogs Training Discounts Requirements Customer-ready support for GlassFish Associate-level member in SPA 57. Java EE 6 and Future 58. Java EE Timeline Profiles Java EE 6EJB LiteEase ofRestful WSDevelopmentWeb BeansJava EE 5 Extensibility WebEase ofServicesDevelopment J2EE 1.4 Annotations `Web Services, Robustness EJB 3.0Management, Persistence API Enterprise Java J2EE 1.3 Deployment, New andPlatformCMP,Async.UpdatedConnectorJ2EE 1.2Connector Web ServicesJava EE 6 Servlet, JSP, Architecture Web ProfileJPE EJB, JMS ProjectRMI/IIOP 59. Major new Features in Java EE 6Profilestargeted bundles of technologies1st profile is the Web profile Pruningolder technologies optionalCMP, JAX-RPC... ExtensibilityZero-configuration, drag-and-drop for webframeworks Ease of development 60. Full JSRs Java EE 6EJB 3.1JPA 2.0 New Features Servlet 3.0 Profiles JSF 2.0 PruningJAX-RS 1.0 ExtensibilityConnector 1.6 More ease of development Bean Validation 1.0Web BeansMaintenance JSRsJAXB 2.2JAX-WS 2.2JSR-109 1.3EL 1.2JSP 1.2Authentication SPI 1.1Common Annotations 1.1 61. Ease Of Development Ongoing concern focus is the web tier General principles:Annotation-based programming modelweb.xml not requiredSelf-registration of third-party librariesSimplified packaging 62. Web Profile Servlet 3.0, JSP 2.1, JSR-45 (Debugging), EL 1.2, JSTL 1.2, JSF 2.0 EJB Lite 3.1, JTA 1.1, JPA 2.0, JSR-250 (Annotations) 63. EJB Lite Small subset of EJB 3.1 API for use in Web ProfileLiteLocal Session BeansAlso requires JPA 2.0 /JTA 1.1 API 64. Simplified Packaging EJB components can be packaged directly inside a web application archive (war file) 65. Some Servlet 3.0 Highlights Annotation-based programming model@WebServlet @ServletFilter etc. Async APIsUseful for Comet, chat rooms, long waits 66. Some JavaServer Faces 2.0 Features custom components easier to develop Ajax support Html templates (Facelets) Reduce configuration Bookmarkable URLs 67. Some EJB 3.1 Highlights Singleton beans: @Singleton No interface view: one source file per bean Calendar timers:@Schedule(dayOfWeek=Mon,Wed)Async business methods: @Asynchronous Simplified testing (embeddable test outsidecontainer) 68. Session Bean with Local Business Interface...OLD...HelloBean Client< com.acme.Hello @EJB String sayHello()private Hello h;... h.sayHello();com.acme.HelloBeanpublic StringsayHello() { ...} 69. Session Bean with no Interface @Stateless public class HelloBean {public String sayHello(String msg) { return Hello + msg; }} 70. no Interface client...NEW... @EJB HelloBean h; ... h.sayHello(bob); 71. Timeline June 2007 Expert group formed Q3 2008 Public draft Q4 2008 Proposed final draft Q2 2009 Final release 72. GlassFish V3 The Future 73. GlassFish v3 Java EE 5 = GlassFish v2 GlassFish v2.1: better, faster, more scalable GlassFish v3 PreludeWeb Tier Only, OSGi Based, some EE 6 previewsEclipseLink (JPA) BundledMultiple Containers (jRuby, Groovy, Phobos) GlassFish v3 = Java EE 6 Work in Progress OSGi Based All have Netbeans and Eclipse Integration 74. What's new in V3 ModularityOSGi runtime (Apache Felix)Lightweight, Fast StartUp, Scalable Service based architectureservices are defined by contracts and can beeasily substitutedlazy loading based on usage patterns Extensible not limited to traditional Java EE containers EmbeddableRuns in-VM 75. GlassFish v3JavaEE 6 and Frameworks All JVM-Scripting Languages small to HA to Communication to Grid Preview available today 76. GlassFish v3 ArchitecturePortletGroovyJRuby OpenMQOpenESBOpenSSO ContainerJMSWeb ConnectionJava Container JSFPooling (JCA)Metro EJB ContainerPersistence Management ConsoleUpdate Center Management CLINamingGrizzly FrameworkMonitoring/Injection Configuration Serviceability/Service Manager LoggingGlassFish V3 Core Security(Module Subsystem) TransactionDeploymentClustering ManagementServiceOSGiNetBeansJava SE JavaWebStart 77. GlassFish v3 Runtime GlassFish v3 is an OSGi application GFv3 is de-composed into a set of modules Modules are run inside OSGi container (Apache Felix) user-definedWebtier EJB ScriptingJCAPS modulesuser-defined modulesGlassFish Kernel(HK2, API, etc.) Felix runtime 78. Compile/Deploy on Change Java EE development doesn't have to be painful Incremental compile of all Java EE artifacts Auto-deploy of all Java EE and static artifacts Session retention: maintain stateful sessions across re- deployments 79. v3 Prelude Usage xWikiGlassFishV3 Project Fuji JavaDB SailFin (OpenESB.next) (Telco AppServer)WebSynergy(Portal, Liferay)EHCache Server WebEngine GlassFish v3 EmbeddedGlassFish v3 Embedded Jersey Jersey 80. Yes, Eclipse too ! GlassFish (v2/v3) + Eclipse 3.4 Tools Bundle: http://download.java.net/glassfish/eclipse/ 81. GlassFish v3 Roadmap V3 Prelude Today!V3 Final aligned with Java EE 6 Starting a series of Milestone releases Targeted for Fall 2009 Clustering, central admin likely on the update centerV3.1 full clustering Likely 6 to 9 months after V3 82. Summary and Resources 83. Reference http://glassfish.org http://blogs.sun.com/theaquarium http://blogs.sun.com/stories http://blogs.sun.com/glassfishforbusiness http://wiki.glassfish.java.net Carol's Bloghttp://weblogs.java.net/blog/caroljmcdonald/ Fast, Easy & Reliable Modular, Embedable, Extensible 84. @ su n. co m Carol McDonaldJava Architecthttp://weblogs.java.net/blog/caroljmcdonald/84