Speak Java in One Hour

Embed Size (px)

Citation preview

  • 8/12/2019 Speak Java in One Hour

    1/56

    1

    Speak Java in one hour

    An introduction in Java lingo

  • 8/12/2019 Speak Java in One Hour

    2/56

    2

    Wat is java?

    Programmeertaal

    Jvm

    Platform

    'Write Once, Run Anywhere'

  • 8/12/2019 Speak Java in One Hour

    3/56

    3

    Acronymen hel

    Java

    Struts

    JSFJ2EE

    ADFSeam

    WebSphere

    JSR

    Apache

    TopLink

    Hibernate

    JavaFX JDBC

    JVM

    JavaDoc

    Java ME

    Java EE

    Java SE

    NetBeans

    Swing

    EJB

    RMI

    GlassFish

    JMS

    JMX

    Spring

    Maven

    ant

    NetBeans

    Jre

    JavaDesktop

    Tomcat

    Velocity

    James Gosling

    JPA

    JAXB

    Trinidad

    MyFacesJDK

    JavaBeans

    JUnit

    Drools

    RichFaces

    WebLogic

    JBoss

    JSP

    Duke

    AcegiAOP

    Log4J

    Applet

    JAAS

    EL

    Servlet

    Groovy

    Stripes Tapestry

    Wicket

    Facelets

    AWT

    GWT

    CocoonIceFaces

    Java Web Start

    iBatis

    SDO

    Tuscany

    TestNg

    AMIS

    Lucene

    JDO

    POJO

    Ajax

    JCA

    IIOP

    JDom

    JAXP

    JAXB

    war

    ear

    JNDI

    SAAJ

    JAX-RPC

    SCA

    JSTL

    JIT

    JCP

  • 8/12/2019 Speak Java in One Hour

    4/56

    4

  • 8/12/2019 Speak Java in One Hour

    5/56

    5

    Java language

    Object orintatie

    POJO

    Plain Old Java Object

    properties

    methods

    Netwerk support

    Remoting

  • 8/12/2019 Speak Java in One Hour

    6/56

    6

    Example

    import java.net.*;

    import java.io.*;

    public class google {

    public static void main (String[] args) {

    try {

    String thisLine;

    URL u = new URL("http://www.google.com");

    DataInputStream theHTML = new DataInputStream(u.openStream());

    while ((thisLine = theHTML.readLine()) != null) {

    System.out.println(thisLine);

    }

    } catch (MalformedURLException e) {

    System.err.println(e);

    } catch (IOException e) {

    System.err.println(e);}

    }

    }

  • 8/12/2019 Speak Java in One Hour

    7/56

    7

    .java .class

    jvm

    OS

    compiler

    jit compilation

    platform / libraries

    bytecode

  • 8/12/2019 Speak Java in One Hour

    8/56

    8

    IDE

    Code completion

    Syntax Highlighting

    Wizards Documentation

    Refactoring

    Unittest support

    Delivery support

    Compilation

    Classpath organization

    ...

    Eclipse

    WSAD

    JDeveloper

    IntelliJ IDEA

    NetBeans WebLogic Workshop

    [Notepad]

    ...

  • 8/12/2019 Speak Java in One Hour

    9/56

    9

  • 8/12/2019 Speak Java in One Hour

    10/56

    10

    JVM

    Platform specific

    Run bytecode

    normally, but not necessary, generated from java

    source code

    The JVM is distributed along with a set ofstandard class libraries which implement the

    Java API (Application Programming

    Interface) : JRE

  • 8/12/2019 Speak Java in One Hour

    11/56

    11

  • 8/12/2019 Speak Java in One Hour

    12/56

    12

    Java family / Platform

    Java SE : Standard Edition

    Java EE : Enterprise Edition

    Java ME : MicroEdition

    Java FX : Scripting & Mobile

  • 8/12/2019 Speak Java in One Hour

    13/56

    13

  • 8/12/2019 Speak Java in One Hour

    14/56

  • 8/12/2019 Speak Java in One Hour

    15/56

    15

    Java SE - Overview

  • 8/12/2019 Speak Java in One Hour

    16/56

    16

    Delivery

    jar file

    java -jar MyApp

  • 8/12/2019 Speak Java in One Hour

    17/56

    17

    Toepassingen

    applets

    Application in browser

    GUI apps, Swing

    Command line

    Basis voor Java EE

    Java in the DB

    Webstart

    automatic network distribution ...

  • 8/12/2019 Speak Java in One Hour

    18/56

    18

  • 8/12/2019 Speak Java in One Hour

    19/56

    19

    History

  • 8/12/2019 Speak Java in One Hour

    20/56

    20

    Toepassingen

    Web applications

    Multitier

    Distributed

    Transactional

    SOA

    Integration

    Web Services

    Messaging

    ...

  • 8/12/2019 Speak Java in One Hour

    21/56

    21

    Programming

    Interfaces

    Implementation is provided by vendors and

    only partially by Java EE

    (vendor specific) Extensible

    JavaBeans

  • 8/12/2019 Speak Java in One Hour

    22/56

  • 8/12/2019 Speak Java in One Hour

    23/56

    23

  • 8/12/2019 Speak Java in One Hour

    24/56

    24

    Architecture

    Clients

    Application Server

    EJB Container

    EJB

    EJB

    EJB

    Web Container

    jsp

    servlet

    Other

    Systems

    Admin etc.

  • 8/12/2019 Speak Java in One Hour

    25/56

    25

    Architecture

  • 8/12/2019 Speak Java in One Hour

    26/56

    26

    Architecture

  • 8/12/2019 Speak Java in One Hour

    27/56

    27

    Architecture

  • 8/12/2019 Speak Java in One Hour

    28/56

    28

    JOnAS Architecture

  • 8/12/2019 Speak Java in One Hour

    29/56

    29

    WebSphere Architecture

  • 8/12/2019 Speak Java in One Hour

    30/56

    30

    Vendors

    Oracle iAS

    IBM WebSphere

    BEA WebLogic

    JBoss

    GlassFish

    Geronimo

    JOnAS SAP Netweaver

    Pramati

    ATG Dynamo

    Tomcat

    Jetty

    http://en.wikipedia.org/wiki/Comparison_of_application_servers#Java

  • 8/12/2019 Speak Java in One Hour

    31/56

    31

  • 8/12/2019 Speak Java in One Hour

    32/56

    32

    Servlets

    Web application

    Plain java

    No visual representation

    import java.io.*;

    import javax.servlet.*;

    import javax.servlet.http.*;

    public class HelloWWW extends HttpServlet {

    public void doGet(HttpServletRequest request,

    HttpServletResponse response)

    throws ServletException, IOException {

    response.setContentType("text/html");

    PrintWriter out = response.getWriter();

    out.println("\n" +

    "\n" +

    "Hello WWW\n" +

    "\n" +

    "Hello WWW\n" +

    "");

    }

    }

  • 8/12/2019 Speak Java in One Hour

    33/56

    33

    JSP

    Web application

    Visual

    pre-compiled to servlet

  • 8/12/2019 Speak Java in One Hour

    34/56

    34

    Jsp Examples

    Hello, User

    My name is Duke. What's yours?

  • 8/12/2019 Speak Java in One Hour

    35/56

  • 8/12/2019 Speak Java in One Hour

    36/56

    36

    JDBC

    import java.sql.*;

    public class JdbcExample {

    public static void main(String[] args) {

    try {

    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());

    Connection conn = DriverManager.getConnection

    ("jdbc:oracle:thin:@oracle:1521:orcl","scott","tiger");

    Statement stmt = conn.createStatement();

    ResultSet r = stmt.executeQuery ("SELECT * FROM STD");

    while (r.next())

    System.out.println(r.getString(2) + " " + r.getString(4));r.close();

    stmt.close();

    conn.close();

    } catch (Exception e) {

    e.printStackTrace(System.out);

    }

    }

    }

    Java DataBase Connectivity

    Interactie tussen java en database

  • 8/12/2019 Speak Java in One Hour

    37/56

    37

    EJB

    Server-side component architecture

    Message Driven Beans

    Session Beans

    [Entity Beans]

    [JPA (Java Persistense API)]

    Complicated and Complex

    Improved much with 3.0

  • 8/12/2019 Speak Java in One Hour

    38/56

    38

    Issues

    Java (SE / EE) only provides the basics

    Reference implementation

    J2EE is too complicated

    Long / slow adaptation process for new

    technologies

  • 8/12/2019 Speak Java in One Hour

    39/56

    39

    Result

    Framework 'hel'

    Improvement of Java

    EJB 3.0

    Convention over configuration Java Persistence

    JSF

  • 8/12/2019 Speak Java in One Hour

    40/56

    40

  • 8/12/2019 Speak Java in One Hour

    41/56

    41

    Struts

    Apache Framework

    de-facto Standard voor jsp development

    Action based

    Still alive

    ADF v9

    JSF

  • 8/12/2019 Speak Java in One Hour

    42/56

    42

    JSF

    Visual

    Component based

    Java EE Standard

    /WEB-INF/faces-config.xml

    A il bl t lib i

  • 8/12/2019 Speak Java in One Hour

    43/56

    43

    Available component libraries

    ADF Faces

    JBoss RichFaces IceFaces

    MyFaces

    Tobago

    Trinidad Quipukit

    WebGalileoFaces

    ILOG JSF tools

    Jenia Woodstock

    ...

    Hib t

  • 8/12/2019 Speak Java in One Hour

    44/56

    44

    Hibernate

    Framework voor de interactie tussen java

    and de database map java objects to db tables

    query en persist

    ~ ADF Business Components

    ~ Toplink

  • 8/12/2019 Speak Java in One Hour

    45/56

    45

    Ontstaan uit onvrede over complexiteit Java

    EE

    Ease of development

    Non invasive

    Testability Inversion Of Control / Dependency Injection

    S i Mi i St t t

  • 8/12/2019 Speak Java in One Hour

    46/56

    46

    Spring Mission Statement

    We believe that:

    J2EE should be easier to use

    It is best to program to interfaces, rather than classes. Springreduces the complexity cost of using interfaces to zero.

    JavaBeans offer a great way of configuring applications.

    OO design is more important than any implementation technology,such as J2EE.

    Checked exceptions are overused in Java. A framework shouldn'tforce you to catch exceptions you're unlikely to be able to recoverfrom.

    Testability is essential, and a framework such as Spring shouldhelp make your code easier to test.

    We aim that:

    Spring should be a pleasure to use Your application code should not depend on Spring APIs

    Spring should not compete with good existing solutions, but shouldfoster integration.

    S i P j t

  • 8/12/2019 Speak Java in One Hour

    47/56

    48

    Spring Projects

    Spring Framework

    Spring Web Flow Spring Web Services

    Spring Security (Acegi Security)

    Spring Dynamic Modules For OSGi(tm) Service Platforms

    Spring Batch

    Spring Integration Spring LDAP

    Spring IDE

    Spring Modules

    Spring JavaConfig

    Spring Rich Client Spring .NET

    Spring BeanDoc

    ADF

  • 8/12/2019 Speak Java in One Hour

    48/56

    49

    ADF

    Visual and declarative development of J2EE

    applications

    Onderdelen

    ADF Faces

    ADF Business Components

    ADF Model (binding)

    SEAM

  • 8/12/2019 Speak Java in One Hour

    49/56

    50

    SEAM

    JBoss

    Unify and integrate (o.a)

    AJAX, JSF, EJB3, BPM

  • 8/12/2019 Speak Java in One Hour

    50/56

    51

    Open Source

  • 8/12/2019 Speak Java in One Hour

    51/56

    52

    Open Source

    Huge impact on development with Java (EE)

    Huge influence on Vendor products

    Major adaptation

    Struts, Hibernate, Spring, ...

    MySQL, Subversion Donations

    ADF -> Trinidad

    Apache

    SourceForge

    CodeHaus

    Apache

  • 8/12/2019 Speak Java in One Hour

    52/56

    53

    Apache

    Commons Utility methods for text, collections, io, en/decoding, http, etc

    Struts, JSP

    MyFaces, JSF

    Trinidad, JSF

    Velocity, templating

    Tuscany, SOA Geronimo, AS

    Lucene, searching

    Tomcat, AS

    Maven, build management

    Harmony, Open Source Java SE

    Synapse, ESB

    ...

  • 8/12/2019 Speak Java in One Hour

    53/56

    54

    Java Community Process

  • 8/12/2019 Speak Java in One Hour

    54/56

    55

    Java Community Process

    Shapes and organizes the future of Java

    JSR http://en.wikipedia.org/wiki/Java_Community_Process

    The future

  • 8/12/2019 Speak Java in One Hour

    55/56

    56

    The future

    Jaca SE 7 - 2008

    Java EE 6 - 2008

    Java FX

    Java everywhere

    Framework shakeout?

    Better Visual development

  • 8/12/2019 Speak Java in One Hour

    56/56