Hi,
Have a seperate name.properties file on the classpath .U can access these
files by creating a java.util.PropertyResourceBundle
object
The code skeleton looks like this
lets say name.properties has a entry servername = http://myServer
port = 7001
in the EJB (say the setEntityContext method u can access the file and read
the properties like this)
java.util.PropertyResourceBundle rBundle = ResourceBundle.getBundle("name");
after this read the property like this serverName =
rBundle.getString("serverName");
I think this should prevent ur hard coding problem.
bye
Chandra Sekaran.V,
Software Developer,
Wisor Telecom India Pvt Ltd,
Bangalore
[EMAIL PROTECTED]
Ph : 091-80-5525821 x 4217
----- Original Message -----
From: Shiv Kumar <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 27, 2000 12:35 PM
Subject: Configurable parameters in EJBs
> Hi all
>
> I have a couple of beans which talk to an external server (say, a
directory
> server). The EJBs need to know the server's IP address and port in order
to
> talk. They pick these values from the environment entries in ejb-jar.xml.
I have
> the same values in both the EJB's deployment descriptors. Whenever I want
to
> connect to another server running on a different machine, I should change
the
> env entries in both the deployment descriptors. As a bean developer I know
which
> beans need these values and I can change them.
>
> But when I deliver my product to the customer, he should be careful enough
to
> change the env entries in all the EJBs to point to the right server.
Otherwise
> the product will not run properly. Changing these entries is also a pain.
First,
> he should unjar the ejb jar file. Change the entries in ejb-jar.xml file
> (without introducing any syntax errors), then jar it back and deploy it
on the
> app server.
>
> It would be much easier if the customer can edit a plain text file
(.properties
> file, for example) and all the EJBs pick the server's IP and port from
this
> file. In this case the configurable values are available in one single
place
> and there are less chances of making mistakes. Also, if more EJBs need
these
> values I still dont have to change anything.
>
> Im sure people who have developed large EJB based system should have faced
this
> problem. How did you tackle this?
>
> Thanks in advance.
> --
> shiv
> [EMAIL PROTECTED]
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".