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 Norman Maurer <nm...@byteaction.de> on 2006/03/14 18:28:45 UTC

SQL querys in smtp

Hi guys,
im looking in writting a greylist Handler but i cant figure out how to
do sql commands in smtphander chain. The main problem i have is that i
don't know how to modify the next few lines to get them work in smtp:

ServiceManager componentManager = (ServiceManager)
getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);

// Get the DataSourceSelector service
DataSourceSelector datasources = (DataSourceSelector)
componentManager.lookup(DataSourceSelector.ROLE);

// Get the data-source required.
datasource = (DataSourceComponent) datasources.select(datasourceName);

anyone can give me some tips or help ?

thx

Re: SQL querys in smtp

Posted by Stefano Bagnara <ap...@bago.org>.
in the service() method of the SMTPServer you can reach the 
ServiceManager. Then you have to lookup for the datasourceselector and 
pass it to the handler.

Currently the SMTPServer has no dependencies on DataSourceSelector, so 
you will have to add this dependency declaration (adding it to the 
SMTPServer.xinfo and to james-assembly.xml).

Look at the James.xinfo and James block in james-assembly.xml to 
understand how to add this dependency declaration to the SMTPServer, too.

Stefano

Norman Maurer wrote:
> Hi guys,
> im looking in writting a greylist Handler but i cant figure out how to
> do sql commands in smtphander chain. The main problem i have is that i
> don't know how to modify the next few lines to get them work in smtp:
> 
> ServiceManager componentManager = (ServiceManager)
> getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
> 
> // Get the DataSourceSelector service
> DataSourceSelector datasources = (DataSourceSelector)
> componentManager.lookup(DataSourceSelector.ROLE);
> 
> // Get the data-source required.
> datasource = (DataSourceComponent) datasources.select(datasourceName);
> 
> anyone can give me some tips or help ?
> 
> thx



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


Re: SQL querys in smtp

Posted by Stefano Bagnara <ap...@bago.org>.
Norman Maurer wrote:
> Hm, I wonder if that should be made and which problems can be caused by
> that.

This is the correct way. You need a service that was not previously 
needed. The container is indeed there for this things.

Stefano

> Am Dienstag, den 14.03.2006, 18:52 +0100 schrieb Stefano Bagnara:
>> in the service() method of the SMTPServer you can reach the 
>> ServiceManager. Then you have to lookup for the datasourceselector and 
>> pass it to the handler.
>>
>> Currently the SMTPServer has no dependencies on DataSourceSelector, so 
>> you will have to add this dependency declaration (adding it to the 
>> SMTPServer.xinfo and to james-assembly.xml).
>>
>> Look at the James.xinfo and James block in james-assembly.xml to 
>> understand how to add this dependency declaration to the SMTPServer, too.
>>
>> Stefano



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


Re: SQL querys in smtp

Posted by Norman Maurer <nm...@byteaction.de>.
I will have a look at this later. Thx for all your help in the past.

bye

Am Mittwoch, den 15.03.2006, 12:04 +0100 schrieb Stefano Bagnara:
> Norman Maurer wrote:
> > Hm, I wonder if that should be made and which problems can be caused by
> > that.
> 
> This is the correct way. You need a service that was not previously 
> needed. The container is indeed there for this things.
> 
> Stefano
> 
> > Am Dienstag, den 14.03.2006, 18:52 +0100 schrieb Stefano Bagnara:
> >> in the service() method of the SMTPServer you can reach the 
> >> ServiceManager. Then you have to lookup for the datasourceselector and 
> >> pass it to the handler.
> >>
> >> Currently the SMTPServer has no dependencies on DataSourceSelector, so 
> >> you will have to add this dependency declaration (adding it to the 
> >> SMTPServer.xinfo and to james-assembly.xml).
> >>
> >> Look at the James.xinfo and James block in james-assembly.xml to 
> >> understand how to add this dependency declaration to the SMTPServer, too.
> >>
> >> Stefano
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
> !EXCUBATOR:1,4417f531200621861711967!

Re: SQL querys in smtp

Posted by Norman Maurer <nm...@byteaction.de>.
Hm, I wonder if that should be made and which problems can be caused by
that.

bye

Am Dienstag, den 14.03.2006, 18:52 +0100 schrieb Stefano Bagnara:
> in the service() method of the SMTPServer you can reach the 
> ServiceManager. Then you have to lookup for the datasourceselector and 
> pass it to the handler.
> 
> Currently the SMTPServer has no dependencies on DataSourceSelector, so 
> you will have to add this dependency declaration (adding it to the 
> SMTPServer.xinfo and to james-assembly.xml).
> 
> Look at the James.xinfo and James block in james-assembly.xml to 
> understand how to add this dependency declaration to the SMTPServer, too.
> 
> Stefano
> 
> Norman Maurer wrote:
> > Hi guys,
> > im looking in writting a greylist Handler but i cant figure out how to
> > do sql commands in smtphander chain. The main problem i have is that i
> > don't know how to modify the next few lines to get them work in smtp:
> > 
> > ServiceManager componentManager = (ServiceManager)
> > getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
> > 
> > // Get the DataSourceSelector service
> > DataSourceSelector datasources = (DataSourceSelector)
> > componentManager.lookup(DataSourceSelector.ROLE);
> > 
> > // Get the data-source required.
> > datasource = (DataSourceComponent) datasources.select(datasourceName);
> > 
> > anyone can give me some tips or help ?
> > 
> > thx
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 
> !EXCUBATOR:1,44170374200621316595088!