Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
If I want to maintain an xml file (which is used for some attributes comparison between windchill and a third party system), where is the right place to keep that file?
Hi,
There is no real rule for such requirement.
What I would recommand is to keep things open 🙂
By open, I mean no absolute path to the file, and easy to change.
What I do in such case is to add a property to wt.properties, and use a custom folder under $WT_HOME :
<Property default="$(wt.home)$(dir.sep)MyCustomApplication$(dir.sep)configuration$(dir.sep)Mapping.xml"
name="ext.customapp.MappingFile"
targetFile="codebase/wt.properties"/>
( This notation is not the one used in site.xconf : Another best practice is to include an xconf file to declaration.xconf with xconfmanager -i
This custom xconf file handles all the custom properties. )
To read the property
wt.util.WTProperties.getLocalProperties().getProperty("ext.customapp.MappingFile")
regards
I have followed as you described in the second way to have a custom.properties
When I propagate my custom.properties file, the value directly going there.
<Property name="myproject.custom.MappingFile" default="$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml"/>
and I am trying to read the value through
MyProjectPropertyFileReader fileRead = MyProjectPropertyFileReader.newMyProjectPropertyFileReader();
strValue = fileRead.getProperty("myproject.custom.MappingFile");
this is returning as below,
$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml"
but I want the it as,
"E:\ptc\Windchill\myproject\configuration\Mapping.xml" so that I can read the mapping file.
Could you please let me know what am I missing here?
Hello Olivier,
When I place targetFile as wt.properties and read as you mentioned, it works. Thanks a lot for your help.
<Property name="myproject.custom.MappingFile" default="$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml" targetFile="codebase/wt.properties"/>
Good 🙂
I stopped using custom properties files.
Instead, I use a custom xconf file with wt.properties as its target, like you did.
So you can take advantage of the properties auto reload mechanism.