Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 87404 invoked by uid 500); 5 Mar 2003 11:35:31 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 87391 invoked by uid 500); 5 Mar 2003 11:35:31 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Received: (qmail 87388 invoked from network); 5 Mar 2003 11:35:30 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 5 Mar 2003 11:35:30 -0000 Received: (qmail 77848 invoked by uid 1471); 5 Mar 2003 11:35:30 -0000 Date: 5 Mar 2003 11:35:30 -0000 Message-ID: <20030305113530.77846.qmail@icarus.apache.org> From: crafterm@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/system DeploymentDescriptor.wsdd System.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N crafterm 2003/03/05 03:35:30 Modified: . blocks.properties gump.xml Added: src/blocks/axis build.xml src/blocks/axis/conf soapserver.xconf soapserver.xroles src/blocks/axis/java/org/apache/cocoon/components/axis SoapServer.java SoapServerImpl.java src/blocks/axis/java/org/apache/cocoon/components/axis/providers AvalonProvider.java src/blocks/axis/java/org/apache/cocoon/reading AxisRPCReader.java src/blocks/axis/java/org/apache/cocoon/webservices AbstractComposableService.java AbstractLogEnabledService.java src/blocks/axis/java/org/apache/cocoon/webservices/cache DeploymentDescriptor.wsdd src/blocks/axis/java/org/apache/cocoon/webservices/instrument DeploymentDescriptor.wsdd InstrumentationService.java InstrumentationServiceImpl.java instrumentation.xconf instrumentation.xroles src/blocks/axis/java/org/apache/cocoon/webservices/memory DeploymentDescriptor.wsdd Memory.java src/blocks/axis/java/org/apache/cocoon/webservices/system DeploymentDescriptor.wsdd System.java src/blocks/axis/lib axis-1.0.jar axis-jaxrpc-1.0.jar axis-saaj-1.0.jar commons-discovery.jar excalibur-util-1.0.jar wsdl4j.jar Removed: src/scratchpad/src/org/apache/cocoon/components/axis SoapServer.java SoapServerImpl.java soapserver.xconf soapserver.xroles src/scratchpad/src/org/apache/cocoon/components/axis/providers AvalonProvider.java src/scratchpad/src/org/apache/cocoon/reading AxisRPCReader.java src/scratchpad/src/org/apache/cocoon/webservices AbstractComposableService.java AbstractLogEnabledService.java src/scratchpad/src/org/apache/cocoon/webservices/cache DeploymentDescriptor.wsdd src/scratchpad/src/org/apache/cocoon/webservices/instrument DeploymentDescriptor.wsdd InstrumentationService.java InstrumentationServiceImpl.java instrumentation.xconf instrumentation.xroles src/scratchpad/src/org/apache/cocoon/webservices/memory DeploymentDescriptor.wsdd Memory.java src/scratchpad/src/org/apache/cocoon/webservices/system DeploymentDescriptor.wsdd System.java Log: Migrated Axis soap server from scratchpad to a block. Revision Changes Path 1.10 +2 -1 xml-cocoon2/blocks.properties Index: blocks.properties =================================================================== RCS file: /home/cvs/xml-cocoon2/blocks.properties,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- blocks.properties 27 Feb 2003 14:42:55 -0000 1.9 +++ blocks.properties 5 Mar 2003 11:35:26 -0000 1.10 @@ -6,7 +6,7 @@ # corrisponding exclude property # NOTE: don't modify this file directly but make a copy named -# 'local.blocks.properties' and modify that. The build system will overwrite +# 'local.blocks.properties' and modify that. The build system will override # these properties with the ones in the 'local.blocks.properties' file. # WARNING: due to the way Ant works, in order to to include a block you have @@ -62,3 +62,4 @@ #exclude.block.asciiart= #exclude.block.precept= exclude.block.mail= +#exclude.block.axis= 1.5 +19 -0 xml-cocoon2/gump.xml Index: gump.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/gump.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- gump.xml 3 Mar 2003 11:41:07 -0000 1.4 +++ gump.xml 5 Mar 2003 11:35:26 -0000 1.5 @@ -624,6 +624,25 @@ + + org.apache.cocoon + + + + + + + + + + + + + + + + + 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServer.java Index: SoapServer.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.components.axis; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletContext; import org.apache.avalon.framework.activity.Startable; import org.apache.avalon.framework.component.Component; import org.apache.axis.MessageContext; /** * SoapServer interface. * *

* This interface describes the operations provided by any Axis * Soap Server implementations. *

* *

* Example use: * *

   *    SoapServer server = (SoapServer) manager.lookup(SoapServer.ROLE);
   *    MessageContext message = server.createMessageContext(req, res, con);
   *    server.invoke(message);
   *    manager.release(server);
   *    // message sent back to sender
   *  
*

* * @author Marcus Crafter * @version CVS $Id: SoapServer.java,v 1.1 2003/03/05 11:35:27 crafterm Exp $ */ public interface SoapServer extends Component, Startable { /** * Component's ROLE definition */ String ROLE = SoapServer.class.getName(); /** * Constant used to key message context entries for an avalon logger */ String LOGGER = "axis-message-context-logger"; /** * Invoke a particular message context on this server. This method * takes the given message, invokes it on the server and sets * the response inside it for the caller to retrieve. * * @param message a MessageContext instance * @exception Exception if an error occurs */ void invoke(MessageContext message) throws Exception; /** * Method to create a new message context, based on this Axis * server instance, and the caller's request, response, and * context objects. * * @param req a HttpServletRequest instance * @param res a HttpServletResponse instance * @param con a ServletContext instance * @return a MessageContext instance */ MessageContext createMessageContext( HttpServletRequest req, HttpServletResponse res, ServletContext con ); } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java Index: SoapServerImpl.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.components.axis; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.InputStreamReader; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.axis.AxisEngine; import org.apache.axis.Constants; import org.apache.axis.EngineConfiguration; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.configuration.FileProvider; import org.apache.axis.deployment.wsdd.WSDDDeployment; import org.apache.axis.deployment.wsdd.WSDDDocument; import org.apache.axis.deployment.wsdd.WSDDService; import org.apache.axis.security.servlet.ServletSecurityProvider; import org.apache.axis.server.AxisServer; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.transport.http.HTTPTransport; import org.apache.axis.transport.http.ServletEndpointContextImpl; import org.apache.axis.utils.XMLUtils; import org.apache.cocoon.components.axis.providers.AvalonProvider; import org.apache.cocoon.util.IOUtils; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceResolver; import org.apache.excalibur.xml.dom.DOMParser; import org.w3c.dom.Document; import org.xml.sax.InputSource; /** * SOAP Server Implementation * *

* This server accepts a SOAP Request, and generates the resultant * response as output. Essentially, this reader allows you to serve SOAP * requests from your Cocoon application. *

* *

* Code originates from the Apache * AXIS project, * org.apache.axis.http.transport.AxisServlet. *

* * Ported to Cocoon by: * * @author Marcus Crafter * * Original AxisServlet authors: * * @author Steve Loughran * @author Doug Davis * * @version CVS $Id: SoapServerImpl.java,v 1.1 2003/03/05 11:35:27 crafterm Exp $ */ public class SoapServerImpl extends AbstractLogEnabled implements SoapServer, Composable, Configurable, Contextualizable, Initializable, Startable, ThreadSafe { /** * Constant describing the default location of the server configuration file */ public static final String DEFAULT_SERVER_CONFIG = "resource://org/apache/axis/server/server-config.wsdd"; // transport name private String m_transportName; // security provider reference private ServletSecurityProvider m_securityProvider; // JWS output directory private String m_jwsClassDir; // per-instance cache of the axis server private AxisServer m_axisServer; // axis server configuration private FileProvider m_engineConfig; // location of attachments private String m_attachmentDir; // server configuration private Source m_serverWSDD; // array containing locations to descriptors this reader should manage private WSDDDocument[] m_descriptors; // context reference private Context m_context; // component manager reference private ComponentManager m_manager; /** * Contextualize this Reader. * * @param context a Context instance * @exception ContextException if an error occurs */ public void contextualize(final Context context) throws ContextException { m_context = context; } /** * Compose this server * * @param manager a ComponentManager value * @exception ComponentException if an error occurs */ public void compose(ComponentManager manager) throws ComponentException { m_manager = manager; } /** * Configures this reader. * *

* Sets the following optional configuration settings: * *

    *
  • Server WSDD configuration *
  • Attachment directory *
  • JWS directory *
  • Security provider *
  • Transport name *
  • Mananged services *
*

* *

* The following format is used: *

       *   <soap-server>
       *    <server-wsdd src="..."/>
       *    <attachment-dir src="..."/>
       *    <jws-dir src="..."/>
       *    <security-provider enabled="..."/>
       *    <transport name="..."/>
       *    <managed-services>
       *     <descriptor src="..."/>
       *     <descriptor src="..."/>
       *    </managed-services>
       *   </soap-server>
       *  
*

* * @param config a Configuration instance * @exception ConfigurationException if an error occurs */ public void configure(final Configuration config) throws ConfigurationException { try { setServerConfig(config); setAttachmentDir(config); setJWSDir(config); setSecurityProvider(config); setTransportName(config); setManagedServices(config); if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.configure() complete"); } } catch (final Exception e) { throw new ConfigurationException("Error during configuration", e); } } /** * Helper method to set the axis server configuration. * * @param config a Configuration instance * @exception Exception if an error occurs */ public void setServerConfig(final Configuration config) throws Exception { final Configuration wsdd = config.getChild("server-wsdd"); SourceResolver resolver = null; try { resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE); m_serverWSDD = resolver.resolveURI( wsdd.getAttribute("src", DEFAULT_SERVER_CONFIG) ); } finally { if (resolver != null) m_manager.release(resolver); } } /** * Helper method to set the attachment dir. If no attachment directory has * been specified, then its set up to operate out of the Cocoon workarea. * * @param config a Configuration instance * @exception ConfigurationException if a configuration error occurs * @exception ContextException if a context error occurs */ private void setAttachmentDir(final Configuration config) throws ConfigurationException, ContextException { final Configuration dir = config.getChild("attachment-dir"); m_attachmentDir = dir.getAttribute("src", null); if (m_attachmentDir == null) { File workDir = (File) m_context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); File attachmentDir = IOUtils.createFile(workDir, "attachments" + File.separator); m_attachmentDir = IOUtils.getFullFilename(attachmentDir); } if (getLogger().isDebugEnabled()) { getLogger().debug("attachment directory = " + m_attachmentDir); } } /** * Helper method to set the JWS class dir. If no directory is specified then * the directory axis-jws is used, under the Cocoon workarea. * * @param config a Configuration instance * @exception ConfigurationException if a configuration error occurs * @exception ContextException if a context error occurs */ private void setJWSDir(final Configuration config) throws ConfigurationException, ContextException { final Configuration dir = config.getChild("jws-dir"); m_jwsClassDir = dir.getAttribute("src", null); if (m_jwsClassDir == null) { File workDir = (File) m_context.get(org.apache.cocoon.Constants.CONTEXT_WORK_DIR); File jwsClassDir = IOUtils.createFile(workDir, "axis-jws" + File.separator); m_jwsClassDir = IOUtils.getFullFilename(jwsClassDir); } if (getLogger().isDebugEnabled()) { getLogger().debug("jws class directory = " + m_jwsClassDir); } } /** * Helper method to set the security provider. * * @param config a Configuration instance * @exception ConfigurationException if an error occurs */ private void setSecurityProvider(final Configuration config) throws ConfigurationException { final Configuration secProvider = config.getChild("security-provider", false); if (secProvider != null) { final String attr = secProvider.getAttribute("enabled"); final boolean providerIsEnabled = "true".equalsIgnoreCase(attr) || "yes".equalsIgnoreCase(attr); if (providerIsEnabled) m_securityProvider = new ServletSecurityProvider(); } if (getLogger().isDebugEnabled()) { getLogger().debug("security provider = " + m_securityProvider); } } /** * Helper method to set the transport name * * @param config a Configuration instance * @exception ConfigurationException if an error occurs */ private void setTransportName(final Configuration config) throws ConfigurationException { final Configuration name = config.getChild("transport"); m_transportName = name.getAttribute("name", HTTPTransport.DEFAULT_TRANSPORT_NAME); } /** * Helper method to obtain a list of managed services from the given * configuration (ie. locations of deployement descriptors to be * deployed). * * @param config a Configuration value * @exception Exception if an error occurs */ private void setManagedServices(final Configuration config) throws Exception { final Configuration m = config.getChild("managed-services", false); final List descriptors = new ArrayList(); if (m != null) { SourceResolver resolver = null; DOMParser parser = null; try { final Configuration[] services = m.getChildren("descriptor"); resolver = (SourceResolver) m_manager.lookup(SourceResolver.ROLE); parser = (DOMParser) m_manager.lookup(DOMParser.ROLE); for (int i = 0; i < services.length; ++i) { final String location = services[i].getAttribute("src"); Source source = resolver.resolveURI(location); final Document d = parser.parseDocument( new InputSource( new InputStreamReader(source.getInputStream()) ) ); descriptors.add(new WSDDDocument(d)); } } finally { if (resolver != null) m_manager.release(resolver); if (parser != null) m_manager.release((Component)parser); } } // convert the list of descriptors to an array, for easier iteration m_descriptors = (WSDDDocument[]) descriptors.toArray(new WSDDDocument[]{}); } /** * Initialize this reader, creates AXIS server engine. * * @exception Exception if an error occurs */ public void initialize() throws Exception { m_axisServer = createEngine(); if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.initialize() complete"); } } /** * Starts this reader. Deploys all managed services as specified at * configuration time. * * @exception Exception if an error occurs */ public void start() throws Exception { // deploy all configured services for (int i = 0; i < m_descriptors.length; ++i) { WSDDDeployment deployment = m_engineConfig.getDeployment(); m_descriptors[i].deploy(deployment); if (getLogger().isDebugEnabled()) { getLogger().debug( "Deployed Descriptor:\n" + XMLUtils.DocumentToString(m_descriptors[i].getDOMDocument()) ); } } if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.start() complete"); } } /** * Stops this reader. Undeploys all managed services this reader * currently manages (includes services dynamically added to the reader * during runtime). * * @exception Exception if an error occurs */ public void stop() throws Exception { WSDDDeployment deployment = m_engineConfig.getDeployment(); WSDDService[] services = deployment.getServices(); // undeploy all deployed services for (int i = 0; i < services.length; ++i) { deployment.undeployService(services[i].getQName()); if (getLogger().isDebugEnabled()) { getLogger().debug("Undeployed: " + services[i].toString()); } } if (getLogger().isDebugEnabled()) { getLogger().debug("SoapServerImpl.stop() complete"); } } public void invoke(MessageContext message) throws Exception { m_axisServer.invoke(message); } /** * Place the Request message in the MessagContext object - notice * that we just leave it as a 'ServletRequest' object and let the * Message processing routine convert it - we don't do it since we * don't know how it's going to be used - perhaps it might not * even need to be parsed. */ public MessageContext createMessageContext( HttpServletRequest req, HttpServletResponse res, ServletContext con ) { MessageContext msgContext = new MessageContext(m_axisServer); String webInfPath = con.getRealPath("/WEB-INF"); String homeDir = con.getRealPath("/"); // Set the Transport msgContext.setTransportName(m_transportName); // Add Avalon specifics to MessageContext msgContext.setProperty(LOGGER, getLogger()); msgContext.setProperty(AvalonProvider.COMPONENT_MANAGER, m_manager); // Save some HTTP specific info in the bag in case someone needs it msgContext.setProperty(Constants.MC_JWS_CLASSDIR, m_jwsClassDir); msgContext.setProperty(Constants.MC_HOME_DIR, homeDir); msgContext.setProperty(Constants.MC_RELATIVE_PATH, req.getServletPath()); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLET, this ); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, req ); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, res ); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETLOCATION, webInfPath); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO, req.getPathInfo() ); msgContext.setProperty(HTTPConstants.HEADER_AUTHORIZATION, req.getHeader(HTTPConstants.HEADER_AUTHORIZATION)); msgContext.setProperty(Constants.MC_REMOTE_ADDR, req.getRemoteAddr()); // Set up a javax.xml.rpc.server.ServletEndpointContext ServletEndpointContextImpl sec = new ServletEndpointContextImpl(); msgContext.setProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT, sec); // Save the real path String realpath = con.getRealPath(req.getServletPath()); if (realpath != null) { msgContext.setProperty(Constants.MC_REALPATH, realpath); } msgContext.setProperty(Constants.MC_CONFIGPATH, webInfPath); if (m_securityProvider != null) msgContext.setProperty("securityProvider", m_securityProvider); // write out the contents of the message context for debugging purposes if (getLogger().isDebugEnabled()) { debugMessageContext(msgContext); } return msgContext; } /** * Helper method to log the contents of a given message context * * @param context a MessageContext instance */ private void debugMessageContext(final MessageContext context) { for (final Iterator i = context.getPropertyNames(); i.hasNext(); ) { final String key = (String) i.next(); getLogger().debug( "MessageContext: Key:" + key + ": Value: " + context.getProperty(key) ); } } /** * This is a uniform method of initializing AxisServer in a servlet * context. */ public AxisServer createEngine() throws Exception { AxisServer engine = AxisServer.getServer(getEngineEnvironment()); if (getLogger().isDebugEnabled()) { getLogger().debug("Axis engine created"); } return engine; } protected Map getEngineEnvironment() throws Exception { Map env = new HashMap(); // use FileProvider directly with a Avalon Source object instead of going // through the EngineConfigurationFactoryServlet class m_engineConfig = new FileProvider(m_serverWSDD.getInputStream()); env.put(EngineConfiguration.PROPERTY_NAME, m_engineConfig); env.put(AxisEngine.ENV_ATTACHMENT_DIR, m_attachmentDir); // REVISIT(MC): JNDI Factory support ? //env.put(AxisEngine.ENV_SERVLET_CONTEXT, context); return env; } /** * Helper method to convert a Message structure * into a String. * * @param msg a Message value * @return a String value */ private String messageToString(final Message msg) { try { OutputStream os = new ByteArrayOutputStream(); msg.writeTo(os); return os.toString(); } catch (Exception e) { if (getLogger().isWarnEnabled()) { getLogger().warn( "Warning, could not convert message (" + msg + ") into string", e ); } return null; } } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java Index: AvalonProvider.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Axis" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ // package org.apache.axis.providers.java; // currently part of Cocoon until it's officially in Axis CVS (BZ#12903) package org.apache.cocoon.components.axis.providers; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentManager; import org.apache.axis.AxisFault; import org.apache.axis.MessageContext; import org.apache.axis.providers.java.RPCProvider; import org.apache.axis.handlers.soap.SOAPService; import java.lang.reflect.Method; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Proxy; import javax.xml.rpc.server.ServiceLifecycle; /** * Provider class which allows you to specify an Avalon ROLE for * servicing Axis SOAP requests. * *

* The specified ROLE corresponds to a particular implementation * which is retrieved by a given Avalon ComponentManager. * For more information about Avalon, see the Avalon. * website. *

* *

* To use this class, you need to add your Avalon ComponentManager * instance to the MessageContext that is Axis uses to process * messages with. *

* *

* To do this you could for example subclass the AxisServlet and override the * createMessageContext() method adding the ComponentManager, eg: * *

   *   protected MessageContext createMessageContext(...)
   *   {
   *      MessageContext context = super.createMessageContext();
   *      context.setProperty(AvalonProvider.COMPONENT_MANAGER, m_manager);
   *      return context;
   *   }
   *  
* * and appropriately add the AvalonProvider to the list of handlers in your * server-config.wsdd (suggestions on how to improve this are welcomed) *

* *

* This provider will use that ComponentManager reference to * retrieve objects. *

* *

* In your deployment descriptor use the following syntax: * *

   *  <service name="myservice" provider="java:Avalon">
   *    <parameter name="role" value="my.avalon.role.name"/>
   *    <parameter name="className" value="my.avalon.roles.interface.name"/>
   *    <parameter name="allowedMethods" value="allowed.methods"/>
   *  </service>
   * 
* *

* * @author Marcus Crafter * @revision CVS $Id: AvalonProvider.java,v 1.1 2003/03/05 11:35:27 crafterm Exp $ */ public class AvalonProvider extends RPCProvider { /** * Constant used to retrieve the ComponentManager reference * from the MessageContext object. */ public static final String COMPONENT_MANAGER = "component-manager"; /** * Constant which represents the name of the ROLE this * provider should lookup to service a request with. This is * specified in the <parameter name="" value=""/> part of the * deployment xml. */ public static final String ROLE = "role"; /** * Returns the service object. * * @param msgContext the message context * @param role the Avalon ROLE to lookup to find the service object implementation * @return an object that implements the service * @exception Exception if an error occurs */ protected Object makeNewServiceObject( MessageContext msgContext, String role ) throws Exception { ComponentManager manager = (ComponentManager) msgContext.getProperty(COMPONENT_MANAGER); if (manager == null) throw new AxisFault("Could not access Avalon ComponentManager"); return decorate(manager.lookup(role), manager); } /** * Helper method for decorating a Component with a Handler * proxy (see below). * * @param object a Component instance * @param manager a ComponentManager instance * @return the Proxy wrapped Component instance * @exception Exception if an error occurs */ private Object decorate(final Component object, final ComponentManager manager) throws Exception { // obtain a list of all interfaces this object implements Class[] interfaces = object.getClass().getInterfaces(); // add ServiceLifecycle to it Class[] adjusted = new Class[ interfaces.length + 1 ]; System.arraycopy(interfaces, 0, adjusted, 0, interfaces.length); adjusted[interfaces.length] = ServiceLifecycle.class; // create a proxy implementing those interfaces Object proxy = Proxy.newProxyInstance( this.getClass().getClassLoader(), adjusted, new Handler(object, manager) ); // return the proxy return proxy; } /** * Return the option in the configuration that contains the service class * name. In the Avalon case, it is the ROLE name to lookup. */ protected String getServiceClassNameOptionName() { return ROLE; } /** * Get the service class description * * @param role the Avalon ROLE name * @param service a SOAPService instance * @param msgContext the message context * @return service class description * @exception AxisFault if an error occurs */ protected Class getServiceClass( String role, SOAPService service, MessageContext msgContext ) throws AxisFault { // Assuming ExcaliburComponentManager semantics the ROLE name is // actually the class name, potentially with a variant following // the class name with a '/' separator try { int i; if ((i = role.indexOf('/')) != -1) { return Class.forName(role.substring(0, i)); } else { return Class.forName(role); } } catch (ClassNotFoundException e) { throw new AxisFault("Couldn't create class object for role " + role, e); } } /** * InvocationHandler class for managing Avalon * Components. * *

* Components retrieved from an Avalon ComponentManager must be * returned to the manager when they are no longer required. *

* *

* The returning of Components to their ComponentManager is handled * by a Proxy class which uses the following InvocationHandler. *

* *

* Each Component returned by this Provider is wrapped inside a * Proxy class which implements all of the Component's interfaces * including javax.xml.rpc.server.ServiceLifecycle. *

* *

* When Axis is finished with the object returned by this provider, * it invokes ServiceLifecycle.destroy(). This is intercepted by the * InvocationHandler and the Component is returned at this time back * to the ComponentManager it was retrieved from. *

* *

* Note, when Axis invokes ServiceLifecycle.destroy() is dependant * on the scope of the service (ie. Request, Session & Application). *

*/ final class Handler implements InvocationHandler { // Constants describing the ServiceLifecycle.destroy method private final String SL_DESTROY = "destroy"; private final Class SL_CLASS = ServiceLifecycle.class; // Component & ComponentManager references private final Component m_object; private final ComponentManager m_manager; /** * Simple constructor, sets all internal references * * @param object a Component instance * @param manager a ComponentManager instance * @param log a Logger instance */ public Handler(final Component object, final ComponentManager manager) { m_object = object; m_manager = manager; } /** * invoke method, handles all method invocations for this * particular proxy. * *

* Usually the invocation is passed through to the * actual component the proxy wraps, unless the method belongs to * the ServiceLifecycle interface where it is handled * locally. *

* * @param proxy the Proxy instance the method was invoked on * @param method the invoked method Method object * @param args an Object[] array of arguments * @return an Object value or null if none * @exception Throwable if an error occurs */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { // if ServiceLifecycle.destroy() called, return to CM if (method.getDeclaringClass().equals(SL_CLASS)) { if (method.getName().equals(SL_DESTROY)) { m_manager.release(m_object); } return null; } else // otherwise pass call to the real object { return method.invoke(m_object, args); } } } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/reading/AxisRPCReader.java Index: AxisRPCReader.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.reading; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.soap.SOAPException; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.parameters.Parameters; import org.apache.axis.AxisFault; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.soap.SOAPConstants; import org.apache.axis.transport.http.AxisHttpSession; import org.apache.axis.transport.http.HTTPConstants; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.components.axis.SoapServer; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.SourceResolver; import org.apache.cocoon.environment.http.HttpEnvironment; import org.xml.sax.SAXException; /** * SOAP Reader * *

* This reader accepts a SOAP Request, and generates the resultant * response as output. Essentially, this reader allows you to serve SOAP * requests from your Cocoon application. *

* *

* Code originates from the Apache * AXIS project, * org.apache.axis.http.transport.AxisServlet. *

* * Ported to Cocoon by: * * @author Marcus Crafter * * Original AxisServlet authors: * * @author Steve Loughran * @author Doug Davis */ public class AxisRPCReader extends ComposerReader implements Disposable { // soap server reference private SoapServer m_server; /** * Compose this reader * * @param manager a ComponentManager instance * @exception ComponentException if an error occurs */ public void compose(final ComponentManager manager) throws ComponentException { super.compose(manager); // set soap server reference m_server = (SoapServer) manager.lookup(SoapServer.ROLE); } /** * Axis RPC Router setup method. * *

* This method sets the reader up for use. Essentially it checks that * its been invoked in a HTTP-POST environment, reads some optional * configuration variables, and obtains several component references to * be used later. *

* * @param resolver SourceResolver instance * @param objectModel request/response/context data * @param src source String instance * @param parameters sitemap invocation time customization parameters * @exception ProcessingException if an error occurs * @exception IOException if an error occurs * @exception SAXException if an error occurs */ public void setup( final SourceResolver resolver, final Map objectModel, final String src, final Parameters parameters ) throws ProcessingException, IOException, SAXException { super.setup(resolver, objectModel, src, parameters); checkHTTPPost(objectModel); if (getLogger().isDebugEnabled()) { getLogger().debug("AxisRPCReader.setup() complete"); } } /** * Helper method to ensure that given a HTTP-POST. * * @param objectModel Request/Response/Context map. * @exception ProcessingException if a non HTTP-POST request has been made. */ private void checkHTTPPost(final Map objectModel) throws ProcessingException { String method = ObjectModelHelper.getRequest(objectModel).getMethod(); if (!"POST".equalsIgnoreCase(method)) throw new ProcessingException( "Reader only supports HTTP-POST (supplied was " + method + ")" ); } /** * Axis RPC Router generate method. * *

* This method reads the SOAP request in from the input stream, invokes * the requested method and sends the result back to the requestor *

* * @exception IOException if an IO error occurs * @exception SAXException if a SAX error occurs * @exception ProcessingException if a processing error occurs */ public void generate() throws IOException, SAXException, ProcessingException { HttpServletRequest req = (HttpServletRequest) objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT); HttpServletResponse res = (HttpServletResponse) objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT); ServletContext con = (ServletContext) objectModel.get(HttpEnvironment.HTTP_SERVLET_CONTEXT); String soapAction = null; MessageContext msgContext = null; Message responseMsg = null; try { res.setBufferSize(1024 * 8); // provide performance boost. // Get message context w/ various properties set msgContext = m_server.createMessageContext(req, res, con); // Get request message Message requestMsg = new Message( req.getInputStream(), false, req.getHeader(HTTPConstants.HEADER_CONTENT_TYPE), req.getHeader(HTTPConstants.HEADER_CONTENT_LOCATION) ); if (getLogger().isDebugEnabled()) { getLogger().debug("Request message:\n" + messageToString(requestMsg)); } // Set the request(incoming) message field in the context msgContext.setRequestMessage(requestMsg); try { // // Save the SOAPAction header in the MessageContext bag. // This will be used to tell the Axis Engine which service // is being invoked. This will save us the trouble of // having to parse the Request message - although we will // need to double-check later on that the SOAPAction header // does in fact match the URI in the body. // (is this last stmt true??? (I don't think so - Glen)) // soapAction = getSoapAction(req); if (soapAction != null) { msgContext.setUseSOAPAction(true); msgContext.setSOAPActionURI(soapAction); } // Create a Session wrapper for the HTTP session. msgContext.setSession(new AxisHttpSession(req)); // Invoke the Axis engine... if(getLogger().isDebugEnabled()) { getLogger().debug("Invoking Axis Engine"); } m_server.invoke(msgContext); if(getLogger().isDebugEnabled()) { getLogger().debug("Return from Axis Engine"); } responseMsg = msgContext.getResponseMessage(); } catch (AxisFault e) { if (getLogger().isErrorEnabled()) { getLogger().error("Axis Fault", e); } // It's been suggested that a lack of SOAPAction // should produce some other error code (in the 400s)... int status = getHttpServletResponseStatus(e); if (status == HttpServletResponse.SC_UNAUTHORIZED) { res.setHeader("WWW-Authenticate","Basic realm=\"AXIS\""); } res.setStatus(status); responseMsg = new Message(e); } catch (Exception e) { if (getLogger().isErrorEnabled()) { getLogger().error("Error during SOAP call", e); } res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); responseMsg = new Message(AxisFault.makeFault(e)); } } catch (AxisFault fault) { if (getLogger().isErrorEnabled()) { getLogger().error("Axis fault occured while perforing request", fault); } responseMsg = new Message(fault); } catch (Exception e) { throw new ProcessingException("Exception thrown while performing request", e); } // Send response back if (responseMsg != null) { if (getLogger().isDebugEnabled()) { getLogger().debug("Sending response:\n" + messageToString(responseMsg)); } sendResponse(getProtocolVersion(req), msgContext.getSOAPConstants(), res, responseMsg); } if (getLogger().isDebugEnabled()) { getLogger().debug("AxisRPCReader.generate() complete"); } } /** * Extract information from AxisFault and map it to a HTTP Status code. * * @param af Axis Fault * @return HTTP Status code. */ protected int getHttpServletResponseStatus(AxisFault af) { // This will raise a 401 for both "Unauthenticated" & "Unauthorized"... return af.getFaultCode().getLocalPart().startsWith("Server.Unauth") ? HttpServletResponse.SC_UNAUTHORIZED : HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } /** * write a message to the response, set appropriate headers for content * type..etc. * @param clientVersion client protocol, one of the HTTPConstants strings * @param res response * @param responseMsg message to write * @throws AxisFault * @throws IOException if the response stream can not be written to */ private void sendResponse( final String clientVersion, final SOAPConstants constants, final HttpServletResponse res, final Message responseMsg ) throws AxisFault, IOException { if (responseMsg == null) { res.setStatus(HttpServletResponse.SC_NO_CONTENT); if (getLogger().isDebugEnabled()) { getLogger().debug("No axis response, not sending one"); } } else { if (getLogger().isDebugEnabled()) { getLogger().debug("Returned Content-Type:" + responseMsg.getContentType(constants)); getLogger().debug("Returned Content-Length:" + responseMsg.getContentLength()); } try { res.setContentType(responseMsg.getContentType(constants)); responseMsg.writeTo(res.getOutputStream()); } catch (SOAPException e) { getLogger().error("Exception sending response", e); } } if (!res.isCommitted()) { res.flushBuffer(); // Force it right now. } } /** * Extract the SOAPAction header. * if SOAPAction is null then we'll we be forced to scan the body for it. * if SOAPAction is "" then use the URL * @param req incoming request * @return the action * @throws AxisFault */ private String getSoapAction(HttpServletRequest req) throws AxisFault { String soapAction = (String)req.getHeader(HTTPConstants.HEADER_SOAP_ACTION); if (getLogger().isDebugEnabled()) { getLogger().debug("HEADER_SOAP_ACTION:" + soapAction); } // // Technically, if we don't find this header, we should probably fault. // It's required in the SOAP HTTP binding. // if (soapAction == null) { throw new AxisFault( "Client.NoSOAPAction", "No SOAPAction header", null, null ); } if (soapAction.length() == 0) soapAction = req.getContextPath(); // Is this right? return soapAction; } /** * Return the HTTP protocol level 1.1 or 1.0 * by derived class. */ private String getProtocolVersion(HttpServletRequest req){ String ret = HTTPConstants.HEADER_PROTOCOL_V10; String prot = req.getProtocol(); if (prot!= null) { int sindex= prot.indexOf('/'); if (-1 != sindex) { String ver= prot.substring(sindex+1); if (HTTPConstants.HEADER_PROTOCOL_V11.equals(ver.trim())) { ret = HTTPConstants.HEADER_PROTOCOL_V11; } } } return ret; } /** * Helper method to convert a Message structure * into a String. * * @param msg a Message value * @return a String value */ private String messageToString(final Message msg) { try { OutputStream os = new ByteArrayOutputStream(); msg.writeTo(os); return os.toString(); } catch (Exception e) { if (getLogger().isWarnEnabled()) { getLogger().warn( "Warning, could not convert message (" + msg + ") into string", e ); } return null; } } /** * Dispose this reader. Release all held resources. */ public void dispose() { manager.release(m_server); } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractComposableService.java Index: AbstractComposableService.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices; import javax.xml.rpc.ServiceException; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.Composable; import org.apache.cocoon.components.axis.providers.AvalonProvider; /** * Base class for providing Composable SOAP services. * *

* Note, this class is intended to be used in SOAP Services that require * references to Component's provided by the Cocoon Component Manager. *

* *

* If you require full Avalon support in your SOAP Service, consider using * the AvalonProvider support built into Axis itself. *

* * @author Marcus Crafter * @version CVS $Id: AbstractComposableService.java,v 1.1 2003/03/05 11:35:27 crafterm Exp $ */ public abstract class AbstractComposableService extends AbstractLogEnabledService implements Composable { // component manager reference protected ComponentManager m_manager; /** * ServiceLifecycle init method. Updates an internal * reference to the given context object, and enables logging for * this service. * * @param context a javax.xml.rpc.ServiceLifecycle context * Object instance * @exception ServiceException if an error occurs */ public void init(final Object context) throws ServiceException { super.init(context); try { setComponentManager(); } catch (ComponentException e) { throw new ServiceException("ComponentException generated", e); } } /** * Compose this service. * * @param manager a ComponentManager instance * @exception ComponentException if an error occurs */ public void compose(final ComponentManager manager) throws ComponentException { m_manager = manager; } /** * Helper method to extract the ComponentManager reference * from the context. * @exception ComponentException if an error occurs */ private void setComponentManager() throws ComponentException { compose( (ComponentManager) m_context.getProperty( AvalonProvider.COMPONENT_MANAGER ) ); } /** * Called by the JAX-RPC runtime to signal the end of this service */ public void destroy() { super.destroy(); m_manager = null; } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractLogEnabledService.java Index: AbstractLogEnabledService.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices; import javax.xml.rpc.handler.MessageContext; import javax.xml.rpc.server.ServiceLifecycle; import javax.xml.rpc.server.ServletEndpointContext; import javax.xml.rpc.ServiceException; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.Logger; import org.apache.cocoon.components.axis.SoapServer; // or use Constants ? /** * Base class for providing LogEnabled SOAP services. * *

* Note, this class is intended to be used for SOAP Services that require * accessing to a logging object for reporting purposes only. *

* *

* If you require full Avalon support for your SOAP Service, then consider * using the AvalonProvider support built into Axis itself. *

* * @author Marcus Crafter * @version CVS $Id: AbstractLogEnabledService.java,v 1.1 2003/03/05 11:35:27 crafterm Exp $ */ public abstract class AbstractLogEnabledService extends AbstractLogEnabled implements ServiceLifecycle { // servlet endpoint context reference protected ServletEndpointContext m_endPointContext; // message context reference protected MessageContext m_context; /** * ServiceLifecycle init method. Updates an internal * reference to the given context object, and enables logging for * this service. * * @param context a javax.xml.rpc.ServiceLifecycle context * Object instance * @exception ServiceException if an error occurs */ public void init(final Object context) throws ServiceException { setContext(context); setLogger(); } /** * Helper method to set the internal context reference for future * use. * * @param context a javax.xml.rpc.ServiceLifecycle context * Object instance * @exception ServiceException if an error occurs */ private void setContext(final Object context) throws ServiceException { try { m_endPointContext = (ServletEndpointContext) context; } catch (final ClassCastException e) { throw new ServiceException( "Service requires ServletEndPointContext, supplied was " + context, e ); } m_context = m_endPointContext.getMessageContext(); } /** * Helper method to obtain the Avalon Logger object out of * the context object and enable logging for this service. */ private void setLogger() { enableLogging((Logger) m_context.getProperty(SoapServer.LOGGER)); } /** * Called by the JAX-RPC runtime to signal the end of this service */ public void destroy() { m_context = null; } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/cache/DeploymentDescriptor.wsdd Index: DeploymentDescriptor.wsdd =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/instrument/DeploymentDescriptor.wsdd Index: DeploymentDescriptor.wsdd =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/instrument/InstrumentationService.java Index: InstrumentationService.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices.instrument; import org.apache.avalon.framework.component.Component; import org.apache.excalibur.instrument.InstrumentManageable; /** * Component interface for retrieving sample information from the * InstrumentManager. * * @author Marcus Crafter * @version CVS $Id: InstrumentationService.java,v 1.1 2003/03/05 11:35:28 crafterm Exp $ */ public interface InstrumentationService extends InstrumentManageable, Component { /** * Component ROLE name */ String ROLE = InstrumentationService.class.getName(); /** * Obtain an array of samples from a specified sample name. * *

* The specified path parameter identifies a sample, hierarchically from * Instrumentable name to Instrument name, to Instrument sample name * (including any child Instrumentables) using the '.' character as a * separator. *

* *
       *  eg: instrument-manager.active-thread-count.maximum_1000_600
       * 
* *

* The above example identifies the sample 'maximum_1000_600' on instrument * 'active-thread-count', on instrumentable 'instrument-manager'. *

* *

* The length of the returned array is dependant on the configuration of the * sample being accessed. Check instrumentation.xconf for the length of pre- * defined samples that operate constantly, when instrumentation is enabled. *

* * @param path path value * @return an int[] array of samples * @exception Exception if an error occurs */ int[] getSampleSnapshot(String path) throws Exception; /** * Obtains an array of instrumentable sample names * * @return a {@link String[]} array of sample names */ String[] getSampleNames(); } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/instrument/InstrumentationServiceImpl.java Index: InstrumentationServiceImpl.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices.instrument; import java.util.ArrayList; import java.util.List; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.excalibur.instrument.InstrumentManager; import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; import org.apache.excalibur.instrument.manager.interfaces.InstrumentableDescriptor; import org.apache.excalibur.instrument.manager.interfaces.InstrumentDescriptor; import org.apache.excalibur.instrument.manager.interfaces.InstrumentSampleDescriptor; /** * Implementation of {@link InstrumentationService} component. This component * allows you to access sample information from the InstrumentManager. * * @author Marcus Crafter * @version CVS $Id: InstrumentationServiceImpl.java,v 1.1 2003/03/05 11:35:28 crafterm Exp $ */ public final class InstrumentationServiceImpl extends AbstractLogEnabled implements InstrumentationService { private static final int[] EMPTY_INT_ARRAY = {}; private static final String[] EMPTY_STRING_ARRAY = {}; // instrument manager reference private DefaultInstrumentManager m_iManager; /** * Sets the {@link InstrumentManager} for this service object. * * @param iManager an {@link InstrumentManager} instance */ public void setInstrumentManager(final InstrumentManager iManager) { if (iManager == null) { if (getLogger().isWarnEnabled()) getLogger().warn( "No instrument manager available," + "please enable instrumentation in your web.xml" ); } // we require a DefaultInstrumentManager, attempt a cast. if (iManager instanceof DefaultInstrumentManager) { m_iManager = (DefaultInstrumentManager) iManager; } else { throw new UnsupportedOperationException( "InstrumentationService only supports DefaultInstrumentManager" ); } } /** * Obtain an array of samples from a specified sample name. * *

* The specified path parameter identifies a sample, hierarchically from * Instrumentable name to Instrument name, to Instrument sample name * (including any child Instrumentables) using the '.' character as a * separator. *

* *
       *  eg: instrument-manager.active-thread-count.maximum_1000_600
       * 
* *

* The above example identifies the sample 'maximum_1000_600' on instrument * 'active-thread-count', on instrumentable 'instrument-manager'. *

* *

* The length of the returned array is dependant on the configuration of the * sample being accessed. Check instrumentation.xconf for the length of pre- * defined samples that operate constantly, when instrumentation is enabled. *

* * @param path path value * @return an int[] array of samples * @exception Exception if an error occurs */ public int[] getSampleSnapshot(final String path) throws Exception { // ensure we have an instrument manager available if (!haveInstrumentManager()) { getLogger().warn( "No instrument manager available," + "please enable instrumentation in your web.xml" ); return EMPTY_INT_ARRAY; } // return the samples return m_iManager.locateInstrumentSampleDescriptor(path) .getSnapshot().getSamples(); } /** * Obtain a list of available samples, useful for browsing * available samples. * * @return an {@link String}[] array of sample names */ public String[] getSampleNames() { // ensure we have an instrument manager available if (!haveInstrumentManager()) { getLogger().warn( "No instrument manager available," + "please enable instrumentation in your web.xml" ); return EMPTY_STRING_ARRAY; } // list all instrumentables final InstrumentableDescriptor[] descriptors = m_iManager.getInstrumentableDescriptors(); final List names = new ArrayList(); for (int i = 0; i < descriptors.length; ++i) { // list all instruments InstrumentDescriptor[] insts = descriptors[i].getInstrumentDescriptors(); for (int k = 0; k < insts.length; ++k) { // list all samples InstrumentSampleDescriptor[] samples = insts[k].getInstrumentSampleDescriptors(); for (int j = 0; j < samples.length; ++j) { names.add(samples[j].getName()); } } } return (String[])names.toArray(new String[]{}); } /** * Helper method to determine if a valid instrument manager is available * * @return true if an instrument manager is present, false otherwise */ private boolean haveInstrumentManager() { return (m_iManager != null); } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/instrument/instrumentation.xconf Index: instrumentation.xconf =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/instrument/instrumentation.xroles Index: instrumentation.xroles =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/memory/DeploymentDescriptor.wsdd Index: DeploymentDescriptor.wsdd =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/memory/Memory.java Index: Memory.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices.memory; /** * Class which provides JVM memory related SOAP services. * * @author Marcus Crafter * @version CVS $Id: Memory.java,v 1.1 2003/03/05 11:35:28 crafterm Exp $ */ public class Memory { // static reference to the runtime object. private static final Runtime runtime = Runtime.getRuntime(); /** * getFreeMemory returns the amount of free memory * in the system. * * @return the amount of free memory in the system */ public static long getFreeMemory() { return runtime.freeMemory(); } /** * getTotalMemory returns the total amount of memory * in the JVM. * * @return the total amount of memory in the JVM */ public static long getTotalMemory() { return runtime.totalMemory(); } /** * invokeGC calls upon the JVM Garbage Collector to * recycle unused objects. */ public static void invokeGC() { runtime.gc(); } } 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/system/DeploymentDescriptor.wsdd Index: DeploymentDescriptor.wsdd =================================================================== 1.1 xml-cocoon2/src/blocks/axis/java/org/apache/cocoon/webservices/system/System.java Index: System.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.webservices.system; import java.util.Properties; import org.apache.excalibur.util.SystemUtil; /** * Class which provides JVM system related SOAP services. * * @author Marcus Crafter * @version CVS $Id: System.java,v 1.1 2003/03/05 11:35:28 crafterm Exp $ */ public class System { /** * getProperties returns the current System Properties object. * * @return a Properties instance */ public Properties getProperties() { return java.lang.System.getProperties(); } /** * getArchitecture returns the host architecture. * * @return host architecture */ public String getArchitecture() { return SystemUtil.architecture(); } /** * getCPUInfo returns host CPU information. * * @return host CPU information */ public String getCPUInfo() { return SystemUtil.cpuInfo(); } /** * getNumProcessors returns the number of processors in * this machine. * * @return number of processors */ public int getNumProcessors() { return SystemUtil.numProcessors(); } /** * getOperatingSystem returns the host operating system * * @return host operating system */ public String getOperatingSystem() { return SystemUtil.operatingSystem(); } /** * getOperatingSystemVersion returns the host operating system * version * * @return host operating system version */ public String getOperatingSystemVersion() { return SystemUtil.osVersion(); } } 1.1 xml-cocoon2/src/blocks/axis/lib/axis-1.0.jar <> 1.1 xml-cocoon2/src/blocks/axis/lib/axis-jaxrpc-1.0.jar <> 1.1 xml-cocoon2/src/blocks/axis/lib/axis-saaj-1.0.jar <> 1.1 xml-cocoon2/src/blocks/axis/lib/commons-discovery.jar <> 1.1 xml-cocoon2/src/blocks/axis/lib/excalibur-util-1.0.jar <> 1.1 xml-cocoon2/src/blocks/axis/lib/wsdl4j.jar <>