• Save
MyFaces CODI and JBoss Seam3 become Apache DeltaSpike
Upcoming SlideShare
Loading in...5
×
 

MyFaces CODI and JBoss Seam3 become Apache DeltaSpike

on

  • 9,322 views

These slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain as well as common pitfalls. Beyond that there ...

These slides show how to use type-safe mechanisms provided by MyFaces CODI for developing JSF applications which are more type-safe and easier to maintain as well as common pitfalls. Beyond that there is an basic overview of Apache DeltaSpike.

Statistics

Views

Total Views
9,322
Views on SlideShare
4,251
Embed Views
5,071

Actions

Likes
3
Downloads
33
Comments
0

43 Embeds 5,071

http://os890.blogspot.com 1235
http://os890.blogspot.co.at 1130
http://os890.blogspot.de 890
http://os890.blogspot.com.br 355
http://os890.blogspot.fr 170
http://os890.blogspot.se 130
http://os890.blogspot.it 95
http://os890.blogspot.ru 91
http://os890.blogspot.ca 84
http://os890.blogspot.nl 79
http://os890.blogspot.ch 73
http://os890.blogspot.co.uk 72
http://os890.blogspot.in 65
http://os890.blogspot.jp 62
http://os890.blogspot.com.es 60
http://os890.blogspot.com.au 56
http://os890.blogspot.no 47
http://os890.blogspot.be 43
https://twitter.com 42
http://os890.blogspot.cz 41
http://os890.blogspot.hk 30
http://os890.blogspot.sk 30
http://os890.blogspot.hu 18
http://os890.blogspot.com.ar 16
http://os890.blogspot.mx 16
http://os890.blogspot.com.tr 15
http://os890.blogspot.fi 15
http://os890.blogspot.gr 13
http://os890.blogspot.dk 12
http://os890.blogspot.ie 11
http://os890.blogspot.pt 11
http://os890.blogspot.kr 10
http://os890.blogspot.ro 10
http://os890.blogspot.co.nz 9
http://os890.blogspot.tw 7
http://os890.blogspot.sg 6
http://webcache.googleusercontent.com 5
http://os890.blogspot.co.il 5
https://si0.twimg.com 4
http://os890.blogspot.ae 3
http://translate.googleusercontent.com 3
http://www.tubebox.us 1
http://www.os890.blogspot.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MyFaces CODI and JBoss Seam3 become Apache DeltaSpike MyFaces CODI and JBoss Seam3 become Apache DeltaSpike Presentation Transcript

  • MYFACES CODI AND JBOSS SEAM3BECOME APACHE DELTASPIKE
  • Apache MyFaces CODI is …• … a portable CDI extension (no CDI implementation)• … compatible with Java-EE5+• … tested on most major servers• … easy to use and extensible• … very fast and stable• … one "part" of Apache DeltaSpike• … one of few popular CDI extensions• … optimized for large applications• … developed by an open community
  • History of MyFaces CODI• Apache MyFaces Orchestra introduced interesting concepts in combination with Spring• 12-2009 CDI 1.0• 2-2010 MyFaces ExtCDI (aka CODI) started• 11-2010 first stable release (6 modules)• 7-2011 release of v1.0.0 (formal step - CODI was very stable already) View slide
  • Setup MyFaces CODI for Servlet Containers• Add the CDI implementation of your choice• Add MyFaces CODI to the project – With Maven • Add the modules (or the all-in-one bundle) to the POM – Without Maven • Download the current version of CODI • Add the modules (or the all-in-one bundle) to the Classpath of the project• Start using it! View slide
  • Webapp Setup by Example with Maven - 1• The easy way: Add the all-in-one bundle for the version of JSF you are using (1.2.x or 2.x) Example for JSF 2.x <dependency> <groupId>org.apache.myfaces.extensions.cdi.bundles</groupId> <artifactId>myfaces-extcdi-bundle-jsf20</artifactId> <version>1.0.5</version> <scope>compile</scope> </dependency>
  • Webapp Setup by Example with Maven - 2• An alternative: Generate a template project mvn archetype:generate -DarchetypeCatalog= http://myfaces.apache.org Example for JSF 2.x
  • Webapp Setup by Example without Maven• Download the binary distribution which contains all modules: http://s.apache.org/myfaces_binaries/ -> e.g.: myfaces-extcdi-assembly-jsf20-1.0.5-bin.zip or the all-in-one bundle: http://s.apache.org/codi_mvn_bundles -> e.g.: myfaces-extcdi-bundle-jsf20/1.0.5/ myfaces-extcdi-bundle-jsf20-1.0.5.jar• Add the JAR(s) of your choice to /WEB-INF/lib
  • MyFaces CODI Modules - Overview - 1• Core• JSF Module (for 1.2 and 2.x)• JPA Module• BV Module• I18N-Message Module• Scripting Module
  • MyFaces CODI Modules - Overview - 2• Trinidad Support Module (for 1.x and 2.x)• Java-EE5 Support Module• Bundles (+ OSGi Bundles)• Test Modules• Alternative Config and Impl Modules
  • MyFaces CODI – TOP 10 (unordered)• Type-safe and extensible Project-Stages• Conditional bean activation• Scopes• Type-safe View-Config and Navigation Workshop• Type-safe CODI-Config examples• View-Controller• Extensibility (Security, Interceptors, Factories, …)• Advanced I18n• Transactional beans without EJBs• Configurable JPA DataSource
  • Symbols DS … Same concept used for DeltaSpike DS … Similar concept used for DeltaSpike DS … Concept planned for DeltaSpike
  • Type-safe and extensible Project-Stages DS• … with Java-EE6 – Only available in JSF – Not type-safe – Not extensible• … with MyFaces CODI – Available for all CDI based applications – Type-safe – Extensible
  • Project-Stages Configuration by Example• Configuration – Not in the deployable archive (e.g. web.xml) – Via build- or container-configuration – Useful e.g. in combination with maven profiles• Example with Jetty (+ Maven3) <configuration> <systemProperties> <systemProperty> <name>faces.PROJECT_STAGE</name> <value>Development</value> </systemProperty> </systemProperties> </configuration>
  • Conditional Bean Activation DS• … with Java-EE6 – Not out-of-the-box (Manually via a CDI-Extension and ProcessAnnotatedType#veto)• … with MyFaces CODI – @ProjectStageActivated (supports also custom project-stages) – @ExpressionActivated (+ customizable expression syntax)
  • @ProjectStageActivated by Example@Alternative //+ config in beans.xml@ProjectStageActivated(ProjectStage.Production.class)public class ProductionCodiCoreConfig extends CodiCoreConfig{ @Override public boolean isConfigurationLoggingEnabled() { return false; }}
  • Scopes• … with std. CDI and JSF (JSF Scopes not integrated ) – Request-, Session-, Application-Scope – View-, Flash-, Custom-, None-Scope (JSF) – Conversation-, Dependent, Singleton-Scope (CDI)• … with MyFaces CODI – Autom. converts JSF beans to CDI beans DS – Window-, (Grouped-)Conversation-, ViewAccess-, Rest-Scope (for CDI + JSF) – Transaction-Scope (for CDI) Different types of conversations
  • CODI Scopes by Example - Window-Scope• Without MyFaces CODI – e.g.: @SessionScoped public class MyBean implements Serializable { //… } -> multiple Browser-Tabs use the same instances• With MyFaces CODI – e.g.: @WindowScoped public class MyBean implements Serializable { //… }
  • Destroy MyFaces CODI Conversations• Close a conversation @Inject private Conversation conversation; this.conversation.close();• Use the Window-Context @Inject private WindowContext windowContext; this.windowContext.close(); //and #close*
  • Type-safe View-Config• … with std. JSF – Not available• … with MyFaces CODI DS – Type-safe navigation – View-Controller, Security,… – Meta-data inheritance – Custom meta-data – Checked target regions
  • Type-safe View-Config by Example – 1• Allow to – host meta-data for pages – structure pages – navigate in a type-safe way – inherit meta-data• Inline usage at page-beans is possible• Example for index.xhtml @Page public class Index implements ViewConfig {}
  • Type-safe View-Config by Example – 2• POST-Requests <h:commandButton … action="#{myPageController.next}"/> public Class<? extends ViewConfig> next() { //Pages extends ViewConfig, Index implements Pages return Pages.Index.class; }• GET-Requests <h:link ... outcome="#{myPageController.nextPage}"/> public Class<? extends Pages> getNextPage() { //Pages extends ViewConfig, Index implements Pages return Pages.Index.class; }
  • Type-safe View-Config - Advanced• http://s.apache.org/make-jsf-more-typesafe – View-Controller Annotations – Integration with @Secured – Default Error-View – Easy manual navigation via ViewNavigationHandler – Observe a pre-navigation event (navigation target can be changed) – Custom Meta-data –…
  • MYFACES CODI - A QUICK TOUR
  • Migrating the exampleFROM SERVLET CONTAINERTO APPLICATION SERVER
  • Migration to Java-EE6+ Application Server• General steps for all servers: – Java-EE dependencies are provided by the server (-> don’t deploy them) – Remove the CDI listener (web.xml)
  • Migration to Oracle GlassFish 3.1.x• Java-EE6 reference implementation• CDI Implementation: JBoss Weld• Use version 3.1.2+ if possible (at least v3.1.1)• Needed changes: – Std. changes for Java-EE6+ – See BDA hints esp. for GlassFish < v3.1.2
  • Migration to IBM WebSphere 8• First WAS version which implements Java-EE6• CDI Implementation: OpenWebBeans (with BDA)• Use version 8.0.0.1+• Needed changes: – Std. changes for Java-EE6+ – See BDA hints (OpenWebBeans is used in BDA mode)
  • Migration to JBoss-AS7• JBoss Application Server (implemented from scratch)• Since 7.1 Java-EE6 full profile• CDI Implementation: JBoss Weld• Needed changes: – Std. changes for Java-EE6+ – See BDA hints
  • Migration to Oracle Weblogic 12c (R1)• First WLS version which implements Java-EE6• CDI Implementation: JBoss Weld 1.1.3_SP1• Needed changes: – Std. changes for Java-EE6+ – See BDA hints – Use the all-in-one bundle of MyFaces CODI 1.0.5+
  • Migration to Apache TomEE v1• TomEE is based on a std. Tomcat – Java-EE6 Web-Profile CDI, EJB, JPA, JSF, JSP, JSTL, JTA, Servlet, JavaMail, Bean Validation – TomEE+ adds JAX-RS, JAX-WS, JMS, Connectors• CDI Implementation: Apache OpenWebBeans• Needed changes: – Std. changes for Java-EE6+ -> That’s it
  • Using MyFaces CODI with …• A list of tested servers and frameworks: http://s.apache.org/CODI_Compatibility
  • Common Pitfalls – Bootstrapping order• Java-EE6 servers usually start CDI before JSF• Not all servers have a deterministic order• Sometimes it depends on the version – e.g.: Jetty6 vs Jetty7 (vs Jetty8)• Exception: IllegalStateException: no […]BeanManagerProvider in place! Please ensure that you configured the CDI implementation of your choice properly. If your setup is correct, please clear all caches and compiled artifacts. If there is still a problem, try one of the controlled bootstrapping add-ons for the CDI implementation you are using.• Solutions: – The exception provides the details already – Another exception occurred before -> fix it
  • Common Pitfalls – Cross-BDAs issues• Bean deployment archives The implementation depends on the interpretation of the specification• Spec. issues: CDI-18, CDI-112 – A strict implementation restricts various artifacts to the same bean archive – A misinterpretation or bug can break applications easily E.g.: @Alternative annotated beans are only valid for the same archive -> breaks a lot of use-cases -> OWB (standalone) ignores this rule by default• Implementation issues: – Several versions of Weld < v1.1.4 are broken e.g. regarding @Specialize WELD-912, WELD-974,…
  • Common Pitfalls – BDAs (of CDI 1.0) - 1• Exceptions – Enabled interceptor class SecurityInterceptor is neither annotated @Interceptor nor registered through a portable extension – No bean found for type: [CODI class] – Unsatisfied dependencies for type [CODI class]• Solutions (steps): step until it works 1. Use the all-in-one package of MyFaces CODI Follow it step by 2. Copy the content of beans.xml to the beans.xml of the application 3. The version of the CDI implementation is utterly broken -> upgrade it
  • Common Pitfalls – BDAs (of CDI 1.0) - 2• Exceptions – Interceptor class: SecurityInterceptor is already defined• Solutions: – Ensure that jar files aren’t duplicated in the deployed archive (e.g. different versions,…) – Clear IDE and server caches (if it happens during the development process)
  • Common Pitfalls – Old Versions• Try to use the newest version of the application-server of your choice from the very beginning• It isn‘t just about small tweaks. Some old versions are utterly broken• If an old version can’t be avoided, upgrade the CDI implementation (if possible)
  • Common Pitfalls – ContextNotActive• Top 3 reasons 1. Invalid usage (e.g. JSF specific context used in a Servlet-Filter, Batch-Job,…) 2. Configuration issue 3. Implementation issue (of the context)
  • … closes the gaps!APACHE DELTASPIKE
  • History of DeltaSpike• 12-2011 accepted to join the Apache Incubator• 2-2012 first release (0.1-incubating)
  • ASF Mentors• David Blevins• Gerhard Petracek• Jim Jagielski• Mark Struberg• Matt Benson• Matthias Wessendorf
  • Initial Committers - 1• Andy Gibson• Antoine Sabot-Durand• Arne Limburg• Brian Leathem• Cody Lerum• David Blevins• George Gastaldi• Gerhard Petracek
  • Initial Committers - 2• Jakob Korherr• Jason Porter• John Ament• Jozef Hartinger• Ken Finnigan• Marius Bogoevici• Mark Struberg• Matthias Wessendorf
  • Initial Committers - 3• Pete Muir• Pete Royle• Rick Hightower• Shane Bryzak• Stuart Douglas• //some joined short afterwards
  • DeltaSpike Modules• 0.1-incubating – Core (new)• 0.2-incubating – Core (improved) – Security (new)
  • DeltaSpike closes the gaps between …• … Java-EE and the needs of real-world applications• … different CDI communities
  • History of Apache DeltaSpike Java-EE with CDI Java-EE Other Seam2 Seam3without CDI Extensions Spring DeltaSpike Framework MyFaces MyFaces CODI Orchestra + CDI implementation
  • MyFaces CODI to DeltaSpike Migration• Discussions are started with the original feature/concept• Everybody is welcome to provide a refinement or counter-proposal• If there is no better solution and there are no major objections, a feature will be added• The community tries to merge everything which is completely portable
  • Apache DeltaSpike.Next• Simple answer: There is no fixed master plan! The future depends on the community -> get involved!
  • DELTASPIKE - A QUICK TOUR
  • FINAL Q & A
  • Links• http://myfaces.apache.org/extensions/cdi/• https://cwiki.apache.org/confluence/display/EXTCDI/Index• https://svn.apache.org/repos/asf/myfaces/extensions/cdi/• http://twitter.com/MyFacesTeam• http://myfaces.apache.org/extensions/cdi/mail-lists.html• https://cwiki.apache.org/confluence/display/DeltaSpike• http://s.apache.org/ds_git• https://builds.apache.org/view/A-F/view/DeltaSpike/• http://twitter.com/DeltaSpikeTeam