You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cr...@apache.org on 2002/11/08 18:39:19 UTC

cvs commit: xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument DeploymentDescriptor.wsdd InstrumentationService.java InstrumentationServiceImpl.java instrumentation.xconf instrumentation.xroles

crafterm    2002/11/08 09:39:19

  Modified:    lib      jars.xml
               src/scratchpad/src/org/apache/cocoon/components/axis
                        soapserver.xconf
  Added:       lib/core excalibur-instrument-20021108.jar
                        excalibur-instrument-manager-20021108.jar
                        excalibur-instrument-manager-interfaces-20021108.jar
               src/scratchpad/src/org/apache/cocoon/webservices/instrument
                        DeploymentDescriptor.wsdd
                        InstrumentationService.java
                        InstrumentationServiceImpl.java
                        instrumentation.xconf instrumentation.xroles
  Removed:     lib/core excalibur-instrument-20020916.jar
                        excalibur-instrument-manager-20020916.jar
                        excalibur-instrument-manager-interfaces-20020916.jar
  Log:
  * Updated Excalibur instrumentation jars to latest version
    (includes defect fixes, and several new helper methods)
  
  * Committed new InstrumentationService for the AxisRPCReader.
  
    This service allows you to retrieve instrumentation sample data via
    a SOAP request to the reader, and also from within your Cocoon
    application by looking up the InstrumentationService component,
    and invoking the getSampleSnapshot() method.
  
  Revision  Changes    Path
  1.44      +3 -3      xml-cocoon2/lib/jars.xml
  
  Index: jars.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/lib/jars.xml,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- jars.xml	2 Nov 2002 17:44:29 -0000	1.43
  +++ jars.xml	8 Nov 2002 17:39:19 -0000	1.44
  @@ -69,7 +69,7 @@
   	<description>Part of jakarta-avalon, it is a set of classes and patterns that
          support high level server development.</description>
   	<used-by>Cocoon</used-by>
  -	<lib>core/excalibur-instrument-20020916.jar</lib>
  +	<lib>core/excalibur-instrument-20021108.jar</lib>
   	<homepage>http://jakarta.apache.org/avalon/excalibur/</homepage>
    </file>
    <file>
  @@ -77,7 +77,7 @@
   	<description>Part of jakarta-avalon, it is a set of classes and patterns that
          support high level server development.</description>
   	<used-by>Cocoon</used-by>
  -	<lib>core/excalibur-instrument-manager-20020916.jar</lib>
  +	<lib>core/excalibur-instrument-manager-20021108.jar</lib>
   	<homepage>http://jakarta.apache.org/avalon/excalibur/</homepage>
    </file>
    <file>
  @@ -85,7 +85,7 @@
   	<description>Part of jakarta-avalon, it is a set of classes and patterns that
          support high level server development.</description>
   	<used-by>Cocoon</used-by>
  -	<lib>core/excalibur-instrument-manager-interfaces-20020916.jar</lib>
  +	<lib>core/excalibur-instrument-manager-interfaces-20021108.jar</lib>
   	<homepage>http://jakarta.apache.org/avalon/excalibur/</homepage>
    </file>
    <file>
  
  
  
  1.1                  xml-cocoon2/lib/core/excalibur-instrument-20021108.jar
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/lib/core/excalibur-instrument-manager-20021108.jar
  
  	<<Binary file>>
  
  
  1.1                  xml-cocoon2/lib/core/excalibur-instrument-manager-interfaces-20021108.jar
  
  	<<Binary file>>
  
  
  1.2       +1 -0      xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/axis/soapserver.xconf
  
  Index: soapserver.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/axis/soapserver.xconf,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- soapserver.xconf	9 Sep 2002 17:53:17 -0000	1.1
  +++ soapserver.xconf	8 Nov 2002 17:39:19 -0000	1.2
  @@ -8,6 +8,7 @@
        <descriptor src="resource://org/apache/cocoon/webservices/memory/DeploymentDescriptor.wsdd"/>
        <descriptor src="resource://org/apache/cocoon/webservices/system/DeploymentDescriptor.wsdd"/>
        <descriptor src="resource://org/apache/cocoon/webservices/cache/DeploymentDescriptor.wsdd"/>
  +     <descriptor src="resource://org/apache/cocoon/webservices/instrument/DeploymentDescriptor.wsdd"/>     
      </managed-services>
    </component>
   </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument/DeploymentDescriptor.wsdd
  
  Index: DeploymentDescriptor.wsdd
  ===================================================================
  <deployment xmlns="http://xml.apache.org/axis/wsdd/"
              xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  
   <service name="Cocoon-Instrumentation" provider="Handler">
    <parameter name="role" value="org.apache.cocoon.webservices.instrument.InstrumentationService"/>
    <parameter name="className" value="org.apache.cocoon.webservices.instrument.InstrumentationService"/>
    <parameter name="handlerClass" value="org.apache.cocoon.components.axis.providers.AvalonProvider"/>
    <parameter name="allowedMethods" value="getSampleSnapshot"/>
   </service>
  
  </deployment>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument/InstrumentationService.java
  
  Index: InstrumentationService.java
  ===================================================================
  /*
  
  ============================================================================
                    The Apache Software License, Version 1.1
  ============================================================================
  
  Copyright (C) 1999-2002 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  <st...@apache.org>. For more  information on the Apache
  Software Foundation, please see <http://www.apache.org/>.
  
  */
  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 <a href="mailto:crafterm@apache.org">Marcus Crafter</a>
   * @version CVS $Id: InstrumentationService.java,v 1.1 2002/11/08 17:39:19 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.
       *
       * <p>
       *  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.
       * </p>
       *
       * <pre>
       *  eg: instrument-manager.active-thread-count.maximum_1000_600
       * </pre>
       *
       * <p>
       *  The above example identifies the sample 'maximum_1000_600' on instrument
       *  'active-thread-count', on instrumentable 'instrument-manager'.
       * </p>
       *
       * <p>
       *  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.
       * </p>
       *
       * @param path path value
       * @return an <code>int[]</code> array of samples
       * @exception Exception if an error occurs
       */
      int[] getSampleSnapshot(String path)
          throws Exception;
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument/InstrumentationServiceImpl.java
  
  Index: InstrumentationServiceImpl.java
  ===================================================================
  /*
  
  ============================================================================
                    The Apache Software License, Version 1.1
  ============================================================================
  
  Copyright (C) 1999-2002 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  <st...@apache.org>. For more  information on the Apache
  Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.webservices.instrument;
  
  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;
  
  /**
   * Implementation of {@link InstrumentationService} component. This component
   * allows you to access sample information from the InstrumentManager.
   *
   * @author <a href="mailto:crafterm@apache.org">Marcus Crafter</a>
   * @version CVS $Id: InstrumentationServiceImpl.java,v 1.1 2002/11/08 17:39:19 crafterm Exp $
   */
  public final class InstrumentationServiceImpl extends AbstractLogEnabled
      implements InstrumentationService {
  
      // empty integer array, used if a sample is request, but no manager exists.
      private static final int[] EMPTY_INT_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.
       *
       * <p>
       *  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.
       * </p>
       *
       * <pre>
       *  eg: instrument-manager.active-thread-count.maximum_1000_600
       * </pre>
       *
       * <p>
       *  The above example identifies the sample 'maximum_1000_600' on instrument
       *  'active-thread-count', on instrumentable 'instrument-manager'.
       * </p>
       *
       * <p>
       *  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.
       * </p>
       *
       * @param path path value
       * @return an <code>int[]</code> 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 (m_iManager == null) {
              if (getLogger().isWarnEnabled())
                  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();
      }
  
      /**
       * REVISIT: this is currently unused, but might be good for browsing
       * instrument samples in the future.
       *
       * @return an {@link InstrumentableDescriptor}[] value
       */
      public InstrumentableDescriptor[] getInstrumentableDescriptors() {
          return m_iManager.getInstrumentableDescriptors();
      }
  }
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument/instrumentation.xconf
  
  Index: instrumentation.xconf
  ===================================================================
  <?xml version="1.0"?>
  <xconf xpath="/cocoon" unless="component[@role='org.apache.cocoon.webservices.instrument.InstrumentationService']">
  
   <component role="org.apache.cocoon.webservices.instrument.InstrumentationService"
              class="org.apache.cocoon.webservices.instrument.InstrumentationServiceImpl"
              logger="core.instrument.service">
   </component>
  </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/webservices/instrument/instrumentation.xroles
  
  Index: instrumentation.xroles
  ===================================================================
  <?xml version="1.0"?>
  
  <xroles xpath="/role-list" unless="role[@name='org.apache.cocoon.webservices.instrument.InstrumentationService']">
  
    <role name="org.apache.cocoon.webservices.instrument.InstrumentationService"
          shorthand="instrument-service"
          default-class="org.apache.cocoon.webservices.instrument.InstrumentationServiceImpl"/>
  </xroles>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org