Successfully reported this slideshow.
RAPID JAVA              Using APPLICATION              JBoss Forge,                          Arquillian &                 ...
DEVELOPER PRODUCTIVITY                     - WHAT IF?          Faster Start-Up Times	                     80% Less Configur...
GREAT !!!
J2EE #fail         #fail             EJB                 #fail
PURPOSE OF THIS TALK¡  Demonstrate productivity gains §  Less Code, Classes and Configuration¡  Address Concerns §  Ab...
J2EE 1.4
EJB 2.X SESSION BEAN
EJB 2.X DEPLOYMENT DESCRIPTOR<!-- … à!<enterprise-beans>!  <session>!       <display-name>BankSB</display-name>!       <e...
EJB 2.X CLIENT VIEWtry {!!   Context ctx = new InitialContext();!   BankLocalHome home = (BankLocalHome)       !ctx.lookup...
J2EE #fail         #fail             EJB                 #fail
DEVELOPER PRODUCTIVITY                      WHAT IF?          Faster Start-Up Times	                     80% Less Configura...
JAVA EE 5¡ R esource injection in JEE5  §  @EJB, @Resource, @PersistenceContext,  §  @PersistenceUnit¡ I nto Container...
Java EE 6
EJB 3.1 SESSION BEAN                       OPTIONAL!
JAVA EE 6 DEPLOYMENT DESCRIPTOR
EJB 3.1 CLIENT VIEW@EJB BankLocal bank;!!public void makeDeposit() !{!   bank.deposit(2500.00, new Account(12345));!}!
HOW DID THEY DO THAT?¡ C onfiguration by exception with sensible   defaults  §  Security permissions defaults to UNCHECK...
EASE-OF-USE IMPROVEMENTS¡  Optional Local Interface¡  Simplified Packaging¡  EJB-Lite¡  Portable JNDI Naming¡  Simple...
Loose CouplingSTRONG TYPING
DEPENDENCY INJECTION         IN TWO PARTSDI (@Inject)    CDIJSR 330         JSR 299javax.inject!   javax.enterprise.contex...
INJECTION 101public class StatusUpdater {!!   @Inject!   private UrlShortener shortener;!!   public void post (String user...
WHAT MAKES CDI UNIQUE? STANDARD TYPE SAFEEXTENSIBLE
QUALIFIED INJECTION OF               RESOURCES@Path(“/items”) @ManagedBean!                       Strong Typingpublic clas...
DEFINING THE QUALIFIER!@Qualifier!@Retention(RUNTIME)!@Target({FIELD, TYPE, METHOD, PARAMETER})!public @interface NumberOf...
DEFINING THE BEANS@NumberOfDigits(Digits.EIGHT)!public class IssnGenerator implements NumberGenerator {!!   public String ...
CDI - EXTENSIBLE BY DESIGN¡ M any community projects of extensions:  § Seam 3, CODI, Cambridge Technology Partners¡ The...
Servlet Container   vs.   Java EE6 (After lots of   tweaking)
DEVELOPER PRODUCTIVIT Y                             - WHAT IF?          Faster Start-Up Times	                     80% Les...
ISN’T JAVA EE TOO SLOW & FAT?¡  Startup Times w/ an Application  Deployed §  JBoss AS 7.10 ~ 2 seconds §  GlassFish v3 ...
MEMORY COMPARISON
JAVA EE 5
JAVA EE 6
JAVA EE 6 SPECIFICATION     No Where in the   Specification does it       mention thatApp Servers must be slow      and co...
DEVELOPER PRODUCTIVIT Y                             - WHAT IF?                                                            ...
Start up CostsGotchasIntegration Details
I need one ofthose widgets for   a marketing                    T YPICAL DEVELOPER  meeting in an      hour.              ...
CARVE OUT A PROJECTWORK IT INTO SHAPE
Let’s get started
JAVA EE IN MINUTES
FORGE LEVERAGES FACETS & PLUGINS                   Project      Java Facet    Web Facet         X Facet       Plugin A    ...
Demonstration of Forgeand Java EE Application
GETS YOU                                         STARTEDHandles details, gives you perspective   QUICKLY                  ...
TESTING JAVA EE USED TO BE         DIFFICULT
MANY STEPS REQUIRED FOR MODIFYING        CODE PRODUCTIVELY
ARQUILLIAN REMOVES THE STEPS
ARQUILLIAN
ARQUILLIAN REMOVES THE STEPS      SEE MORE AT   コンテナでテストをまわせ!
A powerful programming model.        Less code, greater portability.Optimized for productivity & automation.              ...
¡  Max Andersen  §  “See Context & Dependency Injection from Java EE 6 in      Action”  §  http://www.slideshare.net/ma...
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Developer Productivity with Forge, Java EE 6 and Arquillian
Upcoming SlideShare
Loading in …5
×

Developer Productivity with Forge, Java EE 6 and Arquillian

3,386 views

Published on

Presentation given at JavaOne Tokyo 2012 about the innovations in Java EE 6, JBoss Forge, Arquillian.

Published in: Technology
  • Be the first to comment

Developer Productivity with Forge, Java EE 6 and Arquillian

  1. 1. RAPID JAVA Using APPLICATION JBoss Forge, Arquillian & Java EE 6DEVELOPMENT Ray Ploski Director, Developer Programs & Strategy JBoss, by Red Hat, Inc.
  2. 2. DEVELOPER PRODUCTIVITY - WHAT IF? Faster Start-Up Times 80% Less Configuration ? 50% Less Code Open eco-system 25% Less Classes Vendor Agnostic Rapid Application Tooling Easier Integration Testing * Based on a Sample POJO/JPA/REST Based Application
  3. 3. GREAT !!!
  4. 4. J2EE #fail #fail EJB #fail
  5. 5. PURPOSE OF THIS TALK¡  Demonstrate productivity gains §  Less Code, Classes and Configuration¡  Address Concerns §  About Java EE, EJBs, App Servers & Lock-in¡  Introduce new innovations §  JBoss Forge §  CDI and Apache DeltaSpike §  Arquillian
  6. 6. J2EE 1.4
  7. 7. EJB 2.X SESSION BEAN
  8. 8. EJB 2.X DEPLOYMENT DESCRIPTOR<!-- … à!<enterprise-beans>! <session>! <display-name>BankSB</display-name>! <ejb-name>BankBean</ejb-name>! <local-home>com.advocacy.legacy.ejb.BankLocalHome</local-home>! <local>com.advocacy.legacy.ejb.BankLocal</local>! <ejb-class>com.advocacy.legacy.ejb.BankBean</ejb-class>! <session-type>Stateless</session-type>! <transaction-type>Container</transaction-type>! </session>!</enterprise-beans>!<assembly-descriptor>! <container-transaction>! <method>! <ejb-name>BankSB</ejb-name>! <method-name>*</method-name>! </container-transaction>!</assembly-descriptor>!
  9. 9. EJB 2.X CLIENT VIEWtry {!! Context ctx = new InitialContext();! BankLocalHome home = (BankLocalHome) !ctx.lookup(“java:comp/env/ejb/bank”);! BankLocal bank = home.create();! bank.deposit(2500.00, new Account(12345)); !} catch (Exception ex) {!! // …!}!
  10. 10. J2EE #fail #fail EJB #fail
  11. 11. DEVELOPER PRODUCTIVITY WHAT IF? Faster Start-Up Times 80% Less Configuration ? 50% Less Code Open eco-system 25% Less Classes Vendor Agnostic Rapid Application Tooling Easier Integration Testing * Based on a Sample POJO/JPA/REST Based Application
  12. 12. JAVA EE 5¡ R esource injection in JEE5 §  @EJB, @Resource, @PersistenceContext, §  @PersistenceUnit¡ I nto Container Components: § Servlets, JSF backing beans and other EJBs¡ P rogress but still Problems §  No POJOs §  Cannot inject DAOs or helper classes that were not written as EJBs §  Hard to integrate anything but strictly business components
  13. 13. Java EE 6
  14. 14. EJB 3.1 SESSION BEAN OPTIONAL!
  15. 15. JAVA EE 6 DEPLOYMENT DESCRIPTOR
  16. 16. EJB 3.1 CLIENT VIEW@EJB BankLocal bank;!!public void makeDeposit() !{! bank.deposit(2500.00, new Account(12345));!}!
  17. 17. HOW DID THEY DO THAT?¡ C onfiguration by exception with sensible defaults §  Security permissions defaults to UNCHECKED §  Transaction type defaults to CONTAINER §  Transaction attribute defaults to REQUIRED¡ U se Annotations §  To choose explicitly (recommended) §  To override defaults¡ D eployment descriptor is no longer required §  But can override above configurations
  18. 18. EASE-OF-USE IMPROVEMENTS¡  Optional Local Interface¡  Simplified Packaging¡  EJB-Lite¡  Portable JNDI Naming¡  Simple Component Testing
  19. 19. Loose CouplingSTRONG TYPING
  20. 20. DEPENDENCY INJECTION IN TWO PARTSDI (@Inject) CDIJSR 330 JSR 299javax.inject! javax.enterprise.context! ! Alternatives!@Inject! Producers!@Named! Scopes!@Singleton! Stereotypes!@Qualifier! Decorators!@Scope! Extensions!
  21. 21. INJECTION 101public class StatusUpdater {!! @Inject! private UrlShortener shortener;!! public void post (String username, String status) {! !String sStatus = shortener.shortenUrls(status);! !System.out.println(username + “ said “ + sStatus);! }!!}! !
  22. 22. WHAT MAKES CDI UNIQUE? STANDARD TYPE SAFEEXTENSIBLE
  23. 23. QUALIFIED INJECTION OF RESOURCES@Path(“/items”) @ManagedBean! Strong Typingpublic class ItemRestService {! No Strings! @Inject @NumberOfDigits(Digits.EIGHT)! private NumberGenerator numberGenerator;! …!}!!!@WebServlet(urlPatterns = “/itemServlet”)!public class ItemServlet extends HttpServlet {!! @Inject @NumberOfDigits(Digits.THIRTEEN)! private NumberGenerator numberGenerator;! …! Loose Coupling}! No Reference to Implementation
  24. 24. DEFINING THE QUALIFIER!@Qualifier!@Retention(RUNTIME)!@Target({FIELD, TYPE, METHOD, PARAMETER})!public @interface NumberOfDigits {!! !Digits value();!!}!!public enum Digits {! !TWO, EIGHT, TEN, THIRTEEN!!}!!
  25. 25. DEFINING THE BEANS@NumberOfDigits(Digits.EIGHT)!public class IssnGenerator implements NumberGenerator {!! public String generateNumber() {! return “8-” + nextNumber();! }!! // …!}!!@NumberOfDigits(Digits.THIRTEEN)!public class IsbnGenerator implements NumberGenerator {!! public String generateNumber() {! return “13-84356-” + nextNumber();! }!! // …!}!
  26. 26. CDI - EXTENSIBLE BY DESIGN¡ M any community projects of extensions: § Seam 3, CODI, Cambridge Technology Partners¡ These multiple projects merging to deliver a vendor-neutral open ecosystem for extensions named DeltaSpike .¡  Hosted on Apache. Works on all Java EE 6 servers + + CDISource DeltaSpike
  27. 27. Servlet Container vs. Java EE6 (After lots of tweaking)
  28. 28. DEVELOPER PRODUCTIVIT Y - WHAT IF? Faster Start-Up Times 80% Less Configuration ? 50% Less Code Open eco-system 25% Less Classes Vendor Agnostic Rapid Application Tooling Easier Integration Testing * Based on a Sample POJO/JPA/REST Based Application
  29. 29. ISN’T JAVA EE TOO SLOW & FAT?¡  Startup Times w/ an Application Deployed §  JBoss AS 7.10 ~ 2 seconds §  GlassFish v3 ~ 4 seconds §  Tomcat 6 + Spring ~ 4 seconds § Java EE 6 War File < 100kb
  30. 30. MEMORY COMPARISON
  31. 31. JAVA EE 5
  32. 32. JAVA EE 6
  33. 33. JAVA EE 6 SPECIFICATION No Where in the Specification does it mention thatApp Servers must be slow and complex.
  34. 34. DEVELOPER PRODUCTIVIT Y - WHAT IF? 80% Less Configuration Faster Start-Up Times ? Open eco-system 50% Less Code 25% Less Classes Vendor Agnostic Rapid Application Tooling Easier Integration Testing * Based on a Sample POJO/JPA/REST Based Application
  35. 35. Start up CostsGotchasIntegration Details
  36. 36. I need one ofthose widgets for a marketing T YPICAL DEVELOPER meeting in an hour. NIGHTMARE
  37. 37. CARVE OUT A PROJECTWORK IT INTO SHAPE
  38. 38. Let’s get started
  39. 39. JAVA EE IN MINUTES
  40. 40. FORGE LEVERAGES FACETS & PLUGINS Project Java Facet Web Facet X Facet Plugin A Plugin B ... Plugin X
  41. 41. Demonstration of Forgeand Java EE Application
  42. 42. GETS YOU STARTEDHandles details, gives you perspective QUICKLY … and time HANDLES “GOTCHAS” ADDS & ACTIVATES TECH VIA PLUGINS
  43. 43. TESTING JAVA EE USED TO BE DIFFICULT
  44. 44. MANY STEPS REQUIRED FOR MODIFYING CODE PRODUCTIVELY
  45. 45. ARQUILLIAN REMOVES THE STEPS
  46. 46. ARQUILLIAN
  47. 47. ARQUILLIAN REMOVES THE STEPS SEE MORE AT コンテナでテストをまわせ!
  48. 48. A powerful programming model. Less code, greater portability.Optimized for productivity & automation. CDI and Forge plugins.Absolutely. You saw it first hand.
  49. 49. ¡  Max Andersen §  “See Context & Dependency Injection from Java EE 6 in Action” §  http://www.slideshare.net/maxandersen/see-context- dependency-injection-from-java-ee-6-in-action¡  Pete Muir REFERENCES §  “CDI in Action”¡ Andrew Lee Rubinger §  “The Death of Slow” §  http://www.slideshare.net/ALRubinger/devoxx-2011- jboss-as7-death-of-the-slow¡ B ert Ertman §  EJB 3.1 §  http://www.slideshare.net/stephanj/ejb-31-by-bert- ertman¡  Antonio Goncalves §  “To inject or not to inject: CDI is the question” §  http://www.slideshare.net/agoncal/to-inject-or-not-to-inject-cdi-is-the- question

×