Java Reference
In-Depth Information
behind these services and life-cycle stages. This is imperative to write code that will
respond correctly to life-cycle state changes. It will also help the developers appropriately
set configuration metadata and prevent unexpected results.
Since the entire business logic is now in the SLSB, chances are high that in a large-
scale application like eInsure that it will grow quickly to an unmanageable size. The
session facade not only intercepts business logic invocation, but also each method in the
SLSB is responsible for executing business rules. Hence, it also violated SRP. A simpler
option would be to model the session facade like a front controller servlet. It only takes
the responsibility of intercepting the business method execution requests. The actual
task of business logic execution is delegated to the helper classes.
The session facades run in the EJB container. As a result, they were difficult to unit
test. A prospective client of eInsure could not afford commercial application server
licenses. Hence, they wanted to deploy this application on open source products. Their
team was already using an Apache Tomcat and ObjectWeb JOTM-based platform to run a
few applications. Hence, they wanted to leverage the Tomcat web server with the JDBC-
based transaction-processing capabilities of the JOTM transaction monitor. However,
because the all-important business tier of eInsure was tightly coupled to SLSB, it would
be a painful and effort-intensive activity to successfully run eInsure without an EJB con-
tainer support.
Forces
• Session bean development requires experienced developers with sound knowledge
of EJBs and application servers.
• The session facade should act only as a gateway to the business tier and delegate
the actual business logic execution to helpers. It should declaratively subscribe to
container services.
• Session facades should not grow to an unmanageable proportion.
• Business logic should run outside an EJB container.
• Business logic should be easy to unit test.
Solution
Use an application service to concentrate business logic in POJO classes.
 
Search WWH ::




Custom Search