jQuery in Action, 3rd edition
The moose likes EJB and other Java EE Technologies and the fly likes design question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "design question" Watch "design question" New topic

design question

Harm de Laat

Joined: Sep 07, 2003
Posts: 11
Hi all,
I have a J2EE application running in JBoss.
In my application I need some configuration. For instance, we have to email certain recepients when a action occurs. (For instance, when a certain entity bean is removed we have to send an email to a person). In this email we need to have a configurable messagebody, subject, recipients, reply-address etc... etc...
I cannot use the bean environment entries because these only get read at deploy time. I need to be able to change the configuration during run-time.
What would be a good way to make this as configurable as possible?
Thanks for any suggestions!
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
I don't know if this is the correct answer, but once I did something like this:
in my jboss.xml I added this:

I had a class that was in charge only of sending emails. So whenever i needed to send an email (or many emails) I'd invoke this class, and my code did something like this:

there was another configuration file in which you added your SMTP sever, so you wouldn't need to hardcode it, but I cant remember which was
I don't know if this is the correct way, it's only a suggestion

I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
I agree. Here's the link: http://aspose.com/file-tools
subject: design question
It's not a secret anymore!