CVS: ivory/src/java/org/codehaus/ivory/axis/servlet PlexusAdminServlet.java,1.1,1.2 PlexusAxisServlet.java,1.1,1.2
[email protected] Fri, 2 May 2003 10:17:23 -0500
| Newsgroups | gmane.comp.java.plexus.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/plexus/ivory/src/java/org/codehaus/ivory/axis/servlet In directory eng.werken.com:/tmp/cvs-serv29632/src/java/org/codehaus/ivory/axis/servlet Modified Files: PlexusAdminServlet.java PlexusAxisServlet.java Log Message: Update to the new plexus. Tests don't pass right now because of some api changes in plexus, but ivory works fine. To install use: maven -Dmaven.test.skip=true jar:install Index: PlexusAdminServlet.java =================================================================== RCS file: /cvsroot/plexus/ivory/src/java/org/codehaus/ivory/axis/servlet/PlexusAdminServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PlexusAdminServlet.java 18 Mar 2003 00:04:33 -0000 1.1 +++ PlexusAdminServlet.java 2 May 2003 15:17:21 -0000 1.2 @@ -1,59 +1,59 @@ -package org.codehaus.ivory.axis.servlet; - -import org.apache.avalon.framework.service.ServiceException; -import org.apache.axis.AxisFault; -import org.apache.axis.server.AxisServer; -import org.apache.axis.transport.http.AdminServlet; -import org.apache.plexus.service.ServiceBroker; -import org.apache.plexus.servlet.PlexusServlet; -import org.codehaus.ivory.axis.AxisService; - -/** - * An implementation of the Axis AdminServlet which retrieves the AxisEngine - * from the ServiceManager. - * - * @author <a href="mailto:[email protected]">Dan Diephouse</a> - * @since Mar 8, 2003 - */ -public class PlexusAdminServlet - extends AdminServlet -{ - public PlexusAdminServlet() - { - } - - /** - * Provide the AxisEngine to the base servlet class. - * - * @return AxisServer - * @see org.apache.axis.transport.http.AxisServletBase#getEngine() - */ - public AxisServer getEngine() throws AxisFault - { - ServiceBroker manager = getServiceBroker(); - - AxisService axisService; - try - { - axisService = ( AxisService ) manager.lookup( AxisService.ROLE ); - } - catch (ServiceException e) - { - throw new AxisFault( "Could not find the AxisService.", e ); - } - - return axisService.getAxisServer(); - } - - /** - * Retrieve the ServiceBroker from the ServletContext. This presupposes - * that the installation is using Plexus. - * - * @return ServiceBroker - */ - public ServiceBroker getServiceBroker() - { - return (ServiceBroker) getServletContext().getAttribute( - PlexusServlet.SERVICE_BROKER_KEY ); - } -} +package org.codehaus.ivory.axis.servlet; + +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.axis.AxisFault; +import org.apache.axis.server.AxisServer; +import org.apache.axis.transport.http.AdminServlet; +import org.apache.plexus.servlet.PlexusServlet; +import org.codehaus.ivory.axis.AxisService; + +/** + * An implementation of the Axis AdminServlet which retrieves the AxisEngine + * from the ServiceManager. + * + * @author <a href="mailto:[email protected]">Dan Diephouse</a> + * @since Mar 8, 2003 + */ +public class PlexusAdminServlet + extends AdminServlet +{ + public PlexusAdminServlet() + { + } + + /** + * Provide the AxisEngine to the base servlet class. + * + * @return AxisServer + * @see org.apache.axis.transport.http.AxisServletBase#getEngine() + */ + public AxisServer getEngine() throws AxisFault + { + ServiceManager manager = getServiceManager(); + + AxisService axisService; + try + { + axisService = ( AxisService ) manager.lookup( AxisService.ROLE ); + } + catch (ServiceException e) + { + throw new AxisFault( "Could not find the AxisService.", e ); + } + + return axisService.getAxisServer(); + } + + /** + * Retrieve the ServiceBroker from the ServletContext. This presupposes + * that the installation is using Plexus. + * + * @return ServiceBroker + */ + public ServiceManager getServiceManager() + { + return (ServiceManager) getServletContext().getAttribute( + PlexusServlet.SERVICE_MANAGER_KEY ); + } +} Index: PlexusAxisServlet.java =================================================================== RCS file: /cvsroot/plexus/ivory/src/java/org/codehaus/ivory/axis/servlet/PlexusAxisServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PlexusAxisServlet.java 18 Mar 2003 00:04:33 -0000 1.1 +++ PlexusAxisServlet.java 2 May 2003 15:17:21 -0000 1.2 @@ -1,136 +1,136 @@ -package org.codehaus.ivory.axis.servlet; - -import java.io.PrintWriter; -import java.net.HttpURLConnection; -import java.util.Iterator; - -import javax.servlet.http.HttpServletResponse; - -import org.apache.avalon.framework.service.ServiceException; -import org.apache.axis.AxisEngine; -import org.apache.axis.AxisFault; -import org.apache.axis.ConfigurationException; -import org.apache.axis.WSDDEngineConfiguration; -import org.apache.axis.configuration.SimpleProvider; -import org.apache.axis.handlers.soap.SOAPService; -import org.apache.axis.server.AxisServer; -import org.apache.axis.transport.http.AxisServlet; -import org.apache.axis.utils.Messages; -import org.apache.plexus.service.ServiceBroker; -import org.apache.plexus.servlet.PlexusServlet; -import org.codehaus.ivory.axis.AxisService; - -/** - * An implementation of the Axis AxisServlet which retrieves the AxisEngine - * from the ServiceManager. - * - * @author <a href="mailto:[email protected]">Dan Diephouse</a> - * @since Mar 8, 2003 - */ -public class PlexusAxisServlet - extends AxisServlet -{ - public PlexusAxisServlet() - { - } - - /** - * Provide the AxisEngine to the base servlet class. - * - * @return AxisServer - * @see org.apache.axis.transport.http.AxisServletBase#getEngine() - */ - public AxisServer getEngine() throws AxisFault - { - ServiceBroker manager = getServiceBroker(); - - if ( manager == null ) - throw new AxisFault( "There is no ServiceBroker!" ); - - // TODO: store axisService so we don't lookup every time. - AxisService axisService; - try - { - axisService = ( AxisService ) manager.lookup( AxisService.ROLE ); - } - catch (ServiceException e) - { - throw new AxisFault( "Could not find the AxisService.", e ); - } - - return axisService.getAxisServer(); - } - - /** - * Retrieve the ServiceBroker from the ServletContext. This presupposes - * that the installation is using Plexus. - * - * @return ServiceBroker - */ - public ServiceBroker getServiceBroker() - { - return (ServiceBroker) getServletContext().getAttribute( - PlexusServlet.SERVICE_BROKER_KEY ); - } - - /** - * respond to the ?list command. - * if enableList is set, we list the engine config. If it isnt, then an - * error is written out - * @param response - * @param writer - * @throws AxisFault - */ - protected void processListRequest( HttpServletResponse response, - PrintWriter writer ) - throws AxisFault - { - AxisEngine engine = getEngine(); - - boolean enableList = true; - - if (enableList) { - if ( engine.getConfig() instanceof WSDDEngineConfiguration ) - { - super.processListRequest( response, writer ); - } - else if ( engine.getConfig() instanceof SimpleProvider ) - { - SimpleProvider config = ( SimpleProvider ) engine.getConfig(); - - Iterator itr; - try - { - itr = config.getDeployedServices(); - } - catch (ConfigurationException e) - { - throw new AxisFault( "Configuration error.", e ); - } - - response.setContentType("text/html"); - writer.println("<h2>Services</h2>"); - for ( SOAPService service = (SOAPService) itr.next(); - itr.hasNext(); ) - { - writer.println("<p>" + - service.getName() + - "</p>"); - } - } - } - else - { - // list not enable, return error - //error code is, what, 401 - response.setStatus(HttpURLConnection.HTTP_FORBIDDEN); - response.setContentType("text/html"); - writer.println("<h2>" + - Messages.getMessage("error00") + - "</h2>"); - writer.println("<p><i>?list</i> " + - Messages.getMessage("disabled00") + - "</p>"); - } - } -} +package org.codehaus.ivory.axis.servlet; + +import java.io.PrintWriter; +import java.net.HttpURLConnection; +import java.util.Iterator; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.axis.AxisEngine; +import org.apache.axis.AxisFault; +import org.apache.axis.ConfigurationException; +import org.apache.axis.WSDDEngineConfiguration; +import org.apache.axis.configuration.SimpleProvider; +import org.apache.axis.handlers.soap.SOAPService; +import org.apache.axis.server.AxisServer; +import org.apache.axis.transport.http.AxisServlet; +import org.apache.axis.utils.Messages; +import org.apache.plexus.servlet.PlexusServlet; +import org.codehaus.ivory.axis.AxisService; + +/** + * An implementation of the Axis AxisServlet which retrieves the AxisEngine + * from the ServiceManager. + * + * @author <a href="mailto:[email protected]">Dan Diephouse</a> + * @since Mar 8, 2003 + */ +public class PlexusAxisServlet + extends AxisServlet +{ + public PlexusAxisServlet() + { + } + + /** + * Provide the AxisEngine to the base servlet class. + * + * @return AxisServer + * @see org.apache.axis.transport.http.AxisServletBase#getEngine() + */ + public AxisServer getEngine() throws AxisFault + { + ServiceManager manager = getServiceManager(); + + if ( manager == null ) + throw new AxisFault( "There is no ServiceBroker!" ); + + // TODO: store axisService so we don't lookup every time. + AxisService axisService; + try + { + axisService = ( AxisService ) manager.lookup( AxisService.ROLE ); + } + catch (ServiceException e) + { + throw new AxisFault( "Could not find the AxisService.", e ); + } + + return axisService.getAxisServer(); + } + + /** + * Retrieve the ServiceBroker from the ServletContext. This presupposes + * that the installation is using Plexus. + * + * @return ServiceBroker + */ + public ServiceManager getServiceManager() + { + return (ServiceManager) getServletContext().getAttribute( + PlexusServlet.SERVICE_MANAGER_KEY ); + } + + /** + * respond to the ?list command. + * if enableList is set, we list the engine config. If it isnt, then an + * error is written out + * @param response + * @param writer + * @throws AxisFault + */ + protected void processListRequest( HttpServletResponse response, + PrintWriter writer ) + throws AxisFault + { + AxisEngine engine = getEngine(); + + boolean enableList = true; + + if (enableList) { + if ( engine.getConfig() instanceof WSDDEngineConfiguration ) + { + super.processListRequest( response, writer ); + } + else if ( engine.getConfig() instanceof SimpleProvider ) + { + SimpleProvider config = ( SimpleProvider ) engine.getConfig(); + + Iterator itr; + try + { + itr = config.getDeployedServices(); + } + catch (ConfigurationException e) + { + throw new AxisFault( "Configuration error.", e ); + } + + response.setContentType("text/html"); + writer.println("<h2>Services</h2>"); + for ( SOAPService service = (SOAPService) itr.next(); + itr.hasNext(); ) + { + writer.println("<p>" + + service.getName() + + "</p>"); + } + } + } + else + { + // list not enable, return error + //error code is, what, 401 + response.setStatus(HttpURLConnection.HTTP_FORBIDDEN); + response.setContentType("text/html"); + writer.println("<h2>" + + Messages.getMessage("error00") + + "</h2>"); + writer.println("<p><i>?list</i> " + + Messages.getMessage("disabled00") + + "</p>"); + } + } +}