1 package org.codehaus.ivory.plexus;
2
3 import org.apache.avalon.framework.service.ServiceException;
4 import org.apache.avalon.framework.service.ServiceManager;
5 import org.apache.axis.AxisFault;
6 import org.apache.axis.server.AxisServer;
7 import org.apache.axis.transport.http.AdminServlet;
8 import org.codehaus.ivory.AxisService;
9 import org.codehaus.plexus.servlet.PlexusServletUtils;
10
11 /***
12 * An implementation of the Axis AdminServlet which retrieves the AxisEngine
13 * from the ServiceManager.
14 *
15 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
16 * @since Mar 8, 2003
17 */
18 public class PlexusAdminServlet
19 extends AdminServlet
20 {
21 ServiceManager manager;
22
23 AxisService axisService;
24
25 public PlexusAdminServlet()
26 {
27 }
28
29 /***
30 * Provide the AxisEngine to the base servlet class.
31 *
32 * @return AxisServer
33 * @see org.apache.axis.transport.http.AxisServletBase#getEngine()
34 */
35 public AxisServer getEngine() throws AxisFault
36 {
37 manager = getServiceManager();
38
39 try
40 {
41 axisService = ( AxisService ) manager.lookup( AxisService.ROLE );
42 }
43 catch (ServiceException e)
44 {
45 throw new AxisFault( "Could not find the AxisService.", e );
46 }
47
48 return axisService.getAxisServer();
49 }
50
51 /***
52 * Retrieve the ServiceBroker from the ServletContext. This presupposes
53 * that the installation is using Plexus.
54 *
55 * @return ServiceBroker
56 */
57 public ServiceManager getServiceManager()
58 {
59 return PlexusServletUtils.getServiceManager( getServletContext() );
60 }
61
62 public void destroy()
63 {
64 super.destroy();
65
66 if ( axisService != null )
67 manager.release( axisService );
68 }
69 }
This page was automatically generated by Maven