Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Seven Points for Applying Java EE 7

20,510 views

Published on

Published in: Technology
  • very helpful
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Thanks, nice presentation
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Awesome talk! Please consider delivering it at JavaOne and OOW in the following years!
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • 本日聴講させていただきました。大変勉強になりました。 JavaEE7 ベースだと P7 の Cosminexus は、GlassFishからの矢印が必要かもしれません。 http://www.hitachi.co.jp/Prod/comp/soft1/cosminexus/hi_apserver/concept/index.html 尚、日立のAPは現状 uCosminexus Application Server と Hitachi Application Server があります。 Cosminexus はそれらを含む製品群の総称です。
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Seven Points for Applying Java EE 7

  1. 1. @HirofumiIwasaki #jdt65 Seven Points for Applying Java EE 7 Apr 8, 2015 Hirofumi Iwasaki Financial Service Department, DU, Rakuten, Inc.
  2. 2. @HirofumiIwasaki #jdt65 2 Speaker Biography  Hirofumi Iwasaki – Group Manager, Technology Manager – Financial Service Department, Development Unit, Rakuten, Inc.  Carrier – 16 Years of experience in planning, designing and implementation of Japanese financial, manufacturing and public enterprise system with emphasis in Java EE and .NET enterprise middleware.  Opus, Lectures, etc. – Conferences: JavaOne 2014, Oracle OpenWorld 2014, Java Day Tokyo 2014, JJUG CCC Spring & Fall (2014), WebLogic roundtable (2012-2013), Rakuten Tech Conference (2014, 2013) etc. – Magazine: @IT (2005-2010), CIO Magazine (2009), IT Architect (2005-2009), Web+DB Press (2005), Java World (2001-2004), etc.
  3. 3. @HirofumiIwasaki #jdt65 3 JCP with Rakuten Rakuten Joined JCP as a member of “user company”.
  4. 4. @HirofumiIwasaki #jdt65 UpdateYour Knowledge JavaEE To of
  5. 5. @HirofumiIwasaki #jdt65 5 1. Select the Java EE 7 based application server 2. Use modern IDE to build with Maven instead of text editor 3. Apply JSF for front-end framework 4. Apply EJB for back-end framework 5. Consider remote connectivity 6. Apply JPA for database persistence 7. Consider EE 8 for future-prove Agenda
  6. 6. @HirofumiIwasaki #jdt65 1. Select the Java EE 7 based application server To
  7. 7. @HirofumiIwasaki #jdt65 7 GlassFish & Compatible Group WebLogic World Geronimo & Compatible Group JBoss World Japan Group App Engine Copy Java EE World and Others Korea Group Apache Group Google
  8. 8. @HirofumiIwasaki #jdt65 8 Details of Java EE Application Servers Vendor App Server EE 1.4 (2003-) EE 5 (2006-) EE 6 (2009-) EE 7 (2013-) Open Source GlassFish - 2.x 3.x 4.x Oracle WebLogic 9.x 10.x 12.x - (Summer, 2015?) IBM WebSphere 5.1 6.x, 7.x 8.x - (Summer, 2015?) Red Hat JBoss 4.x 5.1 7.1 - Red Hat WildFly - - - 8.0 Fujitsu Interstage 9.0,9.1 9.2,10.x,11.0 11.1 - Apache Geronimo - 2.x 3.x - Hitachi Cosminexus 7.x 8.x 9.x 10.0 TmaxSoft JEUS 5.0 6.0 7.0 8.0 Apache TomEE - - 1.x - Few servers are available
  9. 9. @HirofumiIwasaki #jdt65 9 Commercial or Free? Is heavily SLA required? Is open source NOT required? Is some support required? Select Commercial Products Select Free Products Is there few initial cost limitation? Is DIY not acceptable?Is long running upgrading path required?
  10. 10. @HirofumiIwasaki #jdt65 10 Summary: Select Your Appropriate Server Consider the policies for your application, Determine the roadmap and resources, Select the appropriate Java EE server.
  11. 11. @HirofumiIwasaki #jdt65 2. Use modern IDE to build with Maven instead of text editor To
  12. 12. @HirofumiIwasaki #jdt65 12 In 1990’s – early 2000’s “Great Engineers” never use such IDEs! Instead, they use text editor! *Is Japanese special habit not to use IDEs?
  13. 13. @HirofumiIwasaki #jdt65 13 “Great Engineer” never use such IDEs! Instead, use text editor! We’re now living in 2010’s NEVER Apply the latest technologies! *Is Japanese special habit not to use IDEs?
  14. 14. @HirofumiIwasaki #jdt65 14 Over 10,000 classes in real large systems Crazy amount of source codes!
  15. 15. @HirofumiIwasaki #jdt65 15 Manage tons of codes with modern IDE
  16. 16. @HirofumiIwasaki #jdt65 16 Summary: modern IDE for Java EE
  17. 17. @HirofumiIwasaki #jdt65 17 De-Facto standard building tool  Determined with “pom.xml”  Automatic library downloading  Ease of use, script not supported  Determined with “build.gradle”  Automatic library downloading  Complex scripting supported
  18. 18. @HirofumiIwasaki #jdt65 18 Three major IDEs support Maven in default setting *Additional plugin required * * “New Project” Dialogs:
  19. 19. @HirofumiIwasaki #jdt65 19 “Special Project Files” are not required anymore with Maven Maven Project are used by these three IDEs
  20. 20. @HirofumiIwasaki #jdt65 20 Summary: recommendation to make Java EE 7 project Make project with , Enjoy programming with (Choose anything you want)
  21. 21. @HirofumiIwasaki #jdt65 3. Apply JSF for front-end framework To
  22. 22. @HirofumiIwasaki #jdt65 22 Rich Clients Web Presentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Data Access Messaging
  23. 23. @HirofumiIwasaki #jdt65 23 Selection of the front-end frameworks of server side Java  JavaServer Faces – Genuine Java EE front-end framework – Many additional components like “PrimeFaces”. – View-based operation  Apache Struts – 2000’s older front-end framework (especially 1.x) – Many results in any industries – Action-based operations
  24. 24. @HirofumiIwasaki #jdt65 24 <<JSP>> View1 <<JSP>> View 2 Action1 + action() <<JSP>> View 3 Action2 + action() ActionForm1 - fields + validate() ActionForm2 - fields + validate() Operate Action Build Next View Operate Action Build Next View Per Action Operation struts-config.xml 1.x
  25. 25. @HirofumiIwasaki #jdt65 25 <Facelet> View 1 Backing1 - fields + load() + action() <Facelet> View 2 Backing2 - fields + load() + action() <Facelet> View 3 Backing3 - fields + load() + action() Front View & Backing Bean Per View Operation
  26. 26. @HirofumiIwasaki #jdt65 26 Paradigm Shift: Action to Page
  27. 27. @HirofumiIwasaki #jdt65 27 Paradigm Changing - Simple <<JSP>> View1 <<JSP>> View 2 Action1 + action() <<JSP>> View 3 Action2 + action() ActionForm1 - fields + validate() ActionForm2 - fields + validate() Operate Action Build Next View Operate Action Build Next View <Facelet> View 1 Backing1 - fields + load() + action() <Facelet> View 2 Backing2 - fields + load() + action() <Facelet> View 3 Backing3 - fields + load() + action() Front View & Backing Bean 1.x
  28. 28. @HirofumiIwasaki #jdt65 28 One Action Class Paradigm Changing - Simple Event Operation Next Page Initialization Backing Bean Action Method Event Operation Backing Bean @PostConstruct Method Page Initialization Sprit to Two Parts
  29. 29. @HirofumiIwasaki #jdt65 29 JSP vs. Facelet JavaServer Pages Facelet Compile Java Servlet Work HTML Rendering HTML Rendering Real-time Interpreting & Work No Compile, Rapid Dev. Re-Deploy & Compile Harmful Dev. Procs Check Fix Fix Reload
  30. 30. @HirofumiIwasaki #jdt65 30 HTML Friendly Tags <input type="text” jsf:value="#{bean.property}" /> Java EE 7 (JSF 2.2) Java EE 6 (JSF 2.1) Simplified <input type="text" jsfc="h:inputText" name="id" value="#{bean.property}" /> Nice Relationship with HTML Design Tools
  31. 31. @HirofumiIwasaki #jdt65 31 Use HTML Friendly Tags HTML JSF 2.2 HTML Friendly Tags Older JSF Tags <a> <a jsf:action=“#{cdi.prop}”>~~~</a> <h:commandLink> <input type=“button”> <input type=“submit”> <input type=“button” jsf:value=“#{cdi.prop}”/> <input type=“submit” jsf:value=“#{cdi.prop}”/> <h:commandButton> <input type=“file”> <input type=“file” jsf:value=“#{cdi.prop}”/> <h:inputFile> <input type=“hidden”> <input type=“hidden” jsf:value=“#{cdi.prop}”/> <h:inputHidden> <input type=“password”> <input type=“password” jsf:value=“#{cdi.prop}”/> <h:inputSecret> <textarea> <textarea jsf:value=“#{cdi.prop}”/> <h:inputTextArea> <input type=“checkbox”> <input type=“checkbox” jsf:value=“#{cdi.prop}”/> <h:selectBooleanCheckbox> ・・・ etc.
  32. 32. @HirofumiIwasaki #jdt65 32 Summary: Recommendation for the Java EE 7 Front-End Use For your web front-end, Apply HTML-Friendly Tags for mark-up. Implement with Facelet,
  33. 33. @HirofumiIwasaki #jdt65 4. Apply EJB for back-end framework To
  34. 34. @HirofumiIwasaki #jdt65 34 Rich Clients Web Presentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Data Access Messaging
  35. 35. @HirofumiIwasaki #jdt65 35 Review: What’s EJB? Why EJB? EJBClient 1. Remote Invocation EJB 2. Automatic Transaction Management Database (BEGIN) (COMMIT) EJB EJB EJB EJB Instance Pool Activate 3. Instance Pooling for Faster Operation RMI-IIOP SOAP REST Web Socket EJB Client 4. Security Management
  36. 36. @HirofumiIwasaki #jdt65 36 Forget about the past EJB blames of EJB 1.x & 2.x in 2004 11 years ago!!
  37. 37. @HirofumiIwasaki #jdt65 37 Embedded Container EJB 3 and beyond – Improved dramatically EJB 1. Introduced Annotations, POJO @Stateless EJB 2. Introduced Injections @Inject @EJB Other Instance ejb-jar.xml 4. No Deployment Descriptor (optional) EJB EJB 5. Embedded EJB Container for Testing & etc. JPA Database 3. Entity Bean  JPA
  38. 38. @HirofumiIwasaki #jdt65 38 POJO Java EE ServerJava EE Server Java Batch How Design the Batch Logics? Choice 1: Use EJB, Call via EJB Remote from Outside EJB Batch Batch Kicker Call Choice 2: Use Java Batch Framework, Call from Outside Batch Kicker Call Choice 3: Don’t Use Java EE Server [NOT RECOMMENDED] Batch Kicker Call Full automatic transaction, Able to use embedded server. If the standard templates suitable for your app, try it. Full manual transaction, management, and everything.
  39. 39. @HirofumiIwasaki #jdt65 39 Limitation: Don’t Use Lambda Parallel Stream inside of the EJB Java EE 7 spec is not supported Java SE 8 new functions. Tested Fork/Join Framework (basement of the parallel stream) with WebLogic Server 12.1 (yet Java EE 6) Not worked. “weblogic.ejb.container.compliance. ComplianceException”
  40. 40. @HirofumiIwasaki #jdt65 40 Apply EJB for your enterprise logics Apply me! I’ll remotely manage transactions
  41. 41. @HirofumiIwasaki #jdt65 5. Consider remote connectivity To
  42. 42. @HirofumiIwasaki #jdt65 42 Review: What’s EJB? Why EJB? EJBClient 1. Remote Invocation EJB 2. Automatic Transaction Management Database (BEGIN) (COMMIT) EJB EJB EJB EJB Instance Pool Activate 3. Instance Pooling for Faster Operation RMI-IIOP SOAP REST Web Socket EJB Client 4. Security Management
  43. 43. @HirofumiIwasaki #jdt65 43 Supported protocols of Java EE 7 (EJB) Protocol Supported From Annotation Client Stub Value Marshaling Global Transaction RMI-IIOP J2EE 1.2 @Remote in remote interface Remote interface with auto generate Auto XA Supported SOAP Java EE 5 @WebService Auto generate in development Auto N/A REST Java EE 6 @GET, @POST, etc. (Nothing special) Work with JSON or something (string base) N/A Web Socket Java EE 7 @ServerEndpoint @ClientEndpoint with auto generate Work with JSON or something (string base) N/A
  44. 44. @HirofumiIwasaki #jdt65 44 Global Transaction Management with XA Protocol For heavy transaction: consider RMI-IIOP EJB Session BeanClient RMI-IIOP Other System’s EJB Database Other Enterprise Information Systems IIOP AUTO BEGIN AUTO COMMIT
  45. 45. @HirofumiIwasaki #jdt65 45 For light-weight usage: consider Web Socket + JSON Local Transaction Management EJB Session BeanClient Web Socket Database AUTO BEGIN AUTO COMMIT Ultra-Fast, Ease of Dev.
  46. 46. @HirofumiIwasaki #jdt65 46 EJB Session Bean with RMI-IIOP and Web Socket @Stateless @Remote @ServerEndpoint(value = "/memberlogic") public class MemberLogic implements MemberLogicRemote { @OnMessage public String register(String message, Session session) { // WRITE TRANSACTIONAL LOGICS HERE! return xxxx; } } EJB RMI-IIOP Web Socket Some Clients Transactional Processing for RMI-IIOP for Web Socket for RMI-IIOP for Web Socket
  47. 47. @HirofumiIwasaki #jdt65 47 Why do not use SOAP or REST? SOAP REST  The improvements are almost stopped in both specs and Java EE support.  Heavy auto generating codes.  Buggy interoperability.  Slower marshaling and unmarshaling.  It does not have good support in Java EE, especially for client-side.  No marshaling and unmarshaling support in Java EE.  Slower protocol than web socket.
  48. 48. @HirofumiIwasaki #jdt65 48 Summary: Recommendation of Protocols Select the RMI-IIOP for heavy transactional distributed systems. Select the Web Socket for system that requires light-weight and faster speed.
  49. 49. @HirofumiIwasaki #jdt65 6. Apply JPA for database persistence To
  50. 50. @HirofumiIwasaki #jdt65 50 Rich Clients Web Presentation Business Logic (no presentations) Typical usage of Java EE 7 JPA EJBJSF DBs Java FX JTA Automatic Transaction JMS MQ Connection RMI-IIOP Other Servers EMail MTAJavaMail JAX Call Call Call Call Call Call Messaging Data Access
  51. 51. @HirofumiIwasaki #jdt65 51 About JPA – Java Persistence API Java Persistence API (from Java EE 5)
  52. 52. @HirofumiIwasaki #jdt65 52 JPA – Simple Database Mapper Relational Database (E-R Diagram) One by One JPA Entity (Class Diagram) Auto Generate With Bean Validation
  53. 53. @HirofumiIwasaki #jdt65 53 JPA – Simple Database Mapper JPA Entity JPA Data Access Object (DAO) Auto CRUD to Database Access to RDB
  54. 54. @HirofumiIwasaki #jdt65 54 public List<Member> findMemberByName(String name) { String queryString = "SELECT a FROM Member m " + "WHERE m.name = LOWER(:name)"; Query query = getEntityManager().createQuery(queryString); query.setParameter("name", name); List<Member> result = query.getResultList(); } JPA Custom Queries – JPQL and Criteria Query JPQL: Criteria Query: public List<Member> findMemberByName(String name) { CriteriaBuilder builder = this.em.getCriteriaBuilder(); CriteriaQuery query = builder.createQuery(); Root<Member> member = query.from(Member.class); query.select(member); query.where(builder.equal(member.get(”name"), name)); List<Member> result = this.em.createQuery(query).getResultList(); }
  55. 55. @HirofumiIwasaki #jdt65 55 JTA Transaction Management Java EE Application EJB Business Logic Why You Should Not Use Raw JDBC in Java EE? Java EE Application Server Java VM Connection Pool EJB Object Pool Thread Pool Self-Managed JDBC Connection JPA Entity Manager JNDI JDBC Driver Manager RAW ? ? No Global Transaction No Connection Management
  56. 56. @HirofumiIwasaki #jdt65 56 Combination with EJB Session Bean Business Logic (no presentations) JPA EJB DBs JTA Automatic Transaction Call Full automatic transaction management with EJB session bean JPA entity manager automatically join the CMT of EJB Data Access
  57. 57. @HirofumiIwasaki #jdt65 57 Summary: Use JPA, Instead of Raw JDBC. Apply JPA ordinarily, within the EJB Container Managed Transaction (CMT)
  58. 58. @HirofumiIwasaki #jdt65 7. Consider EE 8 for future-prove To
  59. 59. @HirofumiIwasaki #jdt65 59 Beyond of the Java EE 7 CDI 2.0 JSON-B 1.0 JMS 2.1 Servlet4.0 JAX-RS2.1 MVC 1.0 JSF 2.3 Java EE Management API 1.0 JSON-P 1.1 Java EE Security API 1.0
  60. 60. @HirofumiIwasaki #jdt65 60 Recommendation Apply Standard APIs
  61. 61. @HirofumiIwasaki #jdt65 61 Standardization History of Java EE J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 Java EE 8 JDBC EJB/JTA/XA/IIOP Servlet/JSP JMS RMI SOAP JPA JSF/Facelet REST CDI JavaBatch Project JPE or earlier WebSocket MVC …
  62. 62. @HirofumiIwasaki #jdt65 62 Terminated Technologies of Java EE J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 Java EE 8 JDBC EJB JSP JMS RMI SOAP JPA JSF/Facelet REST CDI JavaBatch Project JPE or earlier WebSocket EJBEntityBean JSP MVC …
  63. 63. @HirofumiIwasaki #jdt65 63 Summary is the world open specification De-Facto standard. “Standard” has many pros & cons, but it can keep your assets and knowledge.
  64. 64. @HirofumiIwasaki #jdt65 standardization history: • From vendor special functions • From open source functions Java EE 7 Updates: Standardized and long term support
  65. 65. @HirofumiIwasaki #jdt65 Java EE has many world-wide people and company support. your application will have long-life guaranteed.
  66. 66. @HirofumiIwasaki #jdt65 Apply Java EE 7 today and be ready for EE 8.
  67. 67. @HirofumiIwasaki #jdt65

×