`

windchill交流第一篇:增加自定义.xconf文件存储配置信息

阅读更多
所有文章全部原创,如有不对,欢迎留言指正。
请按照如下步骤进行:
第一步,新建任一后缀为.xconf的文件,存放于codebase目录下。我在codebase的ext文件夹里新建一个test.properties.xconf文件,路径为codebase/ext/test.properties.xconf。
第二步,向test.properties.xconf里添加基本的配置信息,内容如下:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Configuration SYSTEM "xconf.dtd">
<!--配置自动生成的properties文件的位置 -->
<Configuration targetFile="codebase/ext/test.properties">
<!--
配置该文件内添加的客制化信息的默认存储位置,一般和生成的properties文件位置相同
-->
<Property default="ext/test.properties" name="wt.services.applicationcontext.WTServiceProviderFromProperties.customPropertyFiles" />
</Configuration>

第三步,打开windchill shell 执行如下命令:
xconfmanager -i codebase/ext/test.properties.xconf -p

成功执行完上述步骤后,进行如下验证:
1,观察codebase/ext目录,多了两个文件:test.properties和test.properties.annotated,这两个文件都是不可以手动修改的,只能使用命令将.xconf文件的内容添加进去。
2,打开<wt_home>/declarations.xconf,可以看到在文件的末尾添加了如下信息:
<ConfigurationRef xlink:href="codebase/ext/test.properties.xconf"/>


如果上述文件和内容都能正确创建添加,说明我们自定义的test.properties.xconf生效,同时可以向该文件添加需要的内容。
例如:
可修改test.properties.xconf文件,添加一条验证action的信息到<Configuration></Configuration>节点里,内容如下:
<Service context="default" name="com.ptc.core.ui.validation.UIComponentValidator">
		<Option requestor="null" serviceClass="ext.portal.validation.MainTabValidator" selector="product" />
		<Option requestor="null" serviceClass="extportal.validation.MainTabValidator" selector="project" />
	</Service>

在这里我增加了客制化验证product(产品库菜单)和project(项目库菜单)显示或隐藏的内容。
当然,添加完毕,还需要执行命令
xconfmanager -i codebase/ext/test.properties.xconf -p

以便将test.properties.xconf里的内容写入test.properties和test.properties.annotated文件。

最后,重启windchill服务,添加的内容即可生效。

第一篇windchill相关的文章发布,以后会陆续发布经过准确测试的代码。
分享到:
评论
5 楼 alexandrae2008 2011-08-09  
..9.0.忘记看博主的header了....
4 楼 alexandrae2008 2011-08-09  
这个8.0的?..可怜我还在做6.28的..
3 楼 刀枪剑戟 2011-04-11  
必须是的!
2 楼 helloboy077 2011-03-17  
ls 两位难道是西安PTC的?
1 楼 iStar 2010-11-25  
难道楼主是PTC的同事?

相关推荐

Global site tag (gtag.js) - Google Analytics