Unfortunatley you cannot. The module.init() method is called after the
handler.init() methods and so any setup you do in the module init is not
available to the handlers. In the end I created my resources in the module
constructor since the module class is instantiated before the handlers.

For example I initialise Spring as follows:
 
  public ModuleLogger()
  {
    String[] contexts = new String[] {"logging_module_spring.xml"};
    ClassPathXmlApplicationContext ac = new
ClassPathXmlApplicationContext(contexts,false);
    ac.setClassLoader(this.getClass().getClassLoader());
    ac.refresh();
  }

Then in the handler.init() method I obtain the spring context from the
ApplicationContextHolder and grab all resources required to support the
handler e.g. DataSource
 
Cheers,
Paul
 
  _____  

From: Amila Suriarachchi [mailto:amilasuriarach...@gmail.com] 
Sent: 29 December 2008 05:29
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers





On Sun, Dec 28, 2008 at 11:53 PM, Paul French <paul.fre...@kirona.com>
wrote:


The handler.init method is not passed the configuration context. So I
suppose I have to obtain the resources on each invocation of the invoke or
revoke method of the handler. Being a big Spring fan I was looking for a way
to configure my module and handlers up front.


you have to use the module init method. write a class  which implements the
Module interface and declare it 
in the module.xml.

<module name="moduleName" class="moduleClass">

thanks,
Amila.




Thanks


-----Original Message-----
From: Deepal jayasinghe [mailto:deep...@gmail.com]
Sent: 28 December 2008 17:47
To: axis-user@ws.apache.org
Subject: Re: Modules and Handlers

Paul French wrote:
> I have written a simple Module that logs all SOAP messages into a
> database.
>
> My handlers needs access to resources setup in the Module init method
> e.g a DataSource
>
> I cannot see how a handler can get access to resources setup in the
> module? Can someone give me a clue?
At the initialization put the resources into the ConfigurationContext, and
then you can access at the runtime

Deepal
>
> Thanks
> Paul
>
>


--
Thank you!


http://blogs.deepal.org
http://deepal.org



__________ NOD32 3719 (20081227) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com







-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Reply via email to