您的位置:首页 > 其它

在 IBM WebSphere Service Registry and Repository 中使用简单 XML 接口和 JMX管理 API分类加载

2008-10-07 14:53 337 查看
通过在 IBM® WebSphere® Service Registry and Repository
中创建类别分类,您可以灵活地对服务和元数据进行编目和组织,从而实现高效的治理。本文介绍一种使用基于 XML 的接口将类别分类加载到 WebSphere
Service Registry and Repository 中的机制,还可以将这种机制扩展为将类别分类从其他外部系统同步到 WebSphere
Service Registry and Repository 的集成机制。了解如何使用 WebSphere Service Registry and
Repository 提供的 Java™ 管理扩展(Java Management Extensions,JMX)来管理 API 将类别分类加载到
WebSphere Service Registry and Repository 中。
引言

WebSphere Service Registry and Repository
允许您发布、查找、充实、管理和治理面向服务的体系架构(Service-Oriented
Architecture,SOA)中的服务和策略(有关更多信息,请参阅“IBM WebSphere Service Registry and Repository 简介,第 1 部分:
WebSphere Service Registry and Repository 在 SOA 生命周期中的一天 ”)。

在本文中,了解如何在 WebSphere Service Registry and Repository 中使用简单 XML
接口以编程方式创建类别分类。WebSphere Service Registry and Repository 允许您导入使用 Web 本体语言(Web
Ontology Language,OWL)创建的类别分类。目前,这些 OWL 文件是通过 WebSphere Service Registry and
Repository 中提供的简单 Web 用户界面或通过其他自定义方法来手动创建的。

其他公司 IT 系统中通常存在组织和功能分类,需要以编程方式将它们提取并加载到 WebSphere Service Registry and
Repository 中。这样的分类可能会在维护它们的其他系统中更改(尽管不是经常更改),这种情况是相当普遍的,您需要将这些分类与 WebSphere
Service Registry and Repository 保持同步。基于 XML 的接口通过提供表示分类信息的规范格式,并使用 WebSphere
Service Registry and Repository 提供的 JMX 接口,以编程方式将分类加载到 WebSphere Service
Registry and Repository 中,从而解决了这些问题。








回页首
背景

类别分类为您提供了一种组织 WebSphere Service Registry and Repository
中的服务和服务元数据的方法。将各种服务和关联的元数据元素分类为适当类别的能力,是有效治理和管理的重要支持功能之一。分类系统通常包含分类的层次结构,这些分类定义了该分类中的实体。WebSphere
Service Registry and Repository 通过 OWL 本体定义文件的定义来支持使用类别分类,该文件根据分类和子分类来布置分类系统。虽然
OWL 本体能够以具有丰富语义的方式定义实体和关系,但是适合用于在 WebSphere Service Registry and Repository
中定义分类系统的本体定义仅采用了这些功能的有限子集,特别是分类和子分类(有关 OWL 的更多信息,请参阅参考资料)。

目前,WebSphere Service Registry and Repository 提供了基于 Web 的简单 UI
来定义类别分类和包含分类。(有关该 UI 的更多详细信息,请参阅参考资料中的 WebSphere Service Registry and Repository
产品信息中心链接。)WebSphere Service Registry and Repository 还提供了一个基于 JMX 的 API,用于加载已经定义为
OWL 本体的类别分类。其他实用工具提供了各种方法,允许以文本文件格式指定类别分类以创建 OWL 文件,然后您可以将这些文件加载到 WebSphere
Service Registry and Repository 中(有关更多信息,请参阅文章“Creating customized classification systems with WebSphere
Service Registry and Repository V6.0.0.1 and higher” 和“Creating business model templates with WebSphere Service
Registry and Repository V6.1”)。

本文描述的实用工具(和方法)也称为
WSRRClassificationLoader
,它使用规范 XML
格式来布置类别分类,使用可扩展样式表语言(Extensible Stylesheet Language,XSL)转换将其转换为 OWL 文件,并使用 JMX
API 将类别分类加载到 WebSphere Service Registry and Repository
中。你可以利用和扩展此方法,将其作为在多个系统中维护分类的同步机制,包括 WebSphere Service Registry and
Repository。








回页首
规范 XML Schema 格式

规范 XML Schema 格式指定了能够在 WebSphere Service Registry and Repository
中可表示的类别分类中定义的元素。这种简单 Schema 格式捕获类别分类的元素,用户可以使用 WebSphere Service Registry and
Repository UI 手动输入这些元素以创建类别分类。根元素应该是
ClassificationTaxonomy

类型。
ClassificationTaxonomy
中必需的元素是
name

URI
comment
元素是可选的,此元素指定类别分类的描述。可选地,可以使用
nameLanguageVariants
commentLanguageVariants

元素以替代语言指定
name
comment
元素的变体。这些变体的类型为
LanguageVariant
,需要指定
language

translation
元素,其中
language

表示替代语言的语言代码,
translation
是该元素在指定的替代语言中的表示形式。图 1 显示了规范 XML Schema
的重要元素的图形表示。

图 1. 规范 XML Schema



ClassificationTaxonomy
下的
rootNodes

元素表示构成该分类层次结构的根节点的分类列表。该元素的类型为
Node
,需要
id

name
元素,其中
id
表示该节点在整个类别分类下的唯一标识符,
name

表示该节点的用户友好的名称。您可以为
Node
指定可选的
comment
元素。与
ClassificationTaxonomy
类型相似,
Node
类型可以包含
name
comment
元素的其他语言变体。但是要注意,附加的语言元素需要与在
ClassificationTaxonomy
级别指定的语言元素相同。例如,当您在
ClassificationTaxonomy
级别仅指定了法语语言变体之后,不能在
Node

级别指定德语语言变体。
Node
类型又可以在
childrenNodes
元素之下包含其他
Node
类型,从而建立类别分类的树形结构。图 2 显示了使用规范 XML Schema
格式表示的类别分类的示例。

图 2. 假想的 IBM 组织分类










回页首
XSL 转换方法

在使用规范 XML 格式定义类别分类之后,
WSRRClassificationLoader
实用工具将读取并验证该 XML
文件。在验证之后,将使用 XSL 转换(XSL transformation,XSLT)将该 XML 文件中指定的类别分类转换为对应的 OWL
文件格式。对于没有经验的人来说,XSLT 通常用于将一个 XML 文档转换为另一个 XML 文档。在此例中,则是将符合规范模式的 XML 文档转换为 OWL
文档。
classificationTaxonomy
元素转换为 OWL
ontology
元素。使用 XSL
转换,
Node
元素
rootNodes
childrenNodes

分别转换为 OWL
Class
subClassOf
元素。(有关用于转换的 XSLT
代码片段,请参见图 3。请参阅下载部分以获取完整的
XSLT。)

图 3. 用于创建 OWL 的 XSL 转换

本文转自IBM Developerworks中国

请点击此处查看全文
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: