Apache MyFaces Trinidad 1.2 Web Application Groundwork: Part 2

3 min read

Deployment

Deployment is very easy because with Seam-gen, we also inherit the deployment mechanism (already run during the project setup, earlier) provided by the Ant build process of Seam-gen. However, a few notes regarding the specific deployment of a Trinidad and Facelet web application in contrast with Seam-gen are discussed in more detail in the upcoming topics. The following screenshot shows the referenced libraries within the Eclipse IDE:

Trinidad-specific and Facelet-related changes to the project files

First of all, the lib directory lacks the Trinidad JAR files and the Facelet JAR:

  • jsf-facelets-1.1.14.jar
  • trinidad-api-1.2.9.jar
  • trinidad-impl-1.2.9.jar

So above JAR files must be added to the lib directory while others, such as the RichFaces JARs, should be removed as we want to achieve a clean setup of a single component library. A mix-up should be avoided to keep away from integration problems. The following screenshot shows the contents of the lib directory inside Eclipse (part I only shows files not referenced by the Eclipse project):

Most importantly, we need to update the file deployed-jars.list, as it is looked at by the build process to provide the application server with the required JAR files. So we reduce this list file to a more minimal Trinidad-specific version:

  • antlr-runtime.jar
  • commons-beanutils.jar
  • commons-digester.jar
  • core.jar
  • drools-compiler.jar
  • drools-core.jar
  • janino.jar
  • jboss-el.jar
  • jboss-seam.jar
  • jboss-seam-*.jar
  • jbpm-jpdl.jar
  • jsf-facelets-1.1.14.jar
  • mvel14.jar
  • trinidad-api-1.2.10.jar
  • trinidad-impl-1.2.10.jar

The following screenshot shows the contents of the lib directory inside Eclipse (part II only shows files not referenced by the Eclipse project):

Next, in the resources directory we must add a provider for Seam’s conversation mechanism to support Seam conversations in Trinidad dialogs. Its file name must follow the Trinidad naming convention for this provider type, and it must be located below resources in META-INF/services:

  • File name: org.apache.myfaces.trinidad.PageFlowScopeProvider
  • Contents: It must contain the name and package path of the provider class, for example, trinidad.SeamPageFlowScopeProviderImpl

This class is created as an implementation of Trinidad’s abstract class PageFlowScopeProvider that can be easily done with Eclipse’s comfortable class creation wizard.

There are further simplifications:

  1. The org.jboss.seam.ui.richfaces package in the resources directory is required for Seam’s support of RichFaces, but is obsolete for us and should thus be deleted
  2. In the WEB-INF directory, we can carry out the following activities:
    • We can add a folder for Facelet composition components
    • We can simplify the components.xml file by getting rid of persistence declarations such as persistence:managed-persistence-context, persistence:entity-manager-factory, and drools:rule-base declarations (the security we only leave is the one for the identity object)
    • The faces-config must be adapted to suit the Trinidad renderer as described earlier
    • The pages.xml becomes even simpler as we practically avoid it altogether using the dialog framework as described in the navigation section earlier
    • We must modify the web.xml to suit Trinidad’s requirements
    • We must add three additional files, namely the trinidad-config.xml, the trinidad-skins.xml, and a taglib.xml to declare the Facelet composition components
    • The *-dev-ds.xml and *-prod-ds.xml files may be emptied of any specific data because no database-backing is used in our test project
Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago