11. Possible Variations and Extensions

11.1. Using resource URLs

Whenever an app provides public information about entities, such as the books available in a public library, it is desirable to publish this information with the help of self-descriptive resource URLs, such as http://publiclibrary.norfolk.city/books/006251587X, which would be the resource URL for retrieving information about the book "Weaving the Web" available in the public library of Norfolk. However, resource URLs are not supported by JSF. In the Java world, we would have to use JAX-RS, instead of JSF, for programming a web API with resource URLs. But this would imply that we need to take care of the front-end UI in a different way, since JAX-RS is a pure back-end API, not providing any support for building user interfaces. A natural option would be to use a JavaScript front-end framework, such as BackboneJS or ReactJS, for rendering the UI.

11.2. Using an alternative DBMS

Instead of MySQL, one can use various other database management systems for persistent storage. The following four steps are required to specify the used DBMS (only one DBMS at a time is possible):

  • Configure TomEE so it uses the corresponding resource for your application. For a list of resource configuration examples used for common DBMS's, check Common DataSource Configurations. For example, if PostgreSQL was chosen as DBMS, then edit the conf/tomee.xml file and add the following code:

    <Resource id="application-persistence-unit-name" type="DataSource">
      JdbcDriver   org.postgresql.Driver
      JdbcUrl  jdbc:postgresql://host/database-name
      UserName     dbms-username
      Password     user-password
    </Resource>
  • Copy the jar file corresponding to the DBMS driver implementation to the lib folder. After this, the TomEE server needs to be restarted.

  • Install the DBMS, if not already installed. Installation instructions are usually available on the corresponding DBMS web page.

  • Create the corresponding DBMS user and database to be used for your application.