`
zhangziyangup
  • 浏览: 1071707 次
文章分类
社区版块
存档分类
最新评论

构建 SOA 组合业务服务,第 6 部分: 自动化构建与部署步骤

 
阅读更多

背景知识

可以通过在面向服务的体系结构(Service-Oriented Architecture,SOA)框架中对多个不同的服务和数据存储区进行松散耦合来创建组合应用程序。SCA 规范(请参见参考资料部分中提供的链接)描述了用于使用 SOA 构建和组装应用程序和系统的模型。组合应用程序经常使用 Rational 工具(如 IBM Rational Application Developer)作为独立的项目开发,然后使用 IBM Websphere Integration Developer 组装为 SCA 模块。最后,将这些组装好的包部署在包含 IBM WebSphere Portal Server、IBM WebSphere Process Server 容器和 IBM DB2® 数据库服务器的宿主环境中。不过,在 Rational Application Developer 和 Websphere Integration Developer 中的很多构建和导出步骤以及 WebSphere Portal Server 和 WebSphere Process Server 中的部署步骤都是手动的 GUI 指向-点击步骤。在本文中,您将了解如何实现这些手动步骤的自动化。

组合应用程序 WebSphere 运行时环境

在部署环境中使用了 WebSphere 服务器的以下版本:

  • IBM WebSphere Process Server V6.0.1,其中包括 IBM WebSphere Application Server V6.0.2
  • IBM WebSphere Portal Server V6.0
  • IBM DB2 Universal Database V8.2
  • IBM Directory Server V5.2

自动构建将使用以下版本的 IBM 构建工具:

  • IBM Rational Software Architect V6.0.1,其中还包括 IBM Rational Application Developer V6.0.1
  • IBM WebSphere Portlet Factory V6.0
  • IBM WebSphere Integration Developer V6.0.1

自动构建解决方案

Apache Ant 是基于 Java 的构建工具,开发人员通常将其用于实现 Java 程序的自动化(有关 Apache Ant Project 的更多信息,请参见参考资料)。Eclipse 将 Ant 支持作为缺省功能提供(有关 Eclipse Ant 支持的更多信息,请参见参考资料)。在此解决方案中,将使用 Rational Application Developer 中的 runAnt 工具来启动 headless Eclipse 工作区,并执行 Ant 构建脚本(相关内容,请参见参考资料中提供的链接)。WebSphere Integration Developer 和 Rational Application Developer 提供了处理不同类型的组合应用程序项目的 Eclipse 构建程序。在 WebSphere Integration Developer 和 Rational Application Developer 内创建的这些项目的例子包括业务集成模块、Enterprise JavaBeans (EJB) 项目、动态 Web 项目和 Portlet 项目。可以在项目的顶级目录中的 .project 文件中找到每个项目对应的一组构建程序。在构建自动化流程中,可以将这些构建程序与 Rational Application Developer、WebSphere Integration Developer 及 WebSphere Portlet Factory 提供的 Ant 任务一起重用。

构建自动化流程将使用以下 Ant 任务:

  1. svn checkout ,用于从 SubVersion (SVN) 团队存储库签出项目源代码。
  2. projectSetImport ,用于将项目集导入 Eclipse 工作区。
  3. projectSetBuild ,用于使用 Eclipse 构建程序构建项目集。
  4. WebSphere Portlet Factory Ant 脚本,用于将 Portlet 打包为 WAR 文件。
  5. earExport ,用于将 Web 服务和 EJB 组件与 JAR 文件一起打包为 EAR 文件。
  6. moduleExport ,用于将 WebShpere Integration Developer 中的 SCA 模块项目和依赖项目打包为压缩文件。

以下内容对这些任务进行了详细的说明,可以参考下面具体的示例。

组合应用程序中的组成应用程序可以驻留在不同的源代码管理(Source Code Management,SCM)存储库中。清单 1 显示了如何在 SVN 存储库中从不同的位置为不同的组合应用程序提取源代码(有关 Subversion 的信息,请参见参考资料中提供的链接)。


清单 1. 用于从源代码控制系统中签出代码的 SVN Ant 任务

<taskdefresource="svntask.properties"/>
<propertyname="urlRepos"value="https://svn.yourcompany.com/svn/jivaro2/trunk"/>
<targetname="checkout">
<svn>
<checkouturl="${urlRepos}/asset"destPath="${output.dir}/src/asset"/>
</svn>
<svn>
<checkouturl="${urlRepos}/wps"destPath="${output.dir}/src/wps"/>
</svn>
<svn>
<checkouturl="${urlRepos}/webservice"destPath="${output.dir}/src/webservice"/>
</svn>
<svn>
<checkouturl="${urlRepos}/portal"destPath="${output.dir}/src/portal"/>
</svn>
</target>

清单 2 显示了旨在使用 projectSetImport 将签出的项目导入 Eclipse 工作区的 Ant。


清单 2. 将项目集导入到 Eclipse 工作区

<targetname="importAllProject"depends="init">
<!--###projectSetImportandBuild(allnormalprojects)###-->
<echomessage="${ant.project.name}importAllProjectSTARTED..."/>
<projectSetImportProjectSetFileName="${projectSetFileName}"
failOnError
="${failonerror}"
autoDeleteExistingProjects
="${autoDeleteExistingProjects}"/>
<echomessage="ProjectSetImportedProjectNames=${ImportedProjectNames}"/>
<echomessage="${ant.project.name}importAllProjectDONE."/>
</target>

projectSetImport 任务使用 Eclipse Project Set 文件来指定要导入的项目及其在文件系统中的位置,如清单 3 中所示。


清单 3. 指定组合应用程序组件的 Eclipse 项目在文件系统中的位置

<psfversion="2.0">
<providerid="antimportProjectSet">
<projectreference="1.0,antimportProjectSet,
./tmp/src/wps/CWYBC_JDBC,CWYBC_JDBC"
/>
<projectreference="1.0,antimportProjectSet,
./tmp/src/wps/CWYFF_FlatFile,CWYFF_FlatFile"
/>
<projectreference="1.0,antimportProjectSet,
./tmp/src/wps/DynamicServiceLibrary,DynamicServiceLibrary"
/>
<projectreference="1.0,antimportProjectSet,
./tmp/src/wps/SasBankSharedWebServiceLib,SasBankSharedWebServiceLib"
/>
</provider>
</psf>

每个 WebSphere Portlet Factory Portlet 项目均包含用于导出为 WAR 文件的 Ant 脚本。清单 4 显示了如何调用 Portlet 项目的 Ant 脚本。


清单 4. 将 WebSphere Portlet Factory Portlet Eclipse 项目导出为 WAR 文件

<targetname="exportWPFWar"depends="importAllProject">
<antdir="${src.portal}/J2BWPFPortlets/WEB-INF/bin/deployment/jsr168"
antfile
="${src.portal}/J2BWPFPortlets/WEB-INF
/bin/deployment/jsr168/build_deployment.xml"
>
<propertyname="output.location"value="${dist}"/>
<propertyname="rootDirectory"value="${src.portal}/J2BWPFPortlets/WEB-INF"/>
<propertyname="warfile"value="J2BWPFPortlets.war"/>
<propertyname="webxmlFile"value="./web.xml"/>
</ant>
.
.
</target>

清单 5 显示了如何使用 Ant 任务 earExport 来构建和将 Web 服务与 EJB 实现打包为 EAR 文件。


清单 5. 用于构建和将 Web 服务与 EJB 实现打包为 EAR 文件的 earExport

<targetname="buildWebservice"depends="importAllProject">
<projectSetBuildProjectSetFileName="${webserviceSetFileName}"useBuildXML="false"
failOnError
="${failonerror}"/>
<antcalltarget="exportWebServiceEarFiles"/>
</target>

<targetname="exportWebServiceEarFiles">
<earExportEARProjectName="SaasBankUserGroupEJBProjectEAR"
EARExportFile
="${dist}/SaasBankUserGroupEJBProjectEAR.ear"Overwrite="true"/>
<earExportEARProjectName="NewCreditCheckEJBProjectEAR"
EARExportFile
="${dist}/NewCreditCheckEJBProjectEAR.ear"Overwrite="true"/>
.
.
</target>

清单 6 显示了如何使用 Ant 任务 moduleExport 在 WebSphere Integration Developer 中构建和打包 SCA 模型项目。注意:需要调用 ServiceDeploy Ant 任务来生成可部署的 SCA 模块。另外,需要从 developerWorks 单独下载 moduleExport Ant 任务。请参见“Develop an Automated Build Engine Using WebSphere Integration Developer”(developerWorks,2006 年 11 月)。


清单 6. 调用 ServiceDeploy Ant 任务来生成可部署 SCA 模块

<taskdefname="moduleExport"classname="com.ibm.wbit.anttasks.IntegrationModuleZipExport"
classpath
="${basedir}/IntegrationModuleZipExport.jar:${wid.home}/eclipse
/plugins/org.eclipse.ui.ide_3.0.1/ide.jar"
/>

<targetname="moduleExport"depends="importAllProject">
<moduleExportproject="${workspace}/SasBankWSSelectors"
output
="${output.dir}/SasBankWSSelectors.zip"/>
</target>

<targetname="exportSCAEar"depends="moduleExport">
<execdir="${buildscripts.dir}"executable="${service.deploy}">
<argline="${output.dir}/SasBankWSSelectors.zip-outputApplication
${dist}/SasBankWSSelectors.ear-cleanStagingModules-noj2eedeploy-ignoreErrors"
/>
</exec>
.
.
</target>

自动构建流程的最后,要将这些 EAR 和 WAR 文件打包为单个压缩文件,如清单 7 中所示。


清单 7. 将文件打包为单个 zip 文件

<propertyname="zipName"value="${basedir}/JivaroBankingV2.zip"/>

<targetname="buildzip"depends="clean,checkout,cleanSVNPath,
buildWebservice,buildAsset,buildPortal,buildWPS"
>
<zipdestfile="${zipName}"basedir="${buildDir}"/>
</target>

WebSphere Process Server 的自动部署解决方案

在我们的部署拓扑中,将使用 WebSphere Process Server 实例承载 SCA 模块、J2EE 包,并使用独立的 WebSphere Portal Server 实例来承载门户组件。之所以这样,是因为 WebSphere Portal Server 会消耗大量的 Java 堆。使用实用工具 pcatWindows.exe 来在 WebSphere Process Server 中创建独立的 WebSphere 配置文件,以承载 SCA 模块。调用此实用工具时,要指定用于进行静默安装的响应文件(请参见参考资料中提供的指向“Creating a JDBC Provider and a DataSource Using Java Management Extensions API and the Scripting Tool”的链接)。清单 8 中的 Ant 任务演示了如何从 Ant 脚本调用此实用工具。


清单 8. 在 WebSphere Process Server 中创建用于承载 SCA 模块的独立 WebSphere 配置文件

<!--Setglobalproperties-->
<propertyname="wasHome"value="D:IBMRationalSDP.0 untimesi_v6"/>
<propertyname="wasBin"value="${wasHome}in"/>
<propertyname="profileName"value="pf2"/>
<propertyname="profilePath"value="D:IBMWebSpherepf2"/>
<propertyname="cell"value="widCell"/>
<propertyname="node"value="widNode"/>
<propertyname="host"value="localhost"/>
<propertyname="server"value="server1"/>

<targetname="createWBIProfile">
<execexecutable="${wasBin}ProfileCreator_wbipcatWindows.exe"failonerror="on">
<argline="-options${basedir} esponsefile.txt-silent"/>
</exec>
</target>

接下来,在 WebSphere Process Server 中创建数据源,以连接到数据库层。“Creating a JDBC Provider and a DataSource Using Java Management Extensions API and the Scripting Tool”(请参见参考资料)说明了如何使用 WebSphere WsAdmin Java Command Language (JACL) 脚本自动创建数据源。将从 Ant 脚本内使用 WebSphere Application Server Ant 任务 WsAdmin 调用 WsAdmin 脚本,如清单 9 中所示。


清单 9. 在 WebSphere Process Server 中创建数据源

<!--Setglobalproperties-->
<propertyname="wasHome"value="D:WebSphereProcServer"/>
<propertyname="conntype"value="none"/>
<propertyname="host"value="localhost"/>
<propertyname="script"value="sasDataSourceCreate.jacl"/>
<propertyname="node"value="PoddarPCNode01"/>
<propertyname="server"value="server1"/>
<propertyname="dbuser"value="db2admin"/>
<propertyname="dbpassword"value="ondemand"/>
<propertyname="dbserver"value="localhost"/>

<taskdefname="WsAdmin"classname="com.ibm.websphere.ant.tasks.WsAdmin"/>

<targetname="createDataSource">
<WsAdminwasHome="${wasHome}"script="${script}">
<argvalue="-node"/>
<argvalue="${node}"/>
<argvalue="-server"/>
<argvalue="${server}"/>
<argvalue="-dbuser"/>
<argvalue="${dbuser}"/>
<argvalue="-dbpassword"/>
<argvalue="${dbpassword}"/>
<argvalue="-dbname"/>
<argvalue="SASBNKDB"/>
<argvalue="-dbserver"/>
<argvalue="${dbserver}"/>
<argvalue="-dsname"/>
<argvalue="ebankdb"/>
<argvalue="ebankdb"/>
</WsAdmin>
</target>

WebSphere Application Server 提供了名为 ws_ant 的实用工具,用于将 WsAdmin 之类的 WebSphere 特定的 Ant 任务与内置 Apache Ant 任务一起打包。可使用 ws_ant 实用工具和 WebSphere Application Server Ant 任务 wsInstallApp 将 WebSphere 流程模块、Web 服务及 EJB 应用程序部署到 WebSphere Process Server 中,如清单 10 中所示。


清单 10. 部署 WebSphere 流程模块

<!--Setglobalproperties-->
<propertyname="temp"value="${basedir}/tmp"/>
<propertyname="wasHome"value="D:IBMRationalSDP.0 untimesi_v6"/>
<propertyname="conntype"value="SOAP"/>
<propertyname="host"value="localhost"/>
<propertyname="port"value="8880"/>
<propertyname="user"value="wpsbind"/>
<propertyname="password"value="wpsbind"/>

<taskdefname="wsInstallApp"classname="com.ibm.websphere.ant.tasks.InstallApplication"/>

<targetname="installApps"depends="unZipPack,unInstallApps">
<wsInstallAppwasHome="${wasHome}"ear="${temp}/CEIEventEmitterRouterEAR.ear"
conntype
="${conntype}"
host
="${host}"
port
="${port}"
user
="${user}"
password
="${password}"
failonerror
="false"/>

<wsInstallAppwasHome="${wasHome}"ear="${temp}/CEIQueryServiceEAR.ear"
conntype
="${conntype}"
host
="${host}"
port
="${port}"
user
="${user}"
password
="${password}"
failonerror
="false"/>
.
.
.
</target>

WebSphere Portal Server 的自动部署解决方案

组合应用程序中的 Portlet 经常要求与 WebSphere Process Server 中的人工任务管理器进行交互。要部署这些 Portlet,请首先在 WebSphere Portal Server 中创建 WebSphere Process Server 配置文件(请参见参考资料,其中提供了指向“Creating a Stand-Alone Server Profile Silently”的链接)。此配置文件允许 WebSphere Portal Server 和 WebSphere Process Server 在相同的应用服务器实例内运行。

门户主题和皮肤经常用于提供属于不同企业的独特门户外观(请参见参考资料,其中提供了指向“Deploying Customized Themes and Skins”的链接)。可以使用 Ant 自动部署门户主题和皮肤,如清单 11 中所示。


清单 11. 使用 Ant 脚本将主题和皮肤部署到 WebSphere Portal Server 中

<targetname="checkout"unless="USE_CVS">
<svn>
<checkouturl="${urlRepos}/installation/InstallationFiles/ThemesSkins"
destPath
="${temp}"/>
</svn>
</target>

<targetname="copyThemesSkins"depends="clean">
<copytodir="${destTheme}/SasBankBank1AdminTheme"overwrite="true">
<filesetdir="${temp}/SasBankBank1AdminTheme"/>
</copy>
<copytodir="${destTheme}/SasBankBank1Theme"overwrite="true">
<filesetdir="${temp}/SasBankBank1Theme"/>
</copy>
<copytodir="${destTheme}/SasBankBank2Theme"overwrite="true">
<filesetdir="${temp}/SasBankBank2Theme"/>
</copy>
<copytodir="${destSkin}/SasBankBank1Skin"overwrite="true">
<filesetdir="${temp}/SasBankBank1Skin"/>
</copy>
<copytodir="${destSkin}/SasBankBank2Skin"overwrite="true">
<filesetdir="${temp}/SasBankBank2Skin"/>
</copy>
</target>

在自动构建流程执行期间,会将 Portlet 导出为 WAR 文件。可以使用 WebSphere Portal Server XML 配置接口来部署 Portlet 和 Portlet 的配置。此接口会在 WebSphere Application Server 安装目录的 installableAppes 子目录中查找 Portlet WAR 文件。可以使用清单 12 中的 Ant 脚本来将 Portlet WAR 文件放到恰当的目录中。


清单 12. 用于将 Portlet WAR 文件放入相应的目录中的 Ant 脚本

<propertyname="portalServer"value="Z:sasPortalServer"/>
<propertyname="portalInstallable"value="${portalServer}/installableApps"/>

<targetname="unZipPack">
<unzipsrc="${basedir}/JivaroBankingV2.zip"dest="${temp}/war">
<patternset>
<includename="**/*.war"/>
</patternset>
</unzip>
</target>

<targetname="copyWarToPortal"depends="unZipPack">
<copytodir="${portalInstallable}"overwrite="true">
<filesetdir="${temp}/war"/>
</copy>
</target>

可以在 WebSphere Application Server 中使用虚拟门户来在单个应用服务器实例中承载多个承租者。清单 13 中的 Ant 脚本说明了如何在 WebSphere Portal Server 中创建虚拟门户。


清单 13. 在 WebSphere Portal Server 中创建虚拟门户

<targetname="setConfigCommand">
<conditionproperty="WPSConfig"value="WPSConfig.bat">
<and>
<osfamily="windows"/>
</and>
</condition>
<conditionproperty="WPSConfig"value="WPSConfig.sh">
<and>
<osfamily="unix"/>
</and>
</condition>
</target>

<targetname="createVirtualPortal"depends="setConfigCommand">
<execdir="${portalConfig}"executable="CMD">
<argline="/C${WPSConfig}create-virtual-portal-DVirtualPortalTitle=bank1
-DVirtualPortalRealm=bank1-DVirtualPortalContext=bank1"
/>
</exec>
<execdir="${portalConfig}"executable="CMD">
<argline="/C${WPSConfig}create-virtual-portal-DVirtualPortalTitle=bank2
-DVirtualPortalRealm=bank2-DVirtualPortalContext=bank2"
/>
</exec>
<execdir="${portalConfig}"executable="CMD">
<argline="/C${WPSConfig}create-virtual-portal-DVirtualPortalTitle=bank3
-DVirtualPortalRealm=bank3-DVirtualPortalContext=bank3"
/>
</exec>
</target>

最后,清单 14 中的 Ant 脚本说明了如何使用 WebSphere Portal XML 配置接口为每个虚拟门户部署门户配置。


清单 14. 使用 WebSphere Portal Server XML 配置接口配置每个虚拟门户

<targetname="importBanks"depends="copyThemesSkins,copyWarToPortal,createVirtualPortal,
setXmlAccessCommand,copyWarToPortal"
>
<execdir="${portalBin}"executable="CMD">
<argline="/C${xmlAccess}-in${basedir}anksrelease.xml
-userwpsadmin-pwdwpsadmin-urlhttp://${host}:${port}/wps/config"
/>
</exec>
<execdir="${portalBin}"executable="CMD">
<argline="/C${xmlAccess}-in${basedir}ank1release.xml
-userwpsadmin-pwdwpsadmin-urlhttp://${host}:${port}/wps/config/bank1"
/>
</exec>
<execdir="${portalBin}"executable="CMD">
<argline="/C${xmlAccess}-in${basedir}ank2release.xml
-userwpsadmin-pwdwpsadmin-urlhttp://${host}:${port}/wps/config/bank2"
/>
</exec>
</target>

可以使用 WebSphere Portal Server XML 配置接口(请参见参考资料,其中提供了指向“Moving from a Test to Production Server Using the XML Configuration Interface”的链接)来将门户配置从开发/过渡环境导出到生产环境中。还可以使用 WebSphere Portal 发布构建程序工具(有关更多信息,请参见参考资料)来开发将门户配置部署到生产服务器所需的配置更改的测试版。清单 15 中的命令说明了如何使用 xmlaccessreleasebuilder 生成测试版 XMLAccess 配置文件。


清单 15. 使用 xmlaccess 和 releasebuilder 生成测试版 XMLAccess 配置文件

1.xmlaccess.bat-inExportRelease.xml-userwpsadmin-passwordwpsadminpwd
-urlhttp:
//testportalserver.yourco.com/wps/config-outREV1_config.xml
2.Deployportlets,themesandskinsandcreatevirtualportals.
3.xmlaccess.bat-inExportRelease.xml-userwpsadmin-passwordwpsadminpwd
-urlhttp:
//testportalserver.yourco.com/wps/config-outREV2_config.xml
4.releasebuilder.bat-inOldREV1_config.xml-inNewREV2_config.xml
-outoutputfile
.xml

清单 16 说明了如何使用 WebSphere Portal Server xmlaccess 接口为 Portlet 配置主题和皮肤。


清单 16. 使用 WebSphere Portal Server xmlaccess 接口为 Portlet 配置主题和皮肤

<?xmlversion="1.0"encoding="UTF-8"?>

<requestxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"build="wp5103_025"
type
="update"version="5.1.0.3"xsi:noNamespaceSchemaLocation="PortalConfig_1.3.1.xsd">
<portalaction="locate">
<skinaction="update"active="true"default="false"
objectid
="_K_003II0L7N8022GN6_69"
resourceroot
="SasBankBank1Skin"type="default">
<localedatalocale="en">
<title>Bank1Skin</title>
<description></description>
</localedata>
</skin>

<themeaction="update"active="true"default="false"
defaultskinref
="_K_003II0L7N8022GN6_69"objectid="_J_003II0L7N8022GN6_69"
resourceroot
="SasBankBank1Theme">
<localedatalocale="en">
<title>Bank1Theme</title>
<description></description>
</localedata>
<allowed-skinskin="_K_00KC5030880624SK_35"update="set"/>
<allowed-skinskin="_K_00KC5030880624SK_39"update="set"/>
.
.
</theme>
</portal>
</request>

清单 17 中的 XML 代码片段说明了用于在 WebSphere Portal Server 中配置 Portlet WAR 文件的 XMLAccess 脚本的内容。配置信息包括要求有一些预先存在的门户安全性配置的访问控制配置(请参见参考资料,其中给出了指向“Section DB2 and Tivoli® Directory Server Configuration”的链接)。


清单 17. 使用 XMLAccess 配置门户安全性

<web-appaction="update"active="true"objectid="_1_00KC5030880624SK_IP"
removable
="true"
uid
="sasbankloanapprovalportlet.SasBankLoanApprovalPortletPortlet.9bdb2f3550.webmod">
<url>file://localhost/$server_root$/installableApps/SasBankLoanApprovalPortlet.war</url>
<access-controlexternalized="false"owner="undefined"private="false">
<roleactionset="Editor"update="set">
<mappingsubjectid="cn=wpsadmin,cn=groups,dc=banks,dc=com"
subjecttype
="user_group"update="set"/>
<mappingsubjectid="cn=wpsadmins,cn=groups,dc=bank3,dc=com"
subjecttype
="user_group"update="set"/>
<mappingsubjectid="cn=bank1admins,cn=groups,dc=bank1,dc=com"
subjecttype
="user_group"update="set"/>
</role>
</access-control>
<servletaction="update"active="true"cache-expiration="0"
objectid
="_V_00KC5030880624SK_IP"
referenceid
="LoanApprovalPortlet.servlet"
remote-cache-dynamic
="false"
remote-cache-scope-private
="false"/>
<portlet-appaction="update"active="true"defaultlocale="en"
name
="sasbankloanapprovalportlet.SasBankLoanApprovalPortletPortlet.9bdb2f3550"
objectid
="_2_00KC5030880624SK_IP"
uid
="sasbankloanapprovalportlet.SasBankLoanApprovalPortletPortlet.9bdb2f3550">
<access-controlexternalized="false"owner="undefined"private="false"/>
<portletaction="update"active="true"defaultlocale="en"
name
="LoanApprovalPortlet"objectid="_3_00KC5030880624SK_IP"
provided
="false"servletref="_V_00KC5030880624SK_IP">
<access-controlexternalized="false"owner="undefined"private="false">
<roleactionset="Editor"update="set">
<mappingsubjectid="cn=wpsadmin,cn=groups,dc=banks,dc=com"
subjecttype
="user_group"update="set"/>
<mappingsubjectid="cn=wpsadmins,cn=groups,dc=bank3,dc=com"
subjecttype
="user_group"update="set"/>
<mappingsubjectid="cn=bank1admins,cn=groups,dc=bank1,dc=com"
subjecttype
="user_group"update="set"/>
</role>
</access-control>
</portlet>
</portlet-app>
</web-app>

除了 Portlet 配置和主题与皮肤的配置外,包含在 XMLAccess 配置文件中的门户解决方案版本还包括门户配置数据,如内容树、页布局、访问控制列表等。

DB2 和 Tivoli Directory Server 配置脚本

清单 18 显示了一个 IBM 目录服务器配置文件,该文件配置轻量级目录访问协议(Lightweight Directory Access Protocol,LDAP)服务器,以提供 WebSphere Portal 和 WebSphere Process Server 安全性。


清单 18. 使用轻量级数据交换格式(Lightweight Data Interchange Format,LDIF)脚本配置 LDAP 服务器,以提供 WebSphere Portal 和 WebSphere Process Server 安全性

version:1

dn:dc
=banks,dc=com
objectclass:domain
objectclass:top
#Addlinesaccordingtothisschemethatcorrespondtoyoursuffix
dc:banks
,dc=com
dc:banks


dn:dc
=bank1,dc=com
objectclass:domain
objectclass:top
dc:bank1
,dc=com
dc:bank1

dn:cn
=users,dc=bank1,dc=com
objectclass:container
objectclass:top
cn:users
.
.
.

可以使用清单 19 中的 IBM Directory Server 命令将此用户数据导入到目录服务器中。


清单 19. 将此用户数据导入目录服务器

idsldif2db-iAllBanks.ldif-I<youridsinstance>

可以使用清单 20 中的 IBM DB2 Universal Database™ Data Definition Language (DDL) 脚本配置数据库层。


清单 20. 使用 DDL 脚本配置数据库层

echo---createtheCreditDBdatabase---;
CREATEDATABASECREDITDB;

echo
---connecttoCREDITDBdatabase---;
CONNECTTOCREDITDB;

createschemacredit;

--Thistablestoresthebasiccustomerinformationincludingcreditscore
echo---dropthecredit.customertable---;
droptablecredit.customer;
echo
---createthecredit.customertable---;
createtablecredit.customer(
custID
char(32)NotNULL,
firstname
varchar(32),
lastname
varchar(32),
creditscore
INT,
ssn
CHAR(9)notnull,
statusdate
TimestampnotnullwithdefaultCURRENT_TIMESTAMP,
phone
CHAR(20),
altphone
CHAR(20),
marital
CHAR(1),
sex
CHAR(1),
dobDATE,
street
varCHAR(50),
city
varchar(32),
state
CHAR(12),
zipcode
CHAR(10),
country
varchar(32),
homeowner
smallint,
primarykey(custID)
);
echo
---adduniqueconstrainttothecredit.customertable---;
altertablecredit.customeraddunique(ssn);

可以使用清单 21 中的 DB2 命令配置 DB2 数据库上的模式。


清单 21. 配置 DB2 数据上的模式

db2-fcredit.ddl

问题与解决办法

设置自动构建和部署时可能会遇到一些问题:

  1. 从 WebSphere Process Server 卸载业务流程执行语言(Business Process Execution Language,BPEL)或 HumanTask 组件应用程序前,必须确保所有 BPEL/HumanTask 实例均已终止,否则就不能正确卸载。可以使用 Business Process Choreographer Explorer 来检查和终止流程的任何活动实例(有关使用 Business Process Choreographer Explorer 的更多信息,请参见参考资料)。
  2. Microsoft® Windows® 中的长路径可能在部署期间导致 WSAdmin 中出现错误,包括 [wsadmin] java.io.IOException: java.io.IOException: The URI length is greater than the Windows limit of 259 characters. Unable to create or update file. 这通常都是无害的。
  3. 在与 WebSphere Process Server V6.0.1 相同的 Windows 计算机上安装 WebSphere Portal Server V5.1.0.3 可能会导致出现问题。您可能需要在安装 WebSphere Portal Server 前删除文件 c:/Windows/vpd.properties。

结束语

在本文中,我们了解了如何为使用各种类型组件的组合应用程序开发自动构建和部署解决方案,这些组件包括 Portlet、流程模块、Web 服务、J2EE 组件、数据库模式以及 LDAP 模式。我们使用了各个 WebSphere 产品(如 WebSphere Process Server)提供的 Ant 任务、WebSphere Portal 和 WebSphere Application Server 支持的脚本语言、DB2 及 Tivoli LDAP 目录服务器。我们已经作为示例了解了采用脚本的自动化解决方案的各个代码片段。请一定参阅“参考资料”部分提供的各个参考信息,以了解有关这些主题的更多信息。

参考资料

学习

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics