[ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12411928 ]
Stefano Bagnara commented on JAMES-494: --------------------------------------- PS: The intent of this issue was not to open a new religious threads about containers and IoC patterns. I would like to do a single small step without too much discussion. If we agree that the SDI refactoring is a good step then let's do it: IIRC we discussed a lot of this, and the question was SDI vs CDI, not SDI vs JNDI. The result was that CDI can be easily created extending an SDI object and SDI is more Avalon friendly and easier to apply in our roadmap without early breaking backward compatibility. I would like to understand better your OSGi/JNDI ideas, but I think they deserve their own issues, their own wiki pages or their mailing list threads. > Refactor the service methods to inject services via setters > ----------------------------------------------------------- > > Key: JAMES-494 > URL: http://issues.apache.org/jira/browse/JAMES-494 > Project: James > Type: Sub-task > Versions: 2.4.0 > Reporter: Stefano Bagnara > Fix For: 2.4.0 > > Nothing worth more than an example: > Here is the current service method of the SMTPServer: > public void service( final ServiceManager manager ) throws ServiceException { > super.service( manager ); > serviceManager = manager; > mailetcontext = (MailetContext) > manager.lookup("org.apache.mailet.MailetContext"); > mailServer = (MailServer) manager.lookup(MailServer.ROLE); > users = (UsersRepository) manager.lookup(UsersRepository.ROLE); > dnsServer = (DNSServer) manager.lookup(DNSServer.ROLE); > } > We could change it to > public void service( final ServiceManager manager ) throws ServiceException { > super.service( manager ); > serviceManager = manager; > setMailetContext((MailetContext) > manager.lookup("org.apache.mailet.MailetContext")); > setMailServer((MailServer) manager.lookup(MailServer.ROLE)); > setUsersRepository((UsersRepository) > manager.lookup(UsersRepository.ROLE)); > setDNSServer((DNSServer) manager.lookup(DNSServer.ROLE)); > } > and add the above setters. > This way we can fill dependencies of SMTPServer without using the Serviceable > interface and the ServiceManager component. > Later we'll move the whole service method and Serviceable interface to the > specific Avalon extension of the "container-agnostic" SMTPServer. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
