View Javadoc

1   /*
2    * $Id: AxisInitialisationCallback.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.soap.axis;
12  
13  import org.mule.impl.InitialisationCallback;
14  import org.mule.umo.lifecycle.InitialisationException;
15  
16  import org.apache.axis.handlers.soap.SOAPService;
17  import org.apache.commons.logging.Log;
18  import org.apache.commons.logging.LogFactory;
19  
20  /**
21   * <code>AxisInitialisationCallback</code> is invoked when an Axis component is
22   * created from its descriptor.
23   */
24  public class AxisInitialisationCallback implements InitialisationCallback
25  {
26      protected static final Log logger = LogFactory.getLog(AxisInitialisationCallback.class);
27  
28      private SOAPService service;
29      private boolean invoked = false;
30  
31      public AxisInitialisationCallback(SOAPService service)
32      {
33          this.service = service;
34      }
35  
36      public void initialise(Object component) throws InitialisationException
37      {
38          // only call this once
39          if (invoked)
40          {
41              return;
42          }
43          if (component instanceof AxisInitialisable)
44          {
45              if (logger.isDebugEnabled())
46              {
47                  logger.debug("Calling axis initialisation for component: " + component.getClass().getName());
48              }
49              ((AxisInitialisable)component).initialise(service);
50          }
51          invoked = true;
52      }
53  }