axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tolsch, Ed" <Edward.Tol...@fmr.Com>
Subject question on 'best' practice for initialization?
Date Wed, 28 Jan 2004 02:29:44 GMT
HI,
	Sorry for this long winded question. I have a doc/literal web
service with a default scope of 'Request' so that the implementation class
is created with each service request.  I want to perform initialization
ideally when the service is deployed, before it is ever hit( meaning before
I ever see the 'open for e-business' message in the standard out file ) ,
but for now have settled on the first time the service is hit. I'm using the
ServiceLifeCycle class for initialization.

So my implementation class looks like this.

public class SomeImplClass extends WSAxisBase implements myPortType
{
...
}

//
// My base class looks like this.
//
public abstract class WSAxisBase implements ServiceLifecycle
{

  static String sMode = null;


  public void init(java.lang.Object context )
  {
    
    if (sMode == null)
      {
	// do logic to get sMode value from web.xml and set sMode
	// i.e , one time initialization here, like JNDI lookup of
datasources.
      }

  }
}

This seems to work fine but is far from an elegant solution as the init()
method in the ServiceLifeCycle interface gets called each time the service
is invoked and I'm just controlling the one time initialization through a
static variable.

Since I'm fairly new to AXIS, what would be the preferred way to perform a
one-time intialization in a more correct manner, as I'm incurring the call
to the init() method each time, which is not an ideal solution?

In the SOAP 2.2 world, I actually had control over the init() method in the
servlet itself, but seems like I don't really have a hook into the
AxisServlet class(org.apache.axis.transport.http.AxisServlet) ?

Any thoughts/education would be greatly appreciated.

Thanks.

Ed Tolsch
Fidelity Investments
edward.tolsch@fmr.com




Mime
View raw message