14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

Embed Size (px)

Citation preview

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    1/18

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    2/18

    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

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    3/18

    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 Intereropability

    Current Release: 2.1

    GlassFish v3

    Java EE 6 Reference Implementation Modular (OSGi), Embeddable, Extensible

    Java EE, Rails, Grails, Django, ...

    Current Release: v3 Prelude

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    4/18

    Sun GlassFish Enterprise Server

    Customer FocusedCustomer Focused

    Support TeamSupport Team

    Patches &Patches &

    UpgradesUpgrades

    24x7 Support24x7 Support

    CustomerCustomer

    AdvocateAdvocate

    Sun VIPSun VIP

    InteroperabilityInteroperability

    SupportSupport

    GlassFishGlassFish

    Open SourceOpen Source

    Application ServerApplication Server

    Enterprise ManagerEnterprise Manager

    eLearningeLearningCreditCredit

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    5/18

    Demo: JDBC Connection Pool &

    Resource creation usingAdministration Console

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    6/18

    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 aDatabase

    Common Persistence Providers:

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

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    7/18

    JPA Sample

    @Entity class Employee {

    @Idprivate int id;

    private String firstName;

    private String lastName;

    pubic Employee (int id,

    String firstName,

    String lastName) {

    ...

    }

    public String getFullName(){

    return firstName + lastName;}

    ...

    }

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    8/18

    Demo: CRUD operations using

    NetBeans, JPA, andGlassFish

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    9/18

    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

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    10/18

    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;

    }

    }

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    11/18

    Demo: Publish your MySQL Tableas a RESTful Web service

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    12/18

    Dynamic Languages andWeb Frameworks

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

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    13/18

    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) modules atUpdate Center

    Commercially supported by Sun

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    14/18

    Demo: Develop, Deploy, and Debug

    Rails application usingNetBeans and GlassFish

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    15/18

    GlassFish Web StackComplete Web Tier

    Sun Web Server

    Apache HTTPd

    GlassFish

    Lighttpd

    Memcached

    Mod_jk,perl, ruby

    PHP, Ruby, Python

    Squid, TomcatMediaWiki, Drupal, Wordpress,Joomla deploy in minutes!

    http://www.sun.com/software/products/glassfish_portfolio/

    BoF: TBD

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    16/18

    Price PerformanceSpecjAppServer2004 (Nov 2008)

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

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

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    17/18

    Why GlassFish and MySQL ?

    Same pricing strategy per server, unlimited Same support levels Gold, Silver, ...

    Same support organization No buckpassing

    Combined reference architectures MySQL cluster and Sailfin: http://www.sun.com/offers/details/mysql_cg_service_execution.html

  • 8/7/2019 14603848-Creating-Quick-and-Powerful-Web-Applications-with-MySQL-GlassFish-and-NetBeans

    18/18

    References

    GlassFish

    http://glassfish.org

    http://blogs.sun.com/theaquarium

    NetBeanshttp://netbeans.org

    http://planetnetbeans.org/

    http://blogs.sun.com/arungupta