A module is a collection of one or more Java EE components that run in the same container type, such as a web container or EJB container. The module uses annotations or deployment descriptors of that container type. You can deploy a module alone or as part of an application.
The following topics are addressed here:
Enterprise Server supports the following types of modules:
Web Module. A web module, also known as a web application, is a collection of servlets, EJBs, HTML pages, classes, and other resources that you can bundle and deploy to several Java EE application servers. A web application archive (WAR) file is the standard format for assembling web applications. A WAR file can consist of the following items: servlets, JavaServer PagesTM (JSPTM) files, JSP tag libraries, utility classes, static pages, client-side applets, beans, bean classes, enterprise bean classes, plus annotations or web deployment descriptors (web.xml and sun-web.xml).
EJB Module. An EJB module is a deployable software unit that consists of one or more enterprise beans, plus an EJB deployment descriptor. A Java archive (JAR) file is the standard format for assembling enterprise beans. An EJB JAR file contains the bean classes (home, remote, local, and implementation), all of the utility classes, and annotations or deployment descriptors (ejb-jar.xml and sun-ejb-jar.xml). If the EJB component is a version 2.1 or earlier entity bean with container managed persistence (CMP), you can also include a .dbschema file and a CMP mapping descriptor (sun-cmp-mapping.xml).
Connector Module. A connector module, also known as a resource adapter module, is a deployable software unit that provides a portable way for EJB components to access foreign enterprise information system (EIS) data. A connector module consists of all Java interfaces, classes, and native libraries for implementing a resource module, plus a resource deployment descriptor. A resource adapter archive (RAR) is the standard format for assembling connector modules. Each Enterprise Server connector has annotations or a deployment descriptor file (ra.xml).
After deploying a J2EE connector module, you must configure it as described in Chapter 12, Developing Connectors, in Sun GlassFish Enterprise Server v3 Application Development Guide.
Application Client Module. An application client module is a deployable software unit that consists of one or more classes, and application client deployment descriptors (application-client.xml and sun-application-client.xml). An application client JAR file applies to an Enterprise Server–specific type of Java EE client. An application client supports the standard Java EE Application Client specifications, and, in addition, supports direct access to Enterprise Server.
Lifecycle Module. Enterprise Server A lifecycle module provides a means of running short–duration or long–duration Java-based tasks within the Enterprise Server environment. See Chapter 13, Developing Lifecycle Listeners, in Sun GlassFish Enterprise Server v3 Application Development Guide for more information.
You can deploy web, EJB, and application client modules separately, outside of any application. Module–based deployment is appropriate when components need to be accessed by other modules, applications, or application clients. Module-based deployment allows shared access to a bean from a web, EJB, or application client component. By using package definitions in the source code of all modules, you eanble the class loader to properly locate the classes after the modules have been deployed.
An application is a logical collection of one or more modules joined by application annotations or deployment descriptors. You assemble components into JAR, WAR, or RAR files, then combine these files into an Enterprise archive (EAR) file which is deployed.
The following figure shows EJB, web, application client, and connector modules assembled into a Java EE application.