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