Dan Soares explains at NotesIn9 a nice way to read and write resource bundles. It’s a good read so enjoy his work. I was also faced with the problem of reading and a specially writing properties files, because Switzerland is multilingual and my idea was to give the power of translation to the hands of the business project leaders. But how to write properties files, and how to do it in am more productive way? I did go the same way as Dan, I did also find some sample from Sven Hasselbach, but the I asked my self, how can I provide this in an easy to consume way to my developers and to the community. This was the birth of a new part in the XPages Toolkit.
Btw. we started with the development of the XPages Tookit one year before we mad it public available on OpenNTF. And we want to be shure that we provide something useful and approved by our own developer team.
The result is a very easy to use API (requirement: Install the XPages Toolkit):
SSJS: to get the properties as java.util.Properties object: var properties = xptPropertiesBean.getProperties( databaseFilePath, fileNameOfyourProperties ); to save the properties: var success = xptPropertiesBean.saveProperties( databaseFilePath, fileNameOfYourProperties, properties);
Or to use in Java: XPTPropertiesBean bean = org.openntf.xpt.properties.beans.XPTPropertiesBean.get(); Properties props = bean.getProperties( databaseFilePath, fileNameOfyourProperties ); int success = bean.saveProperties( databaseFilePath, fileNameOfYourProperties, properties);
But be aware of the following. Each change to properties seems to reload your application on the server.
To stay informed about the recent development on the XPages Toolkit, please register here and discuss ideas and give feedback.