Hi,

I think you need a layer beetween MailBox and your EJB, which encapsulates the 
logic specific to the mailbox implementation. "findMailbox" should not return 
the entity, but the the implementation of the layer.

Assume an interface (or an abstract base class):
public interface IMailBoxHandler
  | {
  |    public void handleMail (Message message);
  | }
  | 
It has only one method which handles an incoming mail.

Now you create subclasses/implementations:
public class MailBoxHandlerHelpDesk implements IMailBoxHandler
  | {
  |   @Override
  |   public void handleMail (Message message)
  |   {
  |      ...
  |   }
  | }
  | 
and so on...

"findMailBox" should probably return an appropriate IMailBoxHandler 
implementation. 

"incomingMail" would be:
public void incomingMail(String destination, Message message) {
  |     IMailboxHandler mb = findMailBox(destination); 
  |     mb.handleMail (message);
  | }
  | 

This way, your domain model is free of controller logic.

Hope this is a reasonable approach ;-)

Wolfgang

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258136#4258136

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258136
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to