Component Modeling of J2EE Technologies

A component diagram is primarily composed of UML components. In this context, however, the term component is slightly broader than the term commonly used in the software industry, as a UML component can be a source code component, a binary component, an executable component, or even a text file.

A component diagram provides a static view of the components and their relationships. Components on a component diagram may exist throughout development or may come into being after compilation, linking, and so on.

Stereotypes are used to distinguish between the different kinds of Java components on a component diagram:

  • A Java class file (.class file extension) is represented by specializing the standard UML stereotype <<file>> and stereotyping a component with the stereotype <<JavaClassFile>>.

  • A file containing a JavaServer Page (JSP; .jsp file extension) is represented via specializing the <<file>> stereotype and applying <<JSPFile>> to a component.

  • A deployment descriptor is represented by specializing the standard UML stereotype <<file>> and stereotyping a component with one of the following stereotypes:

    • <<WebDescriptor>> for Web components composed of servlets and JSPs.

    • <<EJBDescriptor>> for Enterprise JavaBean (EJB) components.

  • A Java Archive File (JAR) file is represented by stereotyping a UML package with the stereotype <<JavaArchiveFile>>. Different types of JAR files are distinguished by the use of one of the following:

    • JAR files (.jar file extension) containing EJBs are identified with stereotyping a package with the <<EJBArchiveFile>> stereotype.

    • Web archive files (.war file extension) containing JSPs, servlets, and HTML pages are represented via a package stereotyped as <<WebArchiveFile>>.

    • Enterprise archive files (.ear file extension) that contain entire enterprise Java applications are identified by stereotyping a package with <<EnterpriseArchiveFile>>.

Figure 15-1 shows an example of a simple component diagram.

Figure 15-1. A simple component diagram


Representing Web Components

Web components can be composed of a servlet or JSP, static pages such as HTML pages, and a deployment descriptor. An example of a Web component on a component diagram is shown in Figure 15-2.

Figure 15-2. Web component on a component diagram


Representing EJBs

EJB components are packaged in archive files that contain the compiled class files for the EJB itself, any required supporting Java class files, and an EJB deployment descriptor.

Figure 15-3 shows a UML component diagram for an EJB component.

Figure 15-3. EJBs and component diagrams


Note that several EJBs can exist within the same EJB archive file, and in fact, this is the most common way to group them. Grouping within the same file allows for local EJB-to-EJB relationships to be possible, so this is a very important point.

When grouping in this way, the descriptor fields for each EJB are usually merged into a single descriptor file, which is also the case for a Web descriptor in a Web archive file.

Figure 15-4 shows an example of multiple EJBs grouped in a single EJB archive. Note how both EJBs share a common primary key class in this example.

Figure 15-4. Multiple EJBs grouped in a single archive file


Component Modeling of Enterprise Applications

Enterprise Java applications represent all the different pieces that make up an enterprise application. Depending on the application, this may mean some Web components as well as EJB components.

Figure 15-5 shows an example of an enterprise Java application via a component diagram.

Figure 15-5. An enterprise component


It is also possible for an application to consist of just EJB components that are directly accessed via a thin client application. If the HomeDirect application had a client-based application interface, such a relationship could have been shown using the <<EJB ClientJar>> stereotype for a usage relationship as shown in Figure 15-6.

Figure 15-6. Showing client relationships for EJBs


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.152.157