java ee & glass fish user group: digital javaee 7 - new and noteworthy
Post on 17-Jul-2015
103 Views
Preview:
TRANSCRIPT
DIGITAL Java EE 7 New and NOTEWORTHY
Enterprise Java Lives! (18-02-2015)
Peter Pilgrim Scala and Java EE
Independent contractor
@peter_pilgrim
Xenonique @peter_pilgrim
Creative Commons 2.0Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales (CC BY-NC-SA 2.0 UK) https://creativecommons.org/licenses/by-nc-sa/2.0/uk/
• Share — copy and redistribute the material in
any medium or format • Adapt — remix, transform, and build upon the
material • The licensor cannot revoke these freedoms as
long as you follow the license terms.
4
Xenonique @peter_pilgrim
About Me• Java EE and Scala developer independent
contractor • Digital transformation / e-commerce • Java Champion • Working on the JVM since 1998
5
Xenonique @peter_pilgrim 9
#1 Digital Fast. Agile. User Centric. Focus on the end-user Emphasis on Testing User Experience is significant
Xenonique @peter_pilgrim 10
#1 Digital Digital is the Web Digital is refocusing ideas for online activities
Xenonique @peter_pilgrim 11
#1 Digital
Digital is an attitude Listening to customer needs Embracing conversation and communication
Xenonique @peter_pilgrim 12
#1 Digital
Transformation of our traditional industrial Economy to a 21st Century Mobile to Default one
Xenonique @peter_pilgrim 13
#1 Digital With all of the consequences: politics, society, technology and web infrastructure.
Xenonique @peter_pilgrim 15
Is Java EE helpful to digital developers, designers and architect? Still relevant?
Xenonique @peter_pilgrim 16
Java EE 7 released 2013 Built products on top of a standard platform Transactions, Concurrency, Remote Endpoints, Lifecycle, State, Persistence
Java is a programming language. Java is a virtual machine. Java is a platform.
Xenonique @peter_pilgrim
Main Features• CDI 1.1 • JAX-RS 2 • JSF 2.2 • Servlet 3.1 • EJB 3.1 • JPA 2.1
19
Xenonique @peter_pilgrim 20
#2 WAR is king (or queen) WAR files are now the prefer way to deploy applications for most set-ups EAR files are still supported however RAR files are even rarer (Resource ARchive) PAR files are even rarer still (Persistence ARchive)
Xenonique @peter_pilgrim 21
#2 Containerless
Suits the Docker / chef / Puppet vis-à-vis the provisioning generation Prefer starting up embeddable application server GlassFish or WildFly server over deployment WARs Sadly: Code Hale’s DropWizard only supports Java EE 6
Xenonique @peter_pilgrim 22
#2 Containerless
Suits the Docker / chef / Puppet vis-à-vis the provisioning generation Prefer starting up embeddable application server GlassFish or WildFly server over deployment WARs Sadly: Code Hale’s DropWizard only supports Java EE 6
Xenonique @peter_pilgrim 23
#2 Testable Java EE Arquillian Helps with real-world integration testing Embeddable Container Also help with direct EJB, JPA, JMS testing
Xenonique @peter_pilgrim 24
#2 Java EE better Async Support
Servlet 3.1 has Async support Non-Blocking I/O, HTTP Upgrade mechanism JAX RS 2.0 has Async support Client side API with HATEOS, Filters and Handlers WebSocket 1.0 (Async by default, by protocol) JMS 2.0 (when used in standalone Java SE) Asynchronous API for Reactive Programming yet to be exploited by other frameworks
Xenonique @peter_pilgrim 25
Java EE 7 Developer Handbook September 2013 Packt Publishing Digital Java EE 7 Web APPS May 2015
Xenonique @peter_pilgrim 28
CDI & Faces Scopes @RequestScoped @SessionScoped @ApplicationScoped @ViewScoped* @ConversationScoped* @FlowScoped*
Xenonique @peter_pilgrim 29
#3 View Scoped Retained Page View Scope HTTL Form Data lives for validation Customer sees their input data entered after entering errors Helpful for digital web site
Xenonique @peter_pilgrim 30
#3 View Scoped
Lifecycle dies on a new page view Minable effort for digital developers Helpful for single page forms Login forms, small data entry journeys Already in existence since Java EE 6
Xenonique @peter_pilgrim 31
#3 CDI and EJB
CDI is really useful for code assembly Depend on session EJB less Helpful for single page forms Login forms, small data entry journeys Already in existence since Java EE 6
Xenonique @peter_pilgrim
View Scope
@Named("contactDetailController") @ViewScoped public class ContactDetailController { @EJB ContactDetailService service; private ContactDetail contactDetail = new ContactDetail(); /* ... */ }
32
Xenonique @peter_pilgrim 33
#4 Conversation Scoped Basic Customer Journey Actually existed since Java EE 6 Transient or Persistent Developer controls the life cycle
Xenonique @peter_pilgrim 34
#4 Conversation Scoped Complex Wizard Type Flows Lifecycle between Request and Session Scope Backing Bean must be Serializable Solves a long standing problem with Java Servlet technology with storing items in HttpSession
Xenonique @peter_pilgrim
Conversation Scope
@Named("lendingController") @ConversationScoped public class LendingController implements Serializable { @EJB ApplicantService applicantService; @Inject Conversation conversation; @Inject Utility utility; /* ... */ }
35
Xenonique @peter_pilgrim
Conversation Scope
public class LendingController { /* ... */ public void checkAndStart() { if ( conversation.isTransient()) { conversation.begin(); } recalculatePaymentMonthlyTerm(); } public void checkAndEnd() { if (!conversation.isTransient()) { conversation.end(); } } }
37
Xenonique @peter_pilgrim 38
#5 Flow Scoped Underrated Star of JSF 2.2 Lifecycle between Request and Session Scope Controller, resources & page views with protected and encapsulated access
Xenonique @peter_pilgrim 39
#5 Flow Scoped Flow can be implicit Can be explicitly defined with XML A Flow has one single entry point A Flow has at least one exit point
Xenonique @peter_pilgrim 40
#5 Flow Scoped
Flow can invoke another one Faces Flow are nestable Inbound named parameters Outbound named parameters Special flowScope map collection
Xenonique @peter_pilgrim 41
#5 Flow Scoped
Custom Flow Components Distribute Faces Flows defined in 3rd party JARs Resource Library Contracts Apply CSS, JavaScript and resources Special flow scope map collection To pass data in between Faces Flows
Xenonique @peter_pilgrim
Flow Scoped (Sector)
@Named @FlowScoped("sector-flow") public class SectorFlow implements Serializable { @Inject UtilityHelper utilityHelper; @Inject CarbonFootprintService service; /* ... */ }
42
Xenonique @peter_pilgrim
Flow Scoped (Sector)
public class SectorFlow { /*...*/ @PostConstruct public void initialize() { footprint.setApplicationId( utilityHelper.getNextApplicationId()); } public String gotoEndFlow() { return "/endflow.xhtml"; } }
43
Xenonique @peter_pilgrim
Flow Scoped (Sector)
<faces-config version="2.2" ...> <flow-definition id="sector-flow"> <flow-return id="goHome"> <from-outcome>/index</from-outcome> </flow-return> <flow-return id="endFlow"> <from-outcome>#{sectorFlow.gotoEndFlow()} </from-outcome> </flow-return>
... </faces-config>
44
Xenonique @peter_pilgrim
Flow Scoped (Sector)
<faces-config version="2.2" ...> ... <flow-call id="callFootprintFlow"> <flow-reference> <flow-id>footprint-flow</flow-id> </flow-reference>
<outbound-parameter> <name>param3FromSectorFlow</name> <value>#{sectorFlow.footprint}</value> </outbound-parameter> </flow-call> </flow-definition> </faces-config>
45
Xenonique @peter_pilgrim
Flow Scoped (Footprint)@Named @FlowScoped("footprint-flow") public class FootprintFlow implements Serializable { private CarbonFootprint footprint; public FootprintFlow() { } @PostConstruct public void initialize() {} Map<Object,Object> flowMap = FacesContext.getCurrentInstance() .getApplication().getFlowHandler() .getCurrentFlowScope(); footprint = (CarbonFootprint) flowMap.get("param3Value"); } }
46
Xenonique @peter_pilgrim 48
#6 MVC 1.0
Targeting Java EE 8 JSR 371 Model View Controller Action Oriented Request Framework
Xenonique @peter_pilgrim 49
#6 MVC 1.0
Separate View layer to JSF Standardising on Java RS 2.0 over Servlet 4.0
Influenced by Jersey MVC Templates Appears to direct compete with Spring MVC
Xenonique @peter_pilgrim 50
#6 MVC 1.0
How to customise the view layer? Facelets, Mustache, Handlebars, JSP
Expression language and glue logic? bind the model to the view and Bean ValidaNon
What is the Lifecycle? How long do POJOs live within the framework (CDI)
Xenonique @peter_pilgrim 51
#6 MVC 1.0
Looks a good fit for AngularJS single page applicaNons with EmberJS
IntegraTon JAX-‐RS provide duality Define regular RESTful endpoints and controller
Solo API suits the Web Profile MVC may be bundle with GlassFish Web, Tomcat, Undertow
Xenonique @peter_pilgrim
MVC 1.0 Example
@Path("payments") @Controller public class PaymentsEndpoint { @GET @Path("accounts") public Viewable get() { PaymentDataModel model = somewhere(); return new Viewable( "list-accounts.jsp", model); } } /* API is still changeable */
52
Xenonique @peter_pilgrim 54
#Conclusion(1)
Going Digital with Java EE 7 Perfectly feasible. What do you want? What is it do you really to do?
Xenonique @peter_pilgrim 55
#Conclusion(2)
Micro-services? Check. Transactions? Check ✔ Concurrency? Check ✔ Persistence? Check ✔ REST? Check ✔ Standard platform? Check ✔
Xenonique @peter_pilgrim 56
#Conclusion(3)
Agility? Fast turnaround? Testable? Definitely check ✔ Recruitable? Absolutely ✔ Dependable? ✔ Extendible? ✔ Trainable? But of course ✔
Xenonique @peter_pilgrim 57
#Conclusion(4)
Seriously look at Faces Flows Build small units of functionality in the web (generally) Allow for shake up & down from User Experience Testing Keep an eye on MVC 1.0 and JAX-RS 2.1 Open source libraries need to adopt and catch up!
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://flic.kr/p/dhf3FQ https://www.flickr.com/photos/epsos/ epSos.de Big Beautiful Face Statue in Tenerife https://flic.kr/p/Pp93n https://www.flickr.com/photos/spacesuitcatalyst/ William A. Clark Follow Measurement Measure twice, cut once. https://flic.kr/p/opvVsg https://www.flickr.com/photos/gregbeatty/ Greg Beatty Follow Three Pillars Nikon D800 16-35MM F4.0 https://flic.kr/p/81dXuT https://www.flickr.com/photos/froboy/ Avi Schwab Follow Equipment used for measuring planes of crystals
60
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://flic.kr/p/ayqvZp https://www.flickr.com/photos/throughpaintedeyes/ Ryan Seyeau Follow 1000 Faces of Canada # 0084 - Zombie Walk - Explore! Shot during the annual Zombie Walk in Ottawa. https://flic.kr/p/8XY4tr https://www.flickr.com/photos/creative_stock/ Creativity 103 electronic circuit board https://flic.kr/p/8Y2625 https://www.flickr.com/photos/creative_stock/ Creativity 103 computer motherboard tracks https://flic.kr/p/2QHt7Q https://www.flickr.com/photos/rosefirerising/ rosefirerising Follow Pierre Curie, Piezo-Electroscope
61
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://www.flickr.com/photos/code_martial/ https://flic.kr/p/7jmU5n Tahir Hashmi Follow Developer Death 10 Programmers and a UX Designer died all of a sudden in a war room situation. They were apparently working too hard. https://www.flickr.com/photos/8268882@N06/ https://flic.kr/p/duwd1M Peter Pilgrim IMG_1481 European JUG leaders meeting in Devoxx 2013 https://www.flickr.com/photos/unicefethiopia/ https://flic.kr/p/dv4ooi UNICEF Ethiopia Follow Hamer mother and child South Omo Zone, SNNPR Hamer mother and child South Omo Zone, SNNPR. ©UNICEF Ethiopia/2005/Getachew
62
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://www.flickr.com/photos/15216811@N06/ https://flic.kr/p/baULpM N i c o l a Follow Tree - IMG_1242 https://flic.kr/p/dwCQ7t https://www.flickr.com/photos/90585146@N08/ marsmetn tallahassee Follow IDA .. Integro-Differential Analyzer (Sept., 1952) ...item 2.. Richard Dreyfuss: Technology Has 'Killed Time' -- "In geopolitics, the removal of time is fatal." -- "And you will give up, the protection of Republican Democracy." (July 19 2010) ... https://flic.kr/p/6ZDbiZ https://www.flickr.com/photos/ingmar/ Ingmar Zahorsky Follow Traffic Jam Accidents are common on the narrow streets going through the mountains of Nepal. When such an accident occurs, traffic is often halted for up to 3-4 hours. https://flic.kr/p/FAskC https://www.flickr.com/photos/mari1008/ mari_1008 Follow traffic jam -B Date: April,2th Address: Jiangshu Rd,Shanghai,China. Around 8:30 AM today, A little accident on YuYuan Rd and JiangSu Rd caused traffic jam.
63
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://flic.kr/p/bpss6D https://www.flickr.com/photos/76029035@N02/ Victor1558 Follow Creative_Photoshop_HD_Wallpapers_laba.ws https://flic.kr/p/mLxu3m https://www.flickr.com/photos/astrangelyisolatedplace/ astrangelyisolatedplace Follow Office test #1. Setup fully functional. A rare 1200 no longer in production. Test run soundtracked by the only #vinyl in the office; The Sesame Street Soundtrack - a surprise present by @idinesh #technics #turntable #1200 #ocdv1 via Instagram ift.tt/1hpeUEU https://flic.kr/p/gLPhEk https://www.flickr.com/photos/stevecorey/ Steve Corey Follow Treasure Hunt, a short story (5 images)
64
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://flic.kr/p/4JcerK https://www.flickr.com/photos/16949884@N00/ Bömmel Follow Ice Crystal Ice is nice https://flic.kr/p/dSsXiZ https://www.flickr.com/photos/jeremyhall/ Jeremy Hall Follow Called to Serve (suit and tie) https://flic.kr/p/3enERy https://www.flickr.com/photos/paolocampioni/ Paolo Campioni Follow scala Scendo (stair case spiral)
65
Xenonique @peter_pilgrim
List of Creative Commons (2.0) photography attributions
https://flic.kr/p/m62gmK https://www.flickr.com/photos/lata/ -p Follow Abstraction I. From my platycerium. (Guide: Voronoi diagram) https://flic.kr/p/9F7Nnn https://www.flickr.com/photos/followtheseinstructions/ Follow these instructions The end ; Assignment: This time your assignment is to find or compose a scene that conveys the essence of the end. https://flic.kr/p/6WSFR4 https://www.flickr.com/photos/62337512@N00/ anthony kelly Follow big ben big ben and underground sign https://flic.kr/p/w7qef https://www.flickr.com/photos/cobalt/ cobalt123 Follow All We are Saying... (Thought for a New Year) Peace Pasta from Annie's, with peas, of course. Give Peace A Chance
66
top related