📄 lib0094.html
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Chapter 14: Building Deployment Layer Objects</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0093.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0095.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch14"></a>
<h1 class="chapter-title"><span class="chapter-titlelabel">Chapter 14: </span>Building Deployment Layer Objects</h1><div class="section">
<h2 class="sect2-title">
<a name="451"></a>Overview</h2>
<a name="452"></a><a name="IDX-185"></a>
<p class="para">Objects in the deployment layer (which I call deployment wrappers) "publish" the content of the business logic layer to the presentation tier. In a J2EE world, the presentation tier can be on a separate server than the business logic layer. The deployment layer provides this remote calling capability. Deployment wrappers are purposely kept relatively simple and thin because they are more difficult and time consuming to develop and maintain than normal Java classes. Simple, thin deployment wrappers are less likely to have bugs.</p>
<p class="para">Among the types of objects in the deployment layer are enterprise beans, Web services, and RMI services. The logic in the methods should contain the following activities:</p>
<ul class="itemizedlist">
<li class="first-listitem">
<p class="first-para">Instantiation/call to the underlying business object</p>
</li>
<li class="listitem">
<p class="first-para">Initialization of the transaction context (defined in <a href="LiB0081.html#373" target="_parent" class="chapterjump">chapter 12</a>)</p>
</li>
<li class="listitem">
<p class="first-para">Log exceptions</p>
</li>
</ul>
<p class="para">Deployment wrappers, which are usually invoked from other applications or by elements of the presentation tier, should contain no business logic. Any business logic directly coded within a deployment wrapper would have to be replicated if you were to change your deployment strategy. The role of the deployment layer is depicted in <a class="internaljump" href="#ch14fig01">figure 14.1</a>.</p>
<div class="figure">
<a name="453"></a><a name="ch14fig01"></a><span class="figuremediaobject"><a href="images/fig202%5F01%5F0%2Ejpg" NAME="IMG_39" target="_parent"><img src="images/fig202_01.jpg" height="249" width="350" alt="Click To expand" border="0"></a></span>
<br style="line-height: 1">
<span class="figure-title"><span class="figure-titlelabel">Figure 14.1: </span>Using Deployment Wrappers Within a Layered Architecture</span>
</div>
<a name="454"></a><a name="IDX-186"></a>
<div class="highlights">
<p class="first-para">Several deployment wrappers are available for J2EE applications. Session beans, message-driven beans, and Web services are among the most common. I focus on these three types of deployment wrappers in this chapter because the activities within them are strikingly similar. The chapter provides coding guidelines for each type and describes how to publish business objects using each type. Along the way, I'll point out additional resources in case you want more depth.</p>
<p class="last-para">I've seen applications that call business objects directly from servlets, effectively making it a deployment wrapper. By so doing, they are effectively using servlets as deployment wrappers and eliminating the use of session beans or Web services. In other words, some applications run entirely within the servlet engine.</p>
</div>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0093.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0095.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -