Apache MyFaces Trinidad 1.2 Web Application Groundwork: Part 2

0
80
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

LEAVE A REPLY

Please enter your comment!
Please enter your name here