Properties files in a plugin

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Properties files in a plugin

Postby Andrew VanderVelde » Thu Apr 27, 2006 7:35 am

I'm using MD 9.5 and would like to use a properties file with my plugin. I
would get an error that it could not be located when I tried to use one. Is
there anything special I need to do to enable the use of a properties file?
Do I need to include it in the plugin.xml? Does MD have a library to read
properties files or do I need to do that? Thanks for your help.


Andrew VanderVelde
 
Posts Rating:

Re: Properties files in a plugin

Postby Tomas Pugzlys » Fri Apr 28, 2006 6:53 am

Hello,

> Do I need to include it in the plugin.xml?
You may use your plugin classloader to load your properties file.

For example if your property file is located in your plugin directory:
InputStream stream = getClass().getResourceAsStream("your.properties");
Properties prop = new Properties();
prop.load(stream);

If your property file is in your plugin jar:
InputStream stream =
getClass().getResourceAsStream("/com/your/plugin/packages/your.properties");
...

Regards,
--
Tomas Pugzlys
Programmer
No Magic Lithuanian Development Center
Savanoriu pr. 363- IV, LT-49425, Kaunas
P.O. box 2166, LT-44011, Kaunas
Phone: +370 37 324032 Fax: +370 37 320670
e-mail : tomasp
WWW: http://www.magicdraw.com
--
MagicDraw - UML Made Simple

nntp://news.nomagic.com/nomagic.products.magicdrawuml.openapi wrote:
> I'm using MD 9.5 and would like to use a properties file with my plugin. I
> would get an error that it could not be located when I tried to use one. Is
> there anything special I need to do to enable the use of a properties file?
> Do I need to include it in the plugin.xml? Does MD have a library to read
> properties files or do I need to do that? Thanks for your help.
>

Tomas Pugzlys
 
Posts Rating:


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 1 guest