| <html><head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
| <title>3.3 A guide to forming bundles</title><link rel="stylesheet" href="css/stylesheet.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="Virgo Programmer Guide"><link rel="up" href="ch03.html" title="3. Deployment Architecture"><link rel="prev" href="ch03s02.html" title="3.2 Dependency Types"><link rel="next" href="ch04.html" title="4. Developing Applications"><!--Begin Google Analytics code--><script type="text/javascript"> | |
| var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); | |
| document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | |
| </script><script type="text/javascript"> | |
| var pageTracker = _gat._getTracker("UA-2728886-3"); | |
| pageTracker._setDomainName("none"); | |
| pageTracker._setAllowLinker(true); | |
| pageTracker._trackPageview(); | |
| </script><!--End Google Analytics code--></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.3 A guide to forming bundles</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><th width="60%" align="center">3. Deployment Architecture</th><td width="20%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="architecture-forming-bundles"></a>3.3 A guide to forming bundles</h2></div></div></div><p> | |
| So what makes a good application suitable for deployment on the Virgo Web Server? Since OSGi is at the heart of the | |
| VWS, modular applications consisting of bundles, which each represent distinct functionality and | |
| well-defined boundaries, can take maximum advantage of the OSGi container’s capabilities. The core ideas behind forming | |
| bundles require following good software engineering practices: separation of concerns, minimum coupling, and communication | |
| through clear interfaces. In this section, we look at a few approaches that you may use to create modular applications | |
| for Virgo Web Server deployment. Please consider the following discussion as guidelines and not as rules. | |
| </p><p> Bundles can be formed along horizontal slices of layering and vertical slices of function. The objective is to | |
| enable independent development of each bundle and minimize the skills required to develop each bundle.</p><p> | |
| For example, an application could have the following bundles: <span class="emphasis"><em>infrastructure</em></span>, | |
| <span class="emphasis"><em>domain</em></span>, <span class="emphasis"><em>repository</em></span>, <span class="emphasis"><em>service</em></span>, and | |
| <span class="emphasis"><em>web</em></span> as shown in the following diagram.</p><p> | |
| </p><div class="mediaobject"><img src="images/bundle-dependencies-layers.png"></div><p> | |
| Each bundle consists of types appropriate for that layer and exports packages and services to be used by other | |
| layers. Let’s examine each bundle in more detail: | |
| </p><div class="table"><a name="architecture-forming-bundles-across-layers-table"></a><p class="title"><b>Table 3.2. Bundles across layers</b></p><div class="table-contents"><table summary="Bundles across layers" style="border-collapse: collapse;border-top: 1.0pt solid ; border-bottom: 1.0pt solid ; border-left: 1.0pt solid ; border-right: 1.0pt solid ; "><colgroup><col><col><col><col><col></colgroup><thead><tr><th style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Bundles</th><th style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Imported Packages</th><th style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Exported Packages</th><th style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Consumed Services</th><th style="border-bottom: 1.0pt solid ; ">Published Services</th></tr></thead><tbody><tr><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Infrastructure</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Third-party libraries</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Infrastructure interfaces</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">None</td><td style="border-bottom: 1.0pt solid ; ">None</td></tr><tr><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Domain</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Depends: for example, if JPA is used to annotate persistent types, then JPA packages.</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Public domain types</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">None</td><td style="border-bottom: 1.0pt solid ; ">None</td></tr><tr><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Web</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Domain, Service</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">None</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Service beans</td><td style="border-bottom: 1.0pt solid ; ">None</td></tr><tr><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Service</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Domain, Infrastructure, Repository</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Service interfaces</td><td style="border-right: 1.0pt solid ; border-bottom: 1.0pt solid ; ">Repository beans</td><td style="border-bottom: 1.0pt solid ; ">Service beans</td></tr><tr><td style="border-right: 1.0pt solid ; ">Repository</td><td style="border-right: 1.0pt solid ; ">Domain, Third-party libraries, ORM bundles, etc.</td><td style="border-right: 1.0pt solid ; ">Repository interfaces</td><td style="border-right: 1.0pt solid ; ">DataSources, ORM session/entity managers, etc.</td><td style="">Repository beans</td></tr></tbody></table></div></div><p><br class="table-break"> | |
| </p><p> | |
| Within each layer, you may create bundles for each subsystem representing a vertical slice of business functionality. | |
| For example, as shown in the following figure, the service layer is divided into two bundles each representing | |
| separate business functionalities. | |
| </p><div class="mediaobject"><img src="images/bundle-dependencies-verticals.png"></div><p> | |
| </p><p> You can similarly separate the repositories, domain classes, and web controllers based on the business role | |
| they play.</p></div><!--Begin LoopFuse code--><script src="http://loopfuse.net/webrecorder/js/listen.js" type="text/javascript"></script><script type="text/javascript"> | |
| _lf_cid = "LF_48be82fa"; | |
| _lf_remora(); | |
| </script><!--End LoopFuse code--><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.2 Dependency Types </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4. Developing Applications</td></tr></table></div></body></html> |