glassfish - fisl10 - arun gupta

26
1 Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse Arun Gupta, GlassFish Guy http://blogs.sun.com/arungupta Sun Microsystems, Inc. 1

Upload: dudulima

Post on 15-Jan-2015

1.960 views

Category:

Technology


0 download

DESCRIPTION

Creating quick and powerful web applications with MySQL, GlassFish and Netbeans

TRANSCRIPT

Page 1: Glassfish - FISL10 - Arun Gupta

1

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse

Arun Gupta, GlassFish Guyhttp://blogs.sun.com/arunguptaSun Microsystems, Inc.

1

Page 2: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 2

Who is Arun ?

• GlassFish Guy• With Sun for over 10 years• Specifications, Engineering, Standards,Interoperability, ...

> blogs.sun.com/arungupta> twitter.com/arungupta

Page 3: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 3

What is GlassFish ?

• Open Source Community> Users, Partners, Testers, Developers, ...> Started in 2005 on java.net

• Application Server> Java EE 5 and 6 Reference Implementation> Enterprise Quality and Open Source> Full Commercial Support from Sun

Page 4: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 4

State of GlassFish

• GlassFish v2> Java EE 5 Reference Implementation> Clustering, Load Balancing, High Availability> Web-based/CLI Administration Console> .NET 3.x/4.x Web services Interoperability> Current Release: 2.1

• GlassFish v3> Java EE 6 Reference Implementation> Modular (OSGi), Embeddable, Extensible> Java EE, Rails, Grails, Django, ...> Current Release: v3 Preview

Page 5: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 5

Sun GlassFish Enterprise Server

GlassFishGlassFishOpen SourceOpen SourceApplication ServerApplication Server

Customer FocusedCustomer FocusedSupport TeamSupport Team

Patches &Patches &UpgradesUpgrades

24x7 Support24x7 Support

CustomerCustomerAdvocateAdvocate

Sun VIPSun VIPInteroperabilityInteroperabilitySupportSupport

Enterprise ManagerEnterprise Manager

eLearningeLearningCreditCredit

Page 6: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 6

Demo: JDBC Connection Pool & Resource creation using Administration Console

Page 7: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 7

Java Persistence API

• Java specification that defines Object to Relational Mapping in Java EE 5

• Annotations to persist POJOs• JPQL to query objects from the database

>MySQL-specific query statements (LIMIT)• Requires a Persistence Provider and a

Database>Common Persistence Providers:

TopLinkEssentials, EclipseLink JPA, ...>Common Databases: MySQL, Oracle, ...

Page 8: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 8

JPA Sample@Entity class Employee {

@Id private int id;

private String firstName; private String lastName;

pubic Employee (int id, String firstName, String lastName) {

...

}

public String getFullName(){return firstName + lastName;

}

...

}

Page 9: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 9

Demo: CRUD operations using NetBeans, JPA, and GlassFish

http://blogs.sun.com/arungupta/entry/totd_38_creating_a_mysql

Page 10: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 10

RESTful Web Services

• JAX-RS: Java API for RESTful Web services• Annotation-based server-side API• HTTP Centric• Jersey: Reference Implementation of JAX-RS• Also provides client-side API• jersey.dev.java.net

Page 11: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 11

JAX-RS Sample@Path("widgets/{id}")@Produces("application/widgets+xml")@Consumes("application/widgets+xml")public class WidgetResource {

private Widget w;

public WidgetResource(@PathParam("id") String id) { this.w = locateRecord(id); }

@GET Widget getWidget() { return w; }

@PUT Widget updateWidget(Widget update) { w = processUpdate(update); return w; }

}

Page 12: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 12

GET /NetBeans/6.5

Page 13: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 13

Demo: Publish your MySQL Table as a RESTful Web service

http://blogs.sun.com/arungupta/entry/restful_representation_of_sakila_using

Page 14: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 14

Dynamic Languages andWeb Frameworks

http://glassfish-scripting.dev.java.net

Page 15: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 15

Rails on GlassFish

• Native Deployment, no packaging required> GlassFish v3> Capistrano recipes available> Server runtime available as Gem

• WAR deployment using Warbler> GlassFish v2 and v3

• JRuby/Rails (Groovy/Grails, Django/Jython) modules at Update Center

• Commercially supported by Sun

Page 16: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 16

Tooling

• NetBeans support> Develop, deploy debug

Page 17: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 17

Demo: Develop, Deploy, and Debug Rails application using NetBeans and GlassFish

http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug

Page 18: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 18

GlassFish v3 Monitoring

• Event-driven light-weight and non-intrusive monitoring• Modules provide domain specific probes (monitoring

events)> EJB, Web, Connector, JPA, Jersey, Orb

• Monitoring data gathered on demand• End-to-end monitoring on Solaris platforms using DTrace• Equivalent functionality for GlassFish on other platforms

(including Solaris) using scripting languages> JavaScript to start with

Page 19: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 19

Demo: End-to-End Application Tracing using NetBeans, GlassFish, MySQL, OpenSolaris, DTrace

Page 20: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 20

GlassFish Tools Bundle for Eclipse

Page 21: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 21

GlassFish Tools Bundle – Key Features

• Out-of-the-box installer with all Java EE Eclipse Standard Features, JDK and GlassFish servers

• GlassFish Registration Wizard• GlassFish v2.1 and v3 automatic domain

creation/configuration• JavaDB configuration, JDBC resource wizard• Start, Stop, Deploy, Undeploy, Debug JSP/Java• Deploy on Save: Default for v3• HTTP Monitoring preconfigured

Page 22: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 22

More Features ...

• All Sun DTDs registered for validation/code completion• All Java EE APIs registered for code

completion/Javadocs• GlassFish log integrated into Eclipse IDE console• All v2 and v3 DocBooks integrated in Help• GlassFish Web Properties in Help menu (The Aquarium,

Support, ...)• ...• Download: http://download.java.net/glassfish/eclipse

Page 23: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 23

Demo: GlassFish Tools Bundle for Eclipse

http://blogs.sun.com/arungupta/entry/screencast_26_develop_run_debug

Page 24: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 24

Price PerformanceSpecjAppServer2004 (Nov 2008)

• 2% cost of Dell, 5% cost of HP• 13 times better price/performance

http://www.sun.com/servers/x64/x4150/benchmarks.jsp#3

Page 25: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 25

Why GlassFish and MySQL ?

• Same pricing strategy – per server, unlimited• Same support levels – Gold, Silver, ...• Same support organization – No buck passing• Combined reference architectures

> MySQL cluster and Sailfin: http://www.sun.com/offers/details/mysql_cg_service_execution.html

Page 26: Glassfish - FISL10 - Arun Gupta

Creating Quick and Powerful Web Applications with MySQL, GlassFish, and NetBeans/Eclipse 26

References

• GlassFish> http://glassfish.org> http://blogs.sun.com/theaquarium_br

• NetBeans> http://netbeans.org> http://planetnetbeans.org/

• Eclipse: http://download.java.net/glasfish/eclipse• MySQL: http://mysql.org• http://blogs.sun.com/arungupta