You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Stefano Bagnara (JIRA)" <se...@james.apache.org> on 2006/05/14 18:42:05 UTC

[jira] Created: (JAMES-494) Refactor the service methods to inject services via setters

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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Resolved: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/JAMES-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Norman Maurer resolved JAMES-494.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: Trunk)
                   3.0-M1
         Assignee: Norman Maurer

we use JSR250 in trunk

> Refactor the service methods to inject services via setters
> -----------------------------------------------------------
>
>                 Key: JAMES-494
>                 URL: https://issues.apache.org/jira/browse/JAMES-494
>             Project: JAMES Server
>          Issue Type: Sub-task
>    Affects Versions: 3.0
>            Reporter: Stefano Bagnara
>            Assignee: Norman Maurer
>             Fix For: 3.0-M1
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Updated: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-494?page=all ]

Norman Maurer updated JAMES-494:
--------------------------------

    Fix Version: 3.0
                     (was: 2.4.0)

> 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
>     Assignee: Bernd Fondermann
>      Fix For: 3.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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Noel J. Bergman (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12407138 ] 

Noel J. Bergman commented on JAMES-494:
---------------------------------------

As long as we're refactoring, I'd like us to look at setting up the appropriate JNDI InitialContext, so that we can lookup the necessary components.

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12402300 ] 

Bernd Fondermann commented on JAMES-494:
----------------------------------------

+1

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12402304 ] 

Norman Maurer commented on JAMES-494:
-------------------------------------

+1

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Assigned: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-494?page=all ]

Bernd Fondermann reassigned JAMES-494:
--------------------------------------

    Assignee:     (was: Bernd Fondermann)

The task is at least 50% completed. 

There are still discussions how mailets and matchers should receive references to needed services and  whether or not this should happen through setter injection. This is the part where some setters are missing, while others had been added before already.

> Refactor the service methods to inject services via setters
> -----------------------------------------------------------
>
>                 Key: JAMES-494
>                 URL: http://issues.apache.org/jira/browse/JAMES-494
>             Project: James
>          Issue Type: Sub-task
>    Affects Versions: 3.0
>            Reporter: Stefano Bagnara
>             Fix For: 3.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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Assigned: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-494?page=all ]

Bernd Fondermann reassigned JAMES-494:
--------------------------------------

    Assign To: Bernd Fondermann

> 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
>     Assignee: Bernd Fondermann
>      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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12411927 ] 

Stefano Bagnara commented on JAMES-494:
---------------------------------------

I really don't like (never heard of projects using that) JNDI for fine grained service/component wiring/configuration.

I think that using JNDI will give much more power to the services itself and remove power from the container: noone is moving in this direction today.

If we move to commons-configuration or obix configuration framework then we can store configurations in JNDI/LDAP, but I don't think that the JNDI wiring is good at all.

As you are a "supporter of the OSGi cause", can you point me some example of how OSGi and JNDI should be used together and link to any project succesfully using the 2 technologies?

Btw once we'll have SDI objects noone block us from creating an extension of those objects to lookup services in JNDI and call the setters, isn't it true?

> 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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by Stefano Bagnara <ap...@bago.org>.
Bernd Fondermann (JIRA) wrote:
>     [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12418403 ] 
> 
> Bernd Fondermann commented on JAMES-494:
> ----------------------------------------
> 
> Anyone having any objections starting this?
> For me, the JNDI part  is a separate task so I would leave this out in the first place.

I agree!

Stefano


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-494) Refactor the service methods to inject services via setters

Posted by "Bernd Fondermann (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-494?page=comments#action_12418403 ] 

Bernd Fondermann commented on JAMES-494:
----------------------------------------

Anyone having any objections starting this?
For me, the JNDI part  is a separate task so I would leave this out in the first place.

> 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
>     Assignee: Bernd Fondermann
>      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: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org