级别: 中级 Narinder Makin, 软件架构师, IBM Rational SOA 工具, IBM
2009 年 6 月 08 日 IBM® Rational® Software Architect V7.5 包含了一个功能强大的部署架构平台(Deployment Architecture Platform),能够用来可视化设计和理解 IT 系统以及这些系统的复杂关系。这个平台建立在一个可扩展的,强大的分类模型上,这个模型为描述任何 IT 系统提供了一个框架。这一系列文章展示了这个特性的核心——拓扑模型,并对其进行了剖析。这些拓扑模型描述了 IT 系统构建模块的逻辑抽象(或具体定义),它们允许您表达这些系统元素之间不同类型的相互关系。在这个系列的这个部分中,探讨了拓扑模型的基本概念(包括拓扑,单元,需求和性能的基本原则,以及依赖,托管,以及成员这样的关系)。本文还提供了一个如何使用这个模型来描述一个特定 IT 系统的例子,将关于特性领域的信息与这个模型中预先定义的类型整合在起来。
引言
IBM® Rational® Software Architect Standard Edition V7.5 和 IBM® Rational® Software Architect for WebSphere Software V7.5(统称为 Rational Software Architect V7.5)包含了一个强大的部署架构平台,可用于为 IT 系统及其复杂关系进行可视化建模。它是建立在一个可扩展的,强大类型模型上的,称作 拓扑模型。这个特性可以满足以下的需求。
为了部门之间的沟通(例如,在开发和操作部门之间),您可能经常需要表达您 IT 系统的设计。传达这种信息传统的方法包括笔记,电子邮件,电子数据表,幻灯片,或者 Microsoft® Visio 图表。但是通常情况下需要用一种正式的方式来传达这个设计,系统需要确认这个沟通。缺少这样的解决方案将会导致在应用软件整个生命周期中许多配置问题的出现,并且在这个目标环境中还会产生未经检查的部署。当一个解决方案转移到应用软件生命周期的不同阶段时,比如开发,阶段化,测试,或者操作阶段,问题将会更加糟糕。因此您需要重新构建这个系统,或者说几乎不可能来复制一个成功的系统安装。构建或者部署这种系统的方式或者实践通常情况下是以书面形式保存的,而绝不仅仅是实现或者执行它们。
比较典型的是,这样的 IT 系统需要表达这个系统中片段之间不同的关系。这是通过命名这些关系来实现的,这些关系可能在一个 IT 组织中的不同小组之间或者不同组织之间各不相同。大家都知道,或多或少,在这些关系背后都有一些通用的语义,但是他们缺乏共同表达这些语义的方法。这个拓扑模型不仅提供了一种以共同语言表达这些关系的方法,而且还根据它们的语义(像依赖关系,托管,或者成员)进一步对这些关系进行了分类。这样您就可以以一种您可以读取的可控制的方式来定义这些关系,但是软件工具仍然可以对此进行判断,从而产生有效的以及决议的拓扑。
下面的部分讨论了拓扑模型的基本概念,同时还有关于在这个模型中如何将专业知识运用到类型的规范。
拓扑模型概念
您可以利用一个拓扑模型来描述一个 IT 系统,或者一个 IT 系统的片段。它提供了一种表达系统的常用语言。它还使您能够在一个或者更多的拓扑模型中产生关于这个领域的新类型(或者新类型实例)。 拓扑模型中的每个实例与性能都是很松散地匹配,所以您可以详细指定它们的需求。下面这些是这篇文章中关于拓扑模型的基本概念:
一个拓扑模型就是所有单元以及它们相互关系的容器,其中的单元与需求和性能都是松散连接的。下面的部分包括对您在编写这篇文章过程中构建的样本拓扑模型相关类型的使用和详细描述。图 1中显示的是这些类型的基本 UML 表达。
图 1. 基本拓扑 UML 模型
拓扑
拓扑是任何拓扑模型的最高层元素。它展现了一个带有所有拓扑内容的拓扑模型,包括单元以及它们之间的相互关系。一个拓扑表达一个 IT 系统可能与描述这个系统的组成一样简单。但它也可能非常的复杂,除了描述它们的相互关系之外,还要具体指定甚至是他们第 N 层的许多组件。它来自于这个拓扑方案中定义的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间,如清单 1所示。拓扑是唯一由它的名称和命名空间来鉴定的。除了具体描述之外,您还可以指定一个可视工具能够辨别的显示名称。
清单 1. core.xsd 中的核心命名空间
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
description="This is a sample topology describing the anatomy of the topology model"
displayName="Sample Topology"
name="SampleTopology"
namespace="developerworks.deploy">
<!-- all other containments of the topology go here -->
</core:topology>
|
拓扑的范围不仅仅局限于描述一个完整的 IT 系统,或者说是它的主要部分。根据您的需求,您可以将您的环境分解或者瓦解成单个或者多个可以引用的拓扑。这种情况下,这些拓扑可以当作可重用的方法,也可以构成更大的拓扑。
此外,您还可以在建模过程中,利用 decoratorSemantic 属性对这个拓扑进行标签,从而描述它的目的。常见的标签,像 分析, 基础结构,以及 部署 已经在 IBM® Rational® Software Architect 中预先确定,可以使用。在清单 2中的例子中,这个拓扑已经被标签为 com.ibm.ccl.soa.deploy.core.dds,并且被 Rational Software Architectwhich 认为是 分析 的标签。
清单 2. decoratorSemantic 属性
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
description="This is a sample topology describing the anatomy of the topology model"
displayName="Sample Topology"
name="SampleTopology"
namespace="developerworks.deploy"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads">
<!-- all other containments of the topology go here -->
</core:topology>
|
单元
单元 就是代表拓扑模型中一个部署单元的基本类型。通常,一个单元代表 IT 系统中定义一套需求的一个单独的部分。这些需求在部署过程中被实现,并且描述这个系统提供的一套性能。单元类型是来自这个拓扑方案中定义的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。它是拓扑范围中唯一由名称来辨别的。除了清单 3中显示的描述外,您还可以具体制定一个可视工具可以辨别的显示名称。
清单 3. 单元类型
<core:unit
displayName="SampleUnit"
name="sampleUnit"
description="This is a sample unit">
</core:unit> |
配置
在部署过程中,某些部分仅仅是配置。这个模型允许您将一个 configurationUnit 属性设置到这个单元上,并具体指定它是一个配置,如清单 4 所示。例如在一个例子中,服务器可以看作是非配置单元,而配置在这个服务器上的数据源可以看作是配置单元。
清单 4. 配置
<core:unit
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
description="This is a sample configuration unit"
configurationUnit="true">
</core:unit>
|
概念上的
也有时在您分析的时候,您并不完全了解这个单元的定义。于是这个代表这个 IT 系统或者它的一部分分析状态的拓扑模型,可能就不能表现那个单元的所有性能或者需求(或者甚至是成员)。为了达到 有意 单元表示的目的,在这个单元上有一个带有 错误 默认值的非强制性 概念性 属性,如清单 5所示。这还可以被看作是这个拓扑中的一个 插槽,以后迟早会是一个必选项。
清单 5. 概念性属性
<core:unit
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
description="This is a sample conceptual unit"
conceptual="true">
</core:unit>
|
构造型
您还可以将构造型看作是这个单元的额外关键字对一个单元进一步进行分类,如清单 6所示。您还可以根据它们的档案,把这些关键字作为各种理由来使行为发生关联。这些构造性根据不同的档案还提供了不同构造型之间的协同工作的方法,由 Unified Modeling Language (UML) 中的组件所确定。
清单 6. 构造型关键字
<core:unit
displayName="ServiceComponentUnit"
name="serviceComponentUnit"
description="This is a stereotyped service component unit">
<core:stereotype
keyword="service"
profile="serviceProfile"/>
</core:unit>
|
安装
有时可以视情况而定,一个单元可能还可以根据不同的部署目的将它的安装状态指定为 unknown, installed,或者 not_installed。这个安装状态可以进一步分为带有默认值 unknown 单元的最初的安装状态或者目标安装状态。 这个单元上的最初以及目标安装状态为这个拓扑模型的发布者提供了关于此单元部署方面的具体信息。当这个拓扑模型为发布后,最初安装状态是 installed,而目标安装状态是 not_installed 的情形提供了到卸载的转换。您还可以具体指定一个 publishIntent 属性,如清单 7所示,其值为 unknown, publish,或者 do_not_publish (默认值为 publish)。这样就为发布者提供了发布期间是否忽视此单元的额外暗示。这样还可以使开发以及部署不同阶段期间进行增量地或者独立地拓扑模型发布。
清单 7. 安装以及发布意向
<core:unit
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
description="This is a sample conceptual unit"
conceptual="true"
initInstallState="installed"
goalInstallState="not_installed"
publishIntent="do_not_publish">
</core:unit>
|
分解
一个拓扑可以根据此拓扑的目的定义为仅仅包含一个单元,或者可能包含多个的单元。您可以定义一套拓扑来创建显示在这个 IT 系统中的单元目录。这些拓扑作为可重用的构建板块,用于构建其它拓扑,它可能包含极少的独立单元。一个拓扑还可以这样定义,它代表了这个完整的 IT 系统:这个拓扑可能含有大量代表此 IT 系统中每个部分的单元,如清单 8所示。
清单 8. 编码多个单元
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
description="This is a sample topology describing the
anatomy of the topology model"
displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy"
<core:unit
description="This is a sample unit"
displayName="SampleUnit"
name="sampleUnit"/>
<core:unit
description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit
description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
conceptual="true"
goalInstallState="not_installed"
initInstallState="installed"
publishIntent="do_not_publish"/>
<core:unit
description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit"
name="serviceComponentUnit">
<core:stereotype
keyword="service"
profile="serviceProfile"/>
</core:unit>
</core:topology>
|
Domain Usage
单元主要是一个域的单元,一个拓扑可能包含这些域中一个或者多个单元。例如,一个 Java™ 2 Platform, Enterprise Edition (J2EE) 域可以定义一个 J2EE Server 类型 (j2eeServer) 以及一个 J2EE 应用软件组件 (component.ear) 类型作为一个核心单元类型的扩展。在清单 9中显示的拓扑中,来自一个 J2EE 域的单元类型和单元类型是一起使用的。还要注意的是这个服务器单元的安装状态是指定的,这样剩余的最初以及目标安装状态就不会改变。另一方面, J2EE 应用软件组件上的安装状态指定了这些未安装的单元,并且需要安装。注意,为了使用来自 J2EE 域的类型,要将命名空间参作为 xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/" 被添加到拓扑文件中。
清单 9. 来自不同域的单元
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of the topology model"
displayName="Sample Topology" name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit description="This is a sample configuration unit"
displayName="SampleConfigurationUnit" name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit description="This is a sample conceptual unit"
displayName="SampleConceptualUnit" name="sampleConceptualUnit"
conceptual="true" goalInstallState="not_installed"
initInstallState="installed" publishIntent="do_not_publish"/>
<core:unit description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit" name="serviceComponentUnit">
<core:stereotype keyword="service" profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit"
conceptual="true"
goalInstallState="installed"
initInstallState="installed"/>
<j2ee:component.ear
description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false"
goalInstallState="installed"
initInstallState="not_installed"/>
</core:topology>
|

 |

|
性能
性能 代表一个单元可能提供为其它单元的能力,并且具有这个单元的配置内容。性能类型来自这个拓扑方案中定义的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。性能是这个单元范围中唯一通过它的名称识别的。除了一个具体的描述之外,您还可以具体指定一个可视工具能够识别的显示名称。性能的 linkType 属性确定了连接可使用性能的连接类型,如清单 10所示。
清单 10. 性能
<core:capability
displayName="SampleCapability"
name="sampleCapability"
description="This is a sample capability"
linkType="any"/>
|
这两套通常在拓扑模型中定义的范围较广性能被归为 dependency 和 hosting 性能。一个 hosting 性能确定了从单元到托管的性能,或者为其它单元提供中间设备服务(例如,应用服务器)。一个 dependency 性能定义了一个单元(例如,数据源)为它的同类单元进行操作的能力,可能是联合托管服务或者在不同的单元进行托管服务。这些模型不能确定上述性能类别的任何一种类型,相反可以将 linkType 属性指定为 hosting 或者 dependency。通常情况下,从属性能将 linkType 作为 dependency,而托管服务性能将 linkType 定义为 any 来陈述事实,即使它们是托管,其它的可能对它们的配置有直接的从属关系。
可以确定清单 11中的一个托管性能。
清单 11. 托管性能
<core:capability
displayName="SampleHostingCapability"
name="sampleHostingCapability"
description="This is a sample hosting capability"
linkType="hosting"/>
|
可以确定一个如清单 12所示的从属性能。
清单 12. 从属性能
<core:capability
displayName="SampleDependencyCapability"
name="sampleDependencyCapability"
description="This is a sample dependency capability"
linkType="dependency"/>
|
拓扑模型中的一个性能和一个单元联合起来代表这个单元的能力,但这个方案对于拓扑模型来说并不意味着要强制使单元与性能类型严格地联合起来。它们在拓扑模型中是松散链接的,从而在单元和可利用性能类型之间提供了最大灵活性。比如,可能由于特别的原因,同一个 Capability 类型可以与一个或者多个单元类型相连接。
一个从属性能可以与一个配置单元连接起来,如清单 13所示。
清单 13. 将一个性能与一个配置单元联合起来
<core:unit
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
description="This is a sample configuration unit"
configurationUnit="true">
<core:capability
displayName="SampleDependencyCapability"
name="sampleDependencyCapability"
description="This is a sample dependency capability"
linkType="dependency"/>
</core:unit>
|
上面所提到的同一个从属性能还可以与一个 SampleUnit 联合起来,如清单 14所示。
清单 14.将 这个性能与一个 SampleUnit 连接起来
<core:unit
displayName="SampleUnit"
name="sampleUnit"
description="This is a sample unit">
<core:capability
displayName="SampleDependencyCapability"
name="sampleDependencyCapability"
description="This is a sample dependency capability"
linkType="dependency"/>
</core:unit>
|
Domain Usage
通过域具体指定性能类型可以提供额外的能力。通常情况下,一个性能还可以确定每一个单元类型,比如根据这个域中单元的配置内容来控制其属性。这样有利于确认这些单元与这个单元特定属性的从属关系。例如,一个 J2EE 域可能提供:
- 一个 J2eeServer 单元类型,此外一个 J2eeContainer 还可以允许您指定一个
containerVersion 属性
- 一个 ServletContainer 性能类型,这样允许您指定一个
containerVersion 属性
- 一个 J2eeDatasource 性能,这样允许您指定一个
jndiName 属性
- 一个 J2eeServer 性能,它可能包含一些配置属性,像
serverName 等等
您可以创建一个可以解释这个 J2eeServer 单元实例的拓扑模型,并且这个 J2eeServer 单元包含以下内容,如清单 15所示:
- 一个带有指定 containerVersion of
1.4 的 J2eeContainer 托管性能
- 一个带有指定 containerVersion of
2.3 的 ServletContainer 托管性能
- 一个 J2eeDatsource 从属性能,并且有一个 jndiName 设置为
jndi/datasource1
- 一个 J2eeServer 性能,它可能包含 J2eeServer 的配置属性
要注意的是,为了使用来自 J2EE 域的类型,命名空间将作为
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
被添加到这个拓扑文件中。
清单 15. 拓扑模型
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of the topology model"
displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit
description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit
description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
conceptual="true"
goalInstallState="not_installed"
initInstallState="installed"
publishIntent="do_not_publish"/>
<core:unit
description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit"
name="serviceComponentUnit">
<core:stereotype keyword="service"
profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit"
conceptual="true"
goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability"
name="j2eeServer"
linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability"
name="j2eeContainer"
linkType="hosting"
containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer"
linkType="hosting"
containerVersion="2.3"/>
<j2ee:capability.j2eeDatasource
description="This is a J2EE datasource dependency capability"
displayName="J2eeDatasourceCapability"
name="j2eeDatasourceCapability"
linkType="dependency"
jndiName="jndi/datasource1"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear
description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false"
goalInstallState="installed"
initInstallState="not_installed"/>
</core:topology>
|

 |

|
需求
需求 表水一个单元在目标环境中可能拥有的需要。
这些需求类型来自定义在这个拓扑方案中的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。这个单元中的需求是唯一通过它在这个单元范围内的名称来鉴定的,如清单 16所示。
清单 16. 需求
<core:requirement name="r0"/>
|
可根据情况而定,一个根据需求而确定的带有默认值 dependency 的 linkType ,可以具体确定用来满足需求的关系连接类型。 一个需求的 dmoType 属性可以用来确定用于满足这些需求的目标单元或者性能类型的非强制性限制。除了一个具体描述之外,您还可以确定一个能够被可视工具识别的显示名称。此外,需求的使用还可以通过 use 属性设置为 required,optional 或 prohibited(默认值为 required)。
您还可以确定一个可选择性的从属需求,这个需求可以由一个 J2EE 数据源性能通过使用一个从属关系连接来实现,如清单 18所示。这个从属需求的 dmoType 属性值确定了对性能类型的限制。
清单 18. 确定一个可选择性从属需求
<core:requirement
displayName="Datasource Dependency Requirement"
name="r0"
description="This is a sample dependency requirement"
linkType="dependency"
dmoType="j2ee:J2EEDatasource"
use="optional" />
|
您还可以确定一个必需的托管需求,它可以由一个 J2EE Enterprise Java™Beans (EJB) 容器性能通过使用一个托管关系来实现,如清单 19所示。这个托管需求的 dmoType 属性确定了对性能类型的限制。
清单 19. 确定一个托管需求
<core:requirement
displayName="EJB Container Hosting Requirement"
name="r1"
description="This is a sample hosting requirement"
linkType="hosting"
dmoType="j2ee:J2eeContainer"/>
|
此外,您还可以确定一个单元上的成员需求,并且这个单元允许这些成员穿过这个成员关系连接,如清单 20所示。在这个案例中还值得注意的是, dmoType 局限于一个单元类型而不是一个性能类型(正如前面例子中所述)。
清单 20. 确定一个成员需求
<core:requirement
displayName="Unit Member Requirement"
name="r2"
description="This is a sample member requirement
showing that member of type Unit are allowed where
this requirement is defined "
linkType="member"
dmoType="core:Unit"/>
|
您还可以将 linkType 确定为 any,但是同步进行的 dependency, hosting,以及 member 的性能很少使用它。您还可以一个 扩展 属性,从而为创建扩展确定一个基础需求的相对路径。然而,这又是一个用于定义域的罕见概念。
Domain Usage
然而,与性能类似,这个拓扑模型中与单元相联系的需求就代表了这个单元的需求。然而,拓扑模型方案并不强制单元与需求之间有任何严格的关联。拓扑模型中这些松散结合关系为单元和可利用需求类型之间提供了最大的灵活度。例如,同一个需求类型可以与一个或者更多的单元类型相关联。
例如,可以定义一个拓扑,这样它就包含一个定义在 J2EE 域中的 J2EE 应用软件组件,并且这个域包含以下内容,如清单 21所示:
- 一个关于 J2eeContainer 性能的托管需求
- 一个关于 J2eeDatasource 性能的从属需求
- 一个包含 J2EE EJB Component (s) 的成员需
清单 21. 带有 J2EE 应用软件的拓扑
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy
of the topology model" displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit" conceptual="true"
goalInstallState="not_installed"
initInstallState="installed"
publishIntent="do_not_publish"/>
<core:unit description="This is a stereotyped service
component unit" displayName="ServiceComponentUnit"
name="serviceComponentUnit">
<core:stereotype keyword="service"
profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit " name="j2eeServerUnit"
conceptual="true" goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability"
name="j2eeServer" linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability"
name="j2eeContainer" linkType="hosting"
containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer" linkType="hosting"
containerVersion="2.3"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear
description="This is an EAR Component "
displayName="EAR Component " name="earComponent"
configurationUnit="false" goalInstallState="installed"
initInstallState="not_installed">
<core:requirement
description="This is a datasource dependency requirement"
displayName="Datasource Dependency Requirement"
name="r0"
dmoType="j2ee:J2EEDatasource"
linkType="dependency"
use="optional"/>
<core:requirement
description="This is a J2EE container hosting requirement"
displayName="J2EE Container Hosting Requirement"
name="r1"
dmoType="j2ee:J2EEContainer"
linkType="hosting"/>
<core:requirement
description="This is a EJB component member
requirement showing that member of type EjbComponent unit are allowed "
displayName="EJB Component Member Requirement"
name="r2"
dmoType="j2ee:EjbModule"
linkType="member"/>
</j2ee:component.ear>
</core:topology>
|

 |

|
工件
一个工件类型就代表一个包含在单元内的可部署对象。这个工件类型来自定义在这个拓扑方案中的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。在在个单元所包含的工件中,其中每一个都可以在这个单元范围内通过它的名称进行唯一的识别,如清单 22所示。工件类型被界定为拓扑方案中一个抽象的类型。这个类型的扩展通常被用来确定一个工件可能包含内容的的类型。常用的工件类型 FileArtifact 代表一个文件资源,定义在这个拓扑方案中。
清单 22. 工件类型
<core:artifact.file
displayName="Sample File Jar "
name="a1">
<core:fileURI>samplefile.jar</core:fileURI>
</core:artifact.file>
|
Domain Usage
例如,您可以将一个定义在拓扑模型中的 J2EE 应用软件组件与一个企业档案资源 (EAR) 联系起来,如清单 23所示。这个资源代表所有与组件相关联的可部署内容,发布者可能在组件安装到服务器时对它们进行部署。
清单 23. 将一个 J2EE 应用软件组件与一个 EAR 文件联系起来
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of
the topology model" displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
conceptual="true" goalInstallState="not_installed"
initInstallState="installed"
publishIntent="do_not_publish"/>
<core:unit
description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit"
name="serviceComponentUnit">
<core:stereotype keyword="service"
profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit"
conceptual="true"
goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability"
name="j2eeServer"
linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability"
name="j2eeContainer"
linkType="hosting"
containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer"
linkType="hosting"
containerVersion="2.3"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear
description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false"
goalInstallState="installed"
initInstallState="not_installed">
<core:artifact.file
displayName="EAR Component1 EAR "
name="a1">
<core:fileURI>j2eeEarComponent1.ear</core:fileURI>
</core:artifact.file>
<core:requirement
description="This is a datasource dependency requirement"
displayName="Datasource Dependency Requirement"
name="r0" dmoType="j2ee:J2EEDatasource"
linkType="dependency" use="optional"/>
<core:requirement
description="This is a J2EE container hosting requirement"
displayName="J2EE Container Hosting Requirement"
name="r1" dmoType="j2ee:J2EEContainer"
linkType="hosting"/>
<core:requirement
description="This is a EJB component member requirement showing that
member of type EjbComponent unit are allowed "
displayName="EJB Component Member Requirement"
name="r2" dmoType="j2ee:EjbModule"
linkType="member"/>
</j2ee:component.ear>
</core:topology>
|

 |

|
Relationship Links
要表达一个典型的 IT 系统需要表达出系统中不同部件之间的相互关系。这些关系利用系统上的一些语义可以进一步帮助确认或者理解这个系统。这个拓扑模型根据操纵这些关系的语义提供了进一步对这些关系分类的方法。当他们的语义利用内部需求时就会对这些关系进行命名。还有些不同类型的关系可以在这个拓扑所包含的单元上进行表达,并且它们被看作是连接类型。这些连接类型的最初设置包括 Dependency, Hosting 以及 Member Link。每个连接都有参与这个关系的资料源和连接目标。
Dependency Link
DependencyLink 类型是用来连接一个需求和一个 依赖 (或者 任何类型) 连接类型到某个性能,这表明这个需求已经由目标性能实现。它还提供了一种强制遵从源需求而反对目标性能的方法。 DependencyLink 类型来自定义在这个拓扑方案中的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。定义在这个单元实例上的需求就是依赖连接的容器。定义在拓扑模型中的 DependencyLink 实例在需求范围内只能通过它的名称来识别,如清单 24所示。
清单 24. DependencyLink
<core:requirement
name="r1">
<core:link.dependency
name="link1"
source="/Unit1/r1"
target="/Unit2/c1"/>
</core:requirement>
|
Dependency Link Domain Usage
举例来说,一个定义在 J2EE 域的 J2EE 应用软件组件可以拥有对拓扑中 J2eeDatasourceUnit 提供的 J2eeDatasource 性能有依赖需求。因此可以在拥有源需求和目标性能的组件和数据源之间创建一个依赖连接,如清单 25所示。
清单 25. 创建一个依赖连接
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of
the topology model" displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit" configurationUnit="true"/>
<core:unit description="This is a sample conceptual unit"
displayName="SampleConceptualUnit" name="sampleConceptualUnit"
conceptual="true" goalInstallState="not_installed"
initInstallState="installed" publishIntent="do_not_publish"/>
<core:unit description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit" name="serviceComponentUnit">
<core:stereotype keyword="service" profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit"
conceptual="true" goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability" name="j2eeServer"
linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability" name="j2eeContainer"
linkType="hosting" containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer" linkType="hosting"
containerVersion="2.3"/>
<j2ee:capability.j2eeDatasource
description="This is a J2EE datasource dependency capability"
displayName="J2eeDatasourceCapability"
name="j2eeDatasourceCapability"
linkType="dependency"
jndiName="jndi/datasource1"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false" goalInstallState="installed"
initInstallState="not_installed">
<core:artifact.file displayName="EAR Component1 EAR "
name="a1">
<core:fileURI>j2eeEarComponent1.ear</core:fileURI>
</core:artifact.file>
<core:requirement
description="This is a datasource dependency requirement"
displayName="Datasource Dependency Requirement"
name="r0"
dmoType="j2ee:J2EEDatasource" linkType="dependency"
use="optional">
<core:link.dependency
name="r0Toj2eeDatasourceCapability"
source="/earComponent/r0"
target="/j2eeServerUnit/j2eeDatasourceCapability"/>
</core:requirement>
<core:requirement
description="This is a J2EE container hosting requirement"
displayName="J2EE Container Hosting Requirement" name="r1"
dmoType="j2ee:J2EEContainer" linkType="hosting"/>
<core:requirement
description="This is a EJB component member requirement showing that member of
type EjbComponent unit are allowed "
displayName="EJB Component Member Requirement"
name="r2" dmoType="j2ee:EjbModule" linkType="member"/>
</j2ee:component.ear>
</core:topology>
|
Hosting Link
HostingLink 类型表明一个单元将根据这个目标托管单元上所有带有托管性能需求的实现情况来进行寄主。它主要掌控了一个带有托管性能的源托管单元与带有托管类型 需求 的目标被寄主之间的关系。 HostingLink 类型来自定义在这个拓扑方案中的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。这个服务其它(被寄主)单元的(托管)单元实例就是托管连接的容器。定义在这个拓扑中的 HostingLink 实例在这个单元范围中只能通过它的名称来识别,如清单 26所示。
清单 26. Caption
<core:unit
displayName="HostUnit"
name="hostUnit">
<core:link.hosting
name="link1"
source="/hostUnit"
target="/hosteeUnit"/>
</core:unit> |
Hosting Link Domain Usage
例如,既然定义了一个拓扑,那么它应该包括以下内容:
- 一个提供 J2eeContainer 和 ServletContainer 性能的实例
- 一个提供 ServletContainer 性能的 HttpServer 单元实例
一个既可以在 J2EE 域名也可以在拓扑中定义的 J2EE Application 组件实例应该包括
- 一个由拓扑中 J2eeServerUnit 提供的 J2eeContainer 性能类型托管需求
- 要给由拓扑中 J2eeServerUnit 提供的 ServletContainer 性能类型的托管需求
在上面的案例中,一个托管连接可以在 J2EE 应用软件组件(被寄主)和 J2eeServer 单元(托管)之间创建。然而,一个有效的托管连接不能在 J2EE 应用软件组件和 HttpServer 单元之间创建,因为拓扑中定义在 HttpServer 单元上的性能不能满足所有的托管需求,如清单 27所示。
清单 27. 有效的托管连接
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:http="http://www.ibm.com/ccl/soa/deploy/http/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of the
topology model"
displayName="Sample Topology" name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit" conceptual="true"
goalInstallState="not_installed"
initInstallState="installed" publishIntent="do_not_publish"/>
<core:unit
description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit" name="serviceComponentUnit">
<core:stereotype keyword="service" profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit"
conceptual="true" goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability"
name="j2eeServer" linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability"
name="j2eeContainer"
linkType="hosting"
containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer"
linkType="hosting"
containerVersion="2.3"/>
<j2ee:capability.j2eeDatasource
description="This is a J2EE datasource dependency capability"
displayName="J2eeDatasourceCapability"
name="j2eeDatasourceCapability" linkType="dependency"
jndiName="jndi/datasource1"/>
<core:link.hosting
name="j2eeServerUnitHostsearComponent"
source="/j2eeServerUnit"
target="/earComponent"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false" goalInstallState="installed"
initInstallState="not_installed">
<core:artifact.file displayName="EAR Component1 EAR "
name="a1">
<core:fileURI>j2eeEarComponent1.ear</core:fileURI>
</core:artifact.file>
<core:requirement
description="This is a datasource dependency requirement"
displayName="Datasource Dependency Requirement"
name="r0"
dmoType="j2ee:J2EEDatasource" linkType="dependency"
use="optional">
<core:link.dependency name="r0Toj2eeDatasourceCapability"
source="/earComponent/r0" target="/j2eeServerUnit/j2eeDatasourceCapability"/>
</core:requirement>
<core:requirement
description="This is a J2EE container hosting requirement"
displayName="J2EE Container Hosting Requirement" name="r1"
dmoType="j2ee:J2EEContainer"
linkType="hosting"/>
<core:requirement
description="This is a EJB component member requirement showing that member of
type EjbComponent unit are allowed "
displayName="EJB Component Member Requirement"
name="r2" dmoType="j2ee:EjbModule"
linkType="member"/>
</j2ee:component.ear>
<http:unit.httpServerUnit
displayName="Http Server"
name="httpServerUnit"
conceptual="false">
<http:capability.httpServer
displayName="Http Server Capability "
name="Http Server Capability"
linkType="any"/>
<j2ee:capability.servletContainer
displayName="Servlet Container Capability"
name="servletContainer"
linkType="any"
containerVersion="2.3"/>
</http:unit.httpServerUnit>
</core:topology>
|
Member Link
MemberLink 类型代表确定两个单元之间联系的限制关系,这里的连接目标就是成员,而源就是容器。它主要维持一个源容器单元(它拥有目标特定类型 requirement 类型成员)和目标类型的目标成员单元之间的关系。 MemberLink 类型来自定义在这个拓扑方案中的 http://www.ibm.com/ccl/soa/deploy/core/1.0.0/ 命名空间。这个拥有其它成员单元的成员需求就是成员连接。这个拓扑中定义的 MemberLink 实例在这个单位范围内只能通过它的名称来识别,如清单 28所示。
清单 28. MemberLink 实例
<core:unit
displayName="ContainerUnit"
name="containerUnit">
<core:requirement
displayName="Membership Requirement "
name="membershipRequirement"
dmoType="core:Unit"
linkType="member"/>
<core:link.member
name="link1"
source="/ContainerUnit"
target="/MemberUnit1"/>
</core:unit>
|
Member Link Domain Usage
例如,一个 Enterprise JavaBean 单元组件与一个成员连接一起连接到一个 J2EE 应用软件组件,从而就将这个单元描述为这个应用软件的一个成员,如清单 29 所示。
既然定义了一个拓扑模型,它就应该包含以下内容:
- 一个 J2EE 应用软件组件,它确定了对这个组件的 EJB 单元类型的成员需求。
- 一个 EJB 组件
在先前的案例中,既然已经创建了一个成员连接,那么这个连接的源就是 J2EE 应用软件组件,而这个连接的目标就是一个 EJB 组件。
清单 29. 连接到 J2EE 组件的 EJB 组件
<?xml version="1.0" encoding="UTF-8"?>
<core:topology
xmlns:core="http://www.ibm.com/ccl/soa/deploy/core/1.0.0/"
xmlns:http="http://www.ibm.com/ccl/soa/deploy/http/1.0.0/"
xmlns:j2ee="http://www.ibm.com/ccl/soa/deploy/j2ee/1.0.0/"
description="This is a sample topology describing the anatomy of
the topology model" displayName="Sample Topology"
name="SampleTopology"
decoratorSemantic="com.ibm.ccl.soa.deploy.analysis.ads"
namespace="developerworks.deploy">
<core:unit description="This is a sample unit"
displayName="SampleUnit" name="sampleUnit"/>
<core:unit
description="This is a sample configuration unit"
displayName="SampleConfigurationUnit"
name="sampleConfigurationUnit"
configurationUnit="true"/>
<core:unit
description="This is a sample conceptual unit"
displayName="SampleConceptualUnit"
name="sampleConceptualUnit"
conceptual="true"
goalInstallState="not_installed"
initInstallState="installed"
publishIntent="do_not_publish"/>
<core:unit
description="This is a stereotyped service component unit"
displayName="ServiceComponentUnit"
name="serviceComponentUnit">
<core:stereotype keyword="service"
profile="serviceProfile"/>
</core:unit>
<j2ee:unit.j2eeServerUnit
description="This is a J2eeServer unit "
displayName="J2EE Server Unit "
name="j2eeServerUnit" conceptual="true"
goalInstallState="installed"
initInstallState="installed">
<j2ee:capability.j2eeServer
description="This is a J2EE server capability"
displayName="J2EE Server Capability"
name="j2eeServer" linkType="any"/>
<j2ee:capability.j2eeContainer
description="This is a J2EE container capability"
displayName="J2EE Container Capability"
name="j2eeContainer"
linkType="hosting" containerVersion="1.4"/>
<j2ee:capability.servletContainer
description="This is a J2EE servlet container capability"
displayName="J2EE Servlet Container Capability"
name="j2eeServletContainer" linkType="hosting"
containerVersion="2.3"/>
<j2ee:capability.j2eeDatasource
description="This is a J2EE datasource dependency capability"
displayName="J2eeDatasourceCapability"
name="j2eeDatasourceCapability"
linkType="dependency" jndiName="jndi/datasource1"/>
<core:link.hosting name="j2eeServerUnitHostsearComponent"
source="/j2eeServerUnit"
target="/earComponent"/>
</j2ee:unit.j2eeServerUnit>
<j2ee:component.ear
description="This is an EAR Component "
displayName="EAR Component "
name="earComponent"
configurationUnit="false"
goalInstallState="installed"
initInstallState="not_installed">
<core:artifact.file
displayName="EAR Component1 EAR " name="a1">
<core:fileURI>j2eeEarComponent1.ear</core:fileURI>
</core:artifact.file>
<core:requirement
description="This is a datasource dependency requirement"
displayName="Datasource Dependency Requirement"
name="r0" dmoType="j2ee:J2EEDatasource"
linkType="dependency" use="optional">
<core:link.dependency name="r0Toj2eeDatasourceCapability"
source="/earComponent/r0"
target="/j2eeServerUnit/j2eeDatasourceCapability"/>
</core:requirement>
<core:requirement
description="This is a J2EE container hosting requirement"
displayName="J2EE Container Hosting Requirement"
name="r1"
dmoType="j2ee:J2EEContainer"
linkType="hosting"/>
<core:requirement description="This is a EJB component member
requirement showing that member of type EjbComponent unit are allowed "
displayName="EJB Component Member Requirement" name="r2"
dmoType="j2ee:EjbModule" linkType="member"/>
<core:link.member
name="earComponentContainsejbComponent"
source="/earComponent"
target="/ejbComponent"/>
</j2ee:component.ear>
<http:unit.httpServerUnit displayName="Http Server"
name="httpServerUnit" conceptual="false">
<http:capability.httpServer displayName="Http Server Capability "
name="Http Server Capability" linkType="any"/>
<j2ee:capability.servletContainer
displayName="Servlet Container Capability"
name="servletContainer" linkType="any"
containerVersion="2.3"/>
</http:unit.httpServerUnit>
<j2ee:component.ejb
displayName="EJB Component"
name="ejbComponent"
conceptual="false"
initInstallState="not_installed"
publishIntent="
publish">
<j2ee:capability.ejbModule
displayName="EJB Component"
name="ejbComponentCapability"
linkType="dependency"
id="EJBComponent"
version="1.0"/>
</j2ee:component.ejb>
</core:topology>
|

 |

|
您学到了什么
在这一系列的这个部分,您已经学习了用于 Rational Software Architect V7.5 部署架构中拓扑模型的基本概念。您构建了一个 样本拓扑,它阐述了一个拓扑模型的不同方面,包括拓扑,单元,需求,性能,以及能够表达它们之关系的集中关系类型。 您还分析了您在拓扑模型中表达类型和它们之间关系时应该考虑的设计决定,继续转向这个系列的下一部分,重点强调的是这个拓扑模型的一些高级概念:
- 拓扑抽象,封装和重用
- 实现连接关系
- 约束语义和使用
- 特定的 Constraint Links 语义和使用 (例如,(推迟执行,沟通,托管性能,协作,排列)
- 自定义属性加法指令
- 在拓扑中使用变量
下载 | 描述 | 名字 | 大小 | 下载方法 |
|---|
| 本文中使用的示例 Topology Project | SampleTopology.zip | 3KB | HTTP |
|---|
参考资料 学习
获得产品和技术
讨论
关于作者  | |  | Narinder Makin 位于美国北卡罗来纳州达勒姆的 IBM Research Triangle Park Lab 的一名软件工程师。 他是 Rational Application Developer 团队的一名 J2EE 和 SOA/SDO 工具的架构师。 |
对本文的评价
|