future of jsf / oracle adf · 2018-06-14 · oracle adf - now and future oracle adf is based on...

Post on 18-Apr-2020

37 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Future of JSF / Oracle ADF“Good bye J2EE?” No!, It is time for Jakarta EE!

Daniel Merchán García

Agenda

• Introduction

• J2EE? Time for Jakarta EE!

• Server Side vs Front Side

• Java Server Faces (JSF): Roadmap and JSF 2.3+

• Oracle Application Development Framework (ADF): Roadmap

• Comparison: Oracle ADF 12cR2 (JSF 2.2) vs JSF 2.3

• Conclusion

• Contact Details

• Questions / Share your thoughts ☺

IntroductionWhat’s my future as an J2EE Architect / Developer?

J2EE is now Jakarta EE

Oracle has given Java EE to Eclipse

Foundation.

It is not EE4J (Eclipse Enterprise for Java)

the name selected is Jakarta EE.

The latest release of J2EE under Oracle

was Java EE 8.

The migration to Jakarta EE is still in

process.

javax.enterprisepackages will not be

re-factored to eclipse.org

Progress of the Journey Java EE to Jakarta EE

https://github.com/eclipse-ee4j

What we have right now in Java EE 8?

Java EE Security API – JSR 375

• Identity Store and Authentication to abstract vendor specific security.

JSON-B / JSON-P / JAX-RS (Enhancements)

• Enhance Java JSON API support with Marshal / Un-marshal JSON to Java Objects as same as JAX-WS does.

JPA 2.2

• Provides stream()result support (similar to Hibernate)

• @Repeatable annotation to allow using the same annotation multiple times in the same class.

• Alignment with Java Date / Time

What we have right now in Java EE 8?

JSF 2.3

• Web Socket Support

• CDI Alignment

• JSF Manage Bean Deprecation

• Validation / Conversion Improvements

• UI Component / API enhancements

• Alignment with Java 8 Date / Time new API

Servlet 4.0

• HTTP 2.0 Support

• Request / Response multiplexing

• Stream prioritizing

• Server push.

CDI 2 and Bean Validation 2

• Big improvements in @Observers and the inclusion of Asynchronous events.

• Alignment with Java 8 such as streams, lambdas and the new Date / Time API…

What’s coming now with Jakarta EE

Moving to Cloud-Native, Microservices friendly Java Enterprise.

• MicroProfile merge in Jakarta EE?

Deprecate old and un-used technologies in Java EE to move forward quickly.

Make the first Jakarta EE compatible release with Java EE 8

Now the community decides. Welcome back to Open Source! We do not depend to any vendor anymore ☺

IntroductionServer Side vs Front End Side

JavaScript Frameworks everywhere!

A typical conversation with a Front-End evangelist

(me) “Hello friend!, I am using JSF 2.3 with PrimeFacesfor building my Enterprise Application! It looks great!”

(friend) No, wait!! That’s old, slow and not modern! “Use Angular JS it is the best!” move on from Java!

(friend)(2 minutes later): “Angular JS now using types??? It remembers me to Java. Don’t use it”

(friend)(2,1 minutes later) “Use React is the best! Angular is shit”

(me) Ok… let me try Front-End. What automating framework should I use? Grunt?

(friend) Why are you using Grunt? Use Gulp is the best!!!...

(friend) (3 minutes later webpack is released): No wait!… use webpack! Gulp is old!.

Server Side or Front-End Framework

Do not be seduced by trending’s.

“Old” technology frameworks are more mature and stable.

Open your mind and become a Full-Stack developer.

Combine the force of Java and JavaScript!

History / RoadmapJava Server Faces

JavaServer Faces History

JSF 1.0 / 1.1

•2004

JSF 1.2

•2006

JSF 2.0

•2009

JSF 2.1

•2010

JSF 2.2

•2013

JSF 2.3

•2017

JSF 2.4 / Next

•2018 - 2019

What we have in JSF 2.3+?

• Following slides contains some of the most important updates on JSF 2.3 published in 2017.

• Some of them can be “work-around in Oracle ADF” with some coding.

• Some of them are really great

• Not all of news and updates are covered!, but it will give a great idea!.

JSF 2.3: CDI Bean Alignment

• @Inject your JSF Objects and avoid the infinite code length typically produced in JSF. Ready for CDI!.

• New EL Expressions to simplify the access to JSF objects.

• New @ManagedProperty annotation CDI Compatible for @Inject an EL Expression

• Deprecation of JSF Managed Beans. Do not use javax.faces.beans anymore!

• For JSF specific scopes: FlowScope and ViewScope use the CDI equivalents in javax.faces.view

JSF 2.3: Lifecycle

• In JSF 2.0 <f:event> and JSF 2.2 <f:viewAction> (which allows to execute only in Postback) were introduced. Both have similar functionalities for executing server code in a specific moment of the new JSF Events introduced as part of JSF 2.0

• In JSF 2.3 a new event has been added to the lifecycle: PostRenderViewEvent to be the opposite / friend of PreRenderViewEvent

• We can use this event for executing code after rendering the component without penalizing the initial loading.

JSF 2.3: NetworkingWeb Socket

• Native support for WebSocket

• New tag <f:websocket> which creates a communication channel

• Use PushContext object @Inject @Push(name=“channelName”) for pushing information to UI

JSF 2.3: AJAX (h:commnadScript)

• Encapsulate AJAX requests in JavaScript functions placed in the Global Scope.

• Extends UICommand so it admits action, actionListener, immediate, render, execute…

JSF 2.3: API Enhancement

• UIData and UIRepeat allows now to also now to iterate over java.util.Map.

• Custom types for UIRepeat / UIData can be created by registering our own @FacesDataModel

• Note: Built-in types cannot be overridden!!!

JSF 2.3: Validation

• Bean Validation has its limitation in JSF 2.2. Limited to validating individual properties bound to individual components

• Bean validation also has a concept of class level validation. This special validator can then do cross-field validations. For instance, check that values (different fields) are equal.

• Class level validation does not play well with the JSF validation model though. In JSF the model is not updated if a validation fails. But, a class level validation requires a updated model!

• In JSF 2.3+ has been introduced <f:validateWholeBean> to enable class level validation and address this scenario.

JSF 2.3: f:validateWholeBean ExampleDefine Validator

JSF 2.3: f:validateWholeBean ExampleDefine Validator

JSF 2.3: f:validateWholeBean ExampleUse in Backing Bean

JSF 2.3: f:validateWholeBean ExampleFacelets View

JSF 2.3: Conversion

• JDK 8 Date Time API Support!. Now you can use f:converDateTime with the new Java API – JSR 310

• JSF 2.2/2.3: When the converter type attribute value is {date, time, both} uses the java.text.SimpleDateFormat class.

• Starting with JSF 2.3, when the converter type attribute value is {localDate, localTime, localDateTime, offsetTime, offsetDateTime , zonedDateTime}, the java.time.format.DateTimeFormatter class will be used.

JSF 2.3: ComponentsComponent Search FMW

• Identifying a particular component in its component tree by using an absolute hierarchical ID, or a relative local ID. Constructing the absolute ID is not always easy, especially not if a page makes extensive use of templates and includes.

• In JSF 2.3+ has been introduced a Component Search Framework

JSF 2.3: ComponentsComponent Search FMW

• This table displays the keywords that can be used to easily search for a component in the JSF Tree.

Keyword Description

@child(n) The nth child of the base component

@compositeThe closest composite component ancestor of the base component

@id(id)All component descendants of the base component with the specified component id

@namingcontainerThe closest NamingContainer ancestor of the base component

@nextThe next component in the view after the base component

@parent The parent of the base component

@previous The previous component to the base component

@root The UIViewRoot

JSF 2.3: ComponentsComponent Search FMW Example

ExpressionBase component

Resolves to:

@child(0) :f1<h:button id=“b1" outcome=“lol">Button foo</h:button>

@child(1) :f1<h:commandButton id=“cb1" action="#{configurationBean.foo()}" value="invoke foo"/>

@id(body) :f1 <h:outputText id="body" value="body"/>

@namingcontainer :f1:cb1 <h:form id=“f1">

@next :f1:cb1 <h:outputText id="body" value="body"/>

@parent :f1 <h:panelGroup id=“pg">

@previous :f1:cb1<h:button id=“b1" outcome=“lol">Button foo</h:button>

@root :f1 [UIViewRoot]

JSF 2.3: ComponentsComponent Search FMW Example

JSF 2.3: Components (Summary)

• rowClass in dataTable. Yes… Finally!

• Single Radio button component! <h:selectOneRadio>

• Automatic Conversion in UISelectMany.

• And more…

https://arjan-tijms.omnifaces.org/p/jsf-23.html#1238

https://dzone.com/articles/javaserver-faces-23-1

History / RoadmapOracle Application Development Framework

Oracle ADF History

ADF 10g

• 2004

ADF 11gR1

• 2007

• JSF 1.2

ADF11gR2

• 2011

• JSF 2.0

ADF 12cR1

• 2013

• JSF 2.0

ADF 12cR2

• 2015

• JSF 2.2

???

• ???

Oracle ADF - Now and Future

Oracle ADF is based on JavaServer Faces. You love it or hate it. There is not middle point. ☺

Oracle ADF 12.2.1.3 (latest release) is based on JSF 2.2.

There are not plans for upgrading Oracle ADF to be aligned with JSF 2.3+ and beyond.

Oracle ADF is still supported by Oracle, but it will not receive major improvements or upgrades.

Should I still use Oracle ADF? Yes…, but….

• Oracle ADF Business Components are a great option for building business services and expose as REST.

• Oracle JET does not replace Oracle ADF <- They are different!

• Stable and mature.

• Excellent for Java background developers for building internal Enterprise Applications.

Yes:

• No plans for improving / enhancing the framework. Only bug fixing.

• ADF Faces is not evolving as other JSF implementations such as PrimeFaces.

• Oracle ADF developers are becoming the new “COBOL” developers. The community is decreasing compared to Oracle JET or other Front-End framework technologies.

But:

Oracle ADF 12cR2 (JSF 2.2) vs JSF 2.3+Equivalent or how to use “JSF2.3” in ADF 12cR2 (JSF2.2)

Can I use CDI Manage Beans in Oracle ADF?

• Oracle WebLogic 12cR2+ is compatible with CDI Managed Beans.

• You can enable CDI in your Oracle ADF Projects if you are using Java EE6+

• When trying to use CDI annotations, JDeveloper will suggest to configure CDI support and creates beans.xml for you

CDI Managed Bean in Oracle ADF

Should I only use CDI in Oracle ADF as JSF Managed Beans are deprecated in 2.3?• My suggestion is: NO! Oracle does

not has plan to move into JSF 2.3• Injecting CDI in JSF and vice-versa

requires some extra coding. It does not work using annotations.

• JDeveloper IDE suggestions / code assistant does not work properly with CDI Managed Beans.

• JSF 2.2 is not fully ready for inject CDI in Validator / Converter and other JSF Artefacts.

• JSF 2.3 CDI compatible scope called FlowScope is not equivalent to PageFlowScope in Oracle ADF.

Web Socket

Endpoint

Server Listener

ADF Application

Web Socket

Client

Using Web Sockets in Oracle ADF

• Oracle ADF does not provide <f:websocket>. But Web Sockets can be used anyway in a non-declarative way.

• Create your Web Socket Endpoint (Server Side)

• Connect from your ADF Application to listen messages pushed from the Server.

Using Web Sockets in ADF

Clie

nt

Serv

er

h:commandScript… I know you…

JSF 2.3

ADF 12c

Validatation

Update Model

Invoke

Application

(actionListener)

Validate Fields

Simulate - Perform Class-

Level Validation

f:validateWholeBean in ADF 12c?

• No!, but we can continue with the alternative

• Validation in Field level.

• Validation in ActionListener for simulate the Class-Validator multifield behavior

Java 8 Date / Time in ADF 12c

• af:convertDateTime does not support the new JSR-310 Date Time API

• Create your own Converter is the alternative.

Component Search Framework in ADF?

• Use the traditional ADFUtils findComponent auxiliar method as you did always.

Conclusion

My personal view on our future

Summary

Coding in Oracle ADF feels “retro”

Oracle ADF is still a valid option for developing

Enterprise Applications.

JSF 2.3 introduced many improvements, but the most

of them they have a code driven alternative in Oracle

ADF as shown in this presentation.

Oracle should align ADF with new J2SE API Standards such as the new Date / Time API.

THINK TWICE before choosing Oracle ADF for

your project.

Questions?

Share your thoughts ☺

ContactDaniel Merchán GarcíaArchitect / Developer / DreamerMagic Pigeon Ltd

Website: https://magicpigeon.com

Blog: http://danielmerchanoracle.blogspot.co.uk

Email: daniel.merchan@magicpigeon.com

Twitter: https://twitter.com/dmerchang

LinkedIn: https://www.linkedin.com/in/danielmerchangarcia/

Co-Author of Beginning Oracle WebCenter Portal 12c Book

3 Membership Tiers• Oracle ACE Director• Oracle ACE• Oracle ACE Associate

bit.ly/OracleACEProgram

500+ Technical Experts Helping Peers Globally

Connect:

Nominate yourself or someone you know: acenomination.oracle.com

@oracleace

Facebook.com/oracleaces

oracle-ace_ww@oracle.com

top related