java™ platform, enterprise eclipse and netbeans™ ide ... · java™ platform, enterprise...

44
Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun Philippe Ombredanne, NexB TS-5055

Upload: trinhkhuong

Post on 30-Nov-2018

231 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering

Ludovic Champenois, SunPhilippe Ombredanne, NexB

TS-5055

Page 2: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Agenda > Java EE 5 versus Java EE 6> GlassFish v3> NetBeans GlassFish Support> Eclipse GlassFish Support

Page 3: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Overall Goal For Java EE 6

> Make the platform:● Easier to use● More flexible, adaptable● Easier to learn● Easier to evolve going forward

Page 4: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Java EE Timeline

JPEProject

J2EE 1.2Servlet, JSP,

EJB, JMSRMI/IIOP

J2EE 1.3CMP,

ConnectorArchitecture

J2EE 1.4Web Services, Management, Deployment, Async. Connector

Java EE 5Ease of DevelopmentAnnotationsEJB 3.0Persistence APINew and Updated Web Services

Robustness

Web Services

Enterprise Java

Platform

`

Java EE 6EJB LiteRestful WSWeb BeansExtensibility

Java EE 6Web Profile

Ease ofDevelopment

Profiles

Page 5: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Major new Features in Java EE 6> Profiles

● targeted bundles of technologies> Pruning

● Make some technologies optional● CMP, JAX-RPC...

> Extensibility● Embrace open source libraries and

frameworks● Zero-configuration, drag-and-drop for web

frameworks, web.xml fragments> Ease of development

Page 6: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Ease Of Development> Ongoing concern> This time focus is the web tier> Lots of opportunities in other areas, e.g. EJB> General principles:

● Annotation-based programming model● Traditional API for advanced users● Reduce or eliminate need for deployment

descriptors● Get technologies to work together well

Page 7: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Servlet 3.0 Highlights> Annotation-based programming model

● @WebServlet @ServletFilter etc.> Modular web.xml descriptor:

● WEB-INF/lib/mylibrary.jar → META-INF/web-fragment.xml

> Annotations and web fragments are merged> Programmatic API for dynamic registration of

servlets> Async APIs

● Useful for Comet, chat rooms, long waits

Page 8: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

EJB 3.1 Highlights> Singleton beans: @Singleton> No interface view: one source file per bean> Calendar timers:

@Schedule(dayOfWeek=“Mon,Wed”)● Non-persistent timers (tied to a JVM)

> Async business methods: @Asynchronous● Methods must return void or a Future<T>

> Global JNDI names for beans● java:global/(app)/(module)/(bean)#(interface)

Page 9: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

9

Session Bean with Local Business Interface...OLD...

<<interface>com.acme.HelloString sayHello()

com.acme.HelloBean

public String sayHello() { ... }

@EJB private Hello h;...h.sayHello();

HelloBean Client

Page 10: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

10

Optional Local Business Interfaces

> Sometimes local business interface isn't needed> Better to completely remove interface from

developer's view than to generate it> Result : “no-interface” view

● Just a bean class● public bean class methods exposed to client● Same behavior and client programming model as

Local view● Client acquires an EJB component reference instead of

calling new()

Page 11: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

11

Session Bean with “No-interface” View

@Statelesspublic class HelloBean { public String sayHello(String msg) { return “Hello “ + msg; }}

Page 12: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

12

No-interface View Client

@EJB HelloBean h;...h.sayHello(“bob”);

Page 13: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

13

Web/EJB Application in JavaTM EE Platform 5

foo.ear

WEB-INF/web.xmlWEB-INF/classes/ com/acme/FooServlet.classWEB-INF/classes com/acme/Foo.class

foo_web.war

com/acme/FooBean.classcom/acme/Foo.class

foo_ejb.jar

foo.ear

lib/foo_common.jarcom/acme/Foo.class

WEB-INF/web.xmlWEB-INF/classes/ com/acme/FooServlet.class

foo_web.war

com/acme/FooBean.class

foo_ejb.jar

OR

Page 14: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

14

foo.war

WEB-INF/classes/ com/acme/FooServlet.class

WEB-INF/classes/ com/acme/FooBean.class

Web/EJB Application in JavaTM EE Platform 6

Page 15: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

15

EJB “Lite”

> Small subset of EJB 3.1 API for use in Web Profile

> Broaden the availability of EJB technology● Without losing portability

> Same exact Lite application can be deployed to Web Profile and Full Profile

● Thanks to simplified .war packaging

Page 16: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

16

“Lite” vs. Full Functionality

Lite > Local Session Beans> Annotations / ejb-

jar.xml> CMT / BMT> Declarative Security> Interceptors

> (Also requires JPA 2.0 API / JTA 1.1 API )

Full = Lite + the following:

> Message Driven Beans

> EJB Web Service Endpoints

> RMI-IIOP Interoperability

> 2.x / 3.x Remote view> 2.x Local view> Timer Service> CMP / BMP

Page 17: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

17

EJB Component Testing

> It's too hard to test EJB components, especially the Local view

● Forced to go through Remote facade or Web tier● Separate JVM™ instances needed for server and

client> Support for running in Java SE exists, but...

● Not present in all implementations● No standard API for bootstrapping, component

discovery, shutdown etc.

Page 18: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

18

New Features

> Singletons> Application startup / shutdown callbacks> Calendar-based timer expressions> Automatic timer creation> Simple Asynchrony

Page 19: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

19

Singletons

> New session bean component type● One singleton bean instance per application per

JVM● Provides easy sharing of state within application● Designed for instance-level concurrent access

> Lots in common with stateless / stateful beans● Client views (No-interface , Local, Remote, Web

Service) ● CMT / BMT● Container services: timer service, injection, etc.● Method authorization

Page 20: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

20

Startup / Shutdown Callbacks

@Singleton@Startuppublic class StartupBean { @PostConstruct private void onStartup() { ... } @PreDestroy private void onShutdown() { ... }

Page 21: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

21

Timer Service Features

> Calendar-based timeout expressions > Automatic timer creation> Non-persistent timers> “Cron”-like semantics with improved syntax> Named attributes

● second, minute, hour ( default = “0” )● dayOfMonth, month, dayOfWeek, year (default = “*”)

Page 22: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

22

Calendar Based Timeouts // The last Thursday in November at 2 p.m.(hour=”14”, dayOfMonth=”Last Thu”, month=”Nov”)// Every weekday morning at 3:15 a.m.(minute=”15”, hour=”3”, dayOfWeek=”Mon-Fri”)// Every five minutes (minute=”*/5”, hour=”*”) For ex:// Callback the 1st of each month at 8 a.m.

@Schedule(hour=”8”, dayOfMonth=”1”) void sendMonthlyBankStatements() {...}

Page 23: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Java EE 6: Summary

> Smaller, more agile platform: profiles, pruning, extensibility

> Ease of development still a major focus area> Component specs ready for public review> Open source implementation in GlassFish v3

Page 24: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Agenda

> Java EE 6> GlassFish v3> NetBeans Glassfish Support> Eclipse GlassFish Support

Page 25: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish v3> Java EE 5 = GlassFish v2> GlassFish v2.1: better, faster, more scalable> GlassFish v3 Prelude

● Web Tier Only, OSGi Based, some EE 6 previews● EclipseLink Bundled● Multiple Containers (jRuby, Groovy, Phobos)

> GlassFish v3 = Java EE 6● Work in Progress● OSGi Based

● Equinox And Felix● All these Application Servers have Eclipse Integration

Page 26: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Agenda

> Java EE 6> GlassFish v3> NetBeans GlassFish Support> Eclipse GlassFish Support

Page 27: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

NetBeans 6.7> Bundles with GlassFish v2.1 and v3 Prelude> Can download and register latest GlassFish v3

builds> Stellar Java EE 5 support

● Web, Web Services, JerSey, JPAs, EJBs, EARs> Allow Java EE 6 development when GF v3 is used

Page 28: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

NetBeans 6.7 and JAX RS support> Complete dev env for

● Creating JPAs from DB● Creating JAX-RS RESTful from JPAs● Test the Resources

> Demo

Page 29: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

NetBeans 6.7 and GlassFish v3> JPA possible in Web Applications> Servlet 3.0: pure annotation based> Demo

Page 30: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Agenda

> Java EE 6> GlassFish v3> NetBeans GlassFish Support> Eclipse GlassFish Support

Page 31: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

New: GlassFish + Eclipse Bundle

Page 32: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle for Eclipse> http://download.java.net/glassfish/eclipse

● V1.0 today, with support available> Or Standalone Plugin

● http://glassfishplugins.dev.java.net

Page 33: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

InstallerRegistration

Eclipse Java EE IDE

GlassFish Eclipse Plugins

GlassFish v2.1, v3prelude

EclipseUser

Workspace:> v2.1 domain

> v3 domain

> JavaDB config

> Java EE projects

> User settings

JDK1.6 (optional)

Page 34: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle For Eclipse Key Features> Out of the box Installer with all Java EE Eclipse

Standard Features and JDK and GlassFish servers> GlassFish Registration Wizard> GlassFish v2.1 & v3 Prelude automatic domain

creation/configuration > JavaDB configuration, JDBC resource wizard> Start, Stop, Deploy, undeploy, Debug(JSP/Java)

(v2, v3)> Deploy on Save: Default for v3> HTTP Monitoring preconfigured

Page 35: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle For Eclipse Key Features> All Sun DTDs registered for validation/code

completion> All Java EE APIs registered for code

completion/JavaDoc> GlassFish Log integrated into Eclipse IDE console> GlassFish Update Center & Admin Console

Integration> All v2, v3p DocBooks integrated in Help (no need for

Internet)> GlassFish Web Properties in Help Menu (The

Aquarium, Support,...)

Page 36: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle For Eclipse Key Features> Update Centers Integration> Eclipse Update Center for Eclipse bits and

the GlassFish Plugin> In future releases:

● Metro JAX-WS Eclipse Plugin● JavaFX ,Maven Plugin● WebSynergy ,GlassFish ESB● Better MySQL integration

Page 37: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Size of GlassFish Tools Bundle for Eclipse

> JBoss Dev Studio 2.0 RC2 +EAP = 617Mb (No JDK)> Oracle Workshop for WebLogic 10.2 = 748Mb (No JDK)

Components in the Installer Size (total=375Mb)

● Eclipse 164Mb

● GlassFish v2.1 87Mb

● GlassFish v3 Prelude 29Mb

● GlassFish Plugin for Eclipse 10Mb (includes javadoc and help books)

● Registration/Configuration 0.5Mb

● JDK 1.6u12 85Mb

Page 38: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Collaboration work with EasyEclipse> Re-use the open source build loop for distros

● Installers on MacOS X, Windows, Linux, OpenSolaris> Help in assembling a complete IDE

● Using Eclipse.org, Glassfish and community plug-ins> Why doing a distros and installers?

● Batteries included approach● Yet minimalist essential set of features to get going● http://blog.hantsuki.org/2009/03/20/eclipse-and-installers/

> Tight work with core WTP and JPA committers● Bug fixing in P2 compatibility

Page 39: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle for Eclipse

Page 40: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle for Eclipse

Page 41: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle for Eclipse

Page 42: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

GlassFish Tools Bundle for Eclipse

Page 43: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

43

For More Information

> http://download.java.net/glassfish/eclipse> http://glassfishplugins.dev.java.net> Blog :http://weblogs.java.net/blog/ludo/ > Reference Implementation : GlassFish project v3

● http://glassfish.dev.java.net

Page 44: Java™ Platform, Enterprise Eclipse and NetBeans™ IDE ... · Java™ Platform, Enterprise Edition 5 and 6: Eclipse and NetBeans™ IDE Tooling Offering Ludovic Champenois, Sun

Ludovic ChampenoisPhilippe Ombredannehttp://weblogs.java.net/blog/ludo/