A complete lesson on designing Java EE applications is well beyond the scope of
this topic, but we'll walk you through some of the variations and exciting new possibil-
ities that come with enterprise OSG i.
Use small WABs
Many Java EE WAR s are pretty big beasts. Not only does the WAR include its own code
and image resources, it often packages all of its dependencies in the WEB-INF /lib
folder. The WAR is acting almost like a mini- EAR , only with less explicit metadata.
Nobody likes massive WAR s, but sometimes keeping all your JAR s inside the lib direc-
tory is such an ingrained habit that you do it automatically. Remember—unlike WAR s,
WAB s can be small, compact, and modular—and they're better that way (see figure 5.9).
Figure 5.9 Whereas a WAR often needs to package all its code and dependencies inside the WAR
itself, WABs can be much more modular.
Make a persistence bundle
If your application is using persistence, it's a good idea to use a purpose-built persis-
tence bundle for the persistence.xml and the entity classes. This may be a bit different
from how you structured your persistence code for Java EE , but there's a good reason
for grouping everything together (see figure 5.10).
Poor bundle organization
Good bundle organization
Figure 5.10 In an enterprise OSGi environment, it's important to package persistence
classes in the same bundle in which the persistence units are defined.
Search WWH ::