You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by gr...@apache.org on 2003/08/28 01:24:56 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates ElemExtensionCall.java

grchiu      2003/08/27 16:24:56

  Modified:    java/src/org/apache/xalan/trace TraceManager.java
               java/src/org/apache/xalan/extensions
                        ExtensionHandlerJavaClass.java
                        ExtensionHandlerJavaPackage.java
               java/src/org/apache/xalan/templates ElemExtensionCall.java
  Added:       java/src/org/apache/xalan/trace ExtensionEvent.java
                        TraceListenerEx3.java
  Log:
  Implemented extensions trace mechanism for Java extension calls.
  (http://marc.theaimsgroup.com/?l=xalan-dev&m=105715909512185&w=2)
  
  Added new interfaces to allow a trace listener to receive information about
  extension functions and elements that are called or executed.
  
  Placed hooks in subclasses of ExtensionHandler prior to and after invoking
  the resolved extension method.
  
  Adding missing trace event for ElemExtensionCall.
  
  Revision  Changes    Path
  1.15      +107 -1    xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java
  
  Index: TraceManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TraceManager.java	3 Feb 2003 16:20:00 -0000	1.14
  +++ TraceManager.java	27 Aug 2003 23:24:56 -0000	1.15
  @@ -56,6 +56,7 @@
    */
   package org.apache.xalan.trace;
   
  +import java.lang.reflect.Method;
   import java.util.TooManyListenersException;
   import java.util.Vector;
   
  @@ -63,7 +64,6 @@
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  -
   import org.w3c.dom.Node;
   
   /**
  @@ -349,6 +349,112 @@
           TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
   
           tl.selected(se);
  +      }
  +    }
  +  }
  +  
  +
  +  /**
  +   * Fire an end extension event.
  +   *
  +   * @see java.lang.reflect.Method#invoke
  +   * 
  +   * @param method The java method about to be executed
  +   * @param instance The instance the method will be executed on
  +   * @param arguments Parameters passed to the method.
  +   */
  +  public void fireExtensionEndEvent(Method method, Object instance, Object[] arguments)
  +  {
  +      ExtensionEvent ee = new ExtensionEvent(m_transformer, method, instance, arguments);
  +
  +    if (hasTraceListeners())
  +    {
  +      int nListeners = m_traceListeners.size();
  +
  +      for (int i = 0; i < nListeners; i++)
  +      {
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +        if(tl instanceof TraceListenerEx3)
  +        {
  +          ((TraceListenerEx3)tl).extensionEnd(ee);
  +        }
  +      }
  +    }
  +  }
  +
  +  /**
  +   * Fire an end extension event.
  +   *
  +   * @see java.lang.reflect.Method#invoke
  +   * 
  +   * @param method The java method about to be executed
  +   * @param instance The instance the method will be executed on
  +   * @param arguments Parameters passed to the method.
  +   */
  +  public void fireExtensionEvent(Method method, Object instance, Object[] arguments)
  +  {
  +    ExtensionEvent ee = new ExtensionEvent(m_transformer, method, instance, arguments);
  +
  +    if (hasTraceListeners())
  +    {
  +      int nListeners = m_traceListeners.size();
  +
  +      for (int i = 0; i < nListeners; i++)
  +      {
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +        if(tl instanceof TraceListenerEx3)
  +        {
  +          ((TraceListenerEx3)tl).extension(ee);
  +        }
  +      }
  +    }
  +  }
  +
  +  /**
  +   * Fire an end extension event.
  +   *
  +   * @see java.lang.reflect.Method#invoke
  +   * 
  +   * @param ee the ExtensionEvent to fire
  +   */
  +  public void fireExtensionEndEvent(ExtensionEvent ee)
  +  {
  +    if (hasTraceListeners())
  +    {
  +      int nListeners = m_traceListeners.size();
  +
  +      for (int i = 0; i < nListeners; i++)
  +      {
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +        if(tl instanceof TraceListenerEx3)
  +        {
  +          ((TraceListenerEx3)tl).extensionEnd(ee);
  +        }
  +      }
  +    }
  +  }
  +
  +  /**
  +   * Fire an end extension event.
  +   *
  +   * @see java.lang.reflect.Method#invoke
  +   * 
  +   * @param ee the ExtensionEvent to fire
  +   */
  +  public void fireExtensionEvent(ExtensionEvent ee)
  +  {    
  +      
  +    if (hasTraceListeners())
  +    {
  +      int nListeners = m_traceListeners.size();
  +
  +      for (int i = 0; i < nListeners; i++)
  +      {
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +        if(tl instanceof TraceListenerEx3)
  +        {
  +          ((TraceListenerEx3)tl).extension(ee);
  +        }
         }
       }
     }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/trace/ExtensionEvent.java
  
  Index: ExtensionEvent.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002-2003 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 "Xalan" 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 and was
   * originally based on software copyright (c) 1999, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   
  package org.apache.xalan.trace;
  
  import java.lang.reflect.Constructor;
  import java.lang.reflect.Method;
  
  import org.apache.xalan.transformer.TransformerImpl;
  
  /**
   * An event representing an extension call.
   */
  public class ExtensionEvent {
  
  	public static final int DEFAULT_CONSTRUCTOR = 0;
  	public static final int METHOD = 1;
  	public static final int CONSTRUCTOR = 2;
  	
  	public final int m_callType; 
  	public final TransformerImpl m_transformer;
  	public final Object m_method;
  	public final Object m_instance;
  	public final Object[] m_arguments;
  	
  	
  	public ExtensionEvent(TransformerImpl transformer, Method method, Object instance, Object[] arguments) {
  		m_transformer = transformer;
  		m_method = method;
  		m_instance = instance;
  		m_arguments = arguments;
  		m_callType = METHOD;
  	}		
  
  	public ExtensionEvent(TransformerImpl transformer, Constructor constructor, Object[] arguments) {
  		m_transformer = transformer;
  		m_instance = null;		
  		m_arguments = arguments;
  		m_method = constructor;
  		m_callType = CONSTRUCTOR;		
  	}
  
  	public ExtensionEvent(TransformerImpl transformer, Class clazz) {
  		m_transformer = transformer;
  		m_instance = null;
  		m_arguments = null;
  		m_method = clazz;
  		m_callType = DEFAULT_CONSTRUCTOR;
  	}
  
  }
  
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/trace/TraceListenerEx3.java
  
  Index: TraceListenerEx3.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002-2003 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 "Xalan" 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 and was
   * originally based on software copyright (c) 1999, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
   
  package org.apache.xalan.trace;
  
  /**
   * <meta name="usage" content="advanced"/>
   * Extends TraceListenerEx2 but adds extensions trace events.
   */
  public interface TraceListenerEx3 extends TraceListenerEx2 {
  
  	/**
  	 * Method that is called when an extension event occurs.
  	 * The method is blocking.  It must return before processing continues.
  	 *
  	 * @param ev the extension event.
  	 */
  	public void extension(ExtensionEvent ee);
  
  	/**
  	 * Method that is called when the end of an extension event occurs.
  	 * The method is blocking.  It must return before processing continues.
  	 *
  	 * @param ev the extension event.
  	 */
  	public void extensionEnd(ExtensionEvent ee);
  
  }
  
  
  
  
  1.17      +99 -12    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java
  
  Index: ExtensionHandlerJavaClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaClass.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ExtensionHandlerJavaClass.java	30 Jan 2003 18:45:41 -0000	1.16
  +++ ExtensionHandlerJavaClass.java	27 Aug 2003 23:24:56 -0000	1.17
  @@ -68,6 +68,7 @@
   
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.trace.ExtensionEvent;
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xpath.functions.FuncExtFunction;
   import org.apache.xpath.objects.XObject;
  @@ -236,7 +237,7 @@
             methodArgs[i] = args.elementAt(i);
           }
           Constructor c = (Constructor) getFromCache(methodKey, null, methodArgs);
  -        if (c != null)
  +        if (c != null && !TransformerImpl.S_DEBUG)
           {
             try
             {
  @@ -258,7 +259,20 @@
                                             convertedArgs,
                                             exprContext);
           putToCache(methodKey, null, methodArgs, c);
  -        return c.newInstance(convertedArgs[0]);
  +        if (TransformerImpl.S_DEBUG) {
  +            TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +            trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, c, convertedArgs[0]));
  +            Object result;
  +            try {            
  +                result = c.newInstance(convertedArgs[0]);
  +            } catch (Exception e) {
  +                throw e;
  +            } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, c, convertedArgs[0]));
  +            }
  +            return result;
  +        } else
  +            return c.newInstance(convertedArgs[0]);
         }
   
         else
  @@ -273,7 +287,7 @@
             methodArgs[i] = args.elementAt(i);
           }
           Method m = (Method) getFromCache(methodKey, null, methodArgs);
  -        if (m != null)
  +        if (m != null && !TransformerImpl.S_DEBUG)
           {
             try
             {
  @@ -337,19 +351,71 @@
                                        resolveType);
           putToCache(methodKey, null, methodArgs, m);
   
  -        if (MethodResolver.DYNAMIC == resolveType)          // First argument was object type
  -          return m.invoke(targetObject, convertedArgs[0]);
  +        if (MethodResolver.DYNAMIC == resolveType) {         // First argument was object type
  +          if (TransformerImpl.S_DEBUG) {
  +            TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +            trans.getTraceManager().fireExtensionEvent(m, targetObject, convertedArgs[0]);
  +            Object result;
  +            try {
  +                result = m.invoke(targetObject, convertedArgs[0]);
  +            } catch (Exception e) {
  +                throw e;
  +            } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(m, targetObject, convertedArgs[0]);
  +            }
  +            return result;
  +          } else                  
  +            return m.invoke(targetObject, convertedArgs[0]);
  +        }
           else                                  // First arg was not object.  See if we need the implied object.
           {
  -          if (Modifier.isStatic(m.getModifiers()))
  -            return m.invoke(null, convertedArgs[0]);
  +          if (Modifier.isStatic(m.getModifiers())) {
  +            if (TransformerImpl.S_DEBUG) {
  +              TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +              trans.getTraceManager().fireExtensionEvent(m, null, convertedArgs[0]);
  +              Object result;
  +              try {
  +                  result = m.invoke(null, convertedArgs[0]);
  +              } catch (Exception e) {
  +                throw e;
  +              } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(m, null, convertedArgs[0]);
  +              }
  +              return result;
  +            } else                  
  +              return m.invoke(null, convertedArgs[0]);
  +          }
             else
             {
               if (null == m_defaultInstance)
               {
  -              m_defaultInstance = m_classObj.newInstance();
  +              if (TransformerImpl.S_DEBUG) {
  +                TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +                trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, m_classObj));
  +                try {
  +                    m_defaultInstance = m_classObj.newInstance();
  +                } catch (Exception e) {
  +                    throw e;
  +                } finally {
  +                    trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, m_classObj));
  +                }
  +              }    else
  +                  m_defaultInstance = m_classObj.newInstance();
               }
  -            return m.invoke(m_defaultInstance, convertedArgs[0]);
  +            if (TransformerImpl.S_DEBUG) {
  +              TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +              trans.getTraceManager().fireExtensionEvent(m, m_defaultInstance, convertedArgs[0]);
  +              Object result;
  +              try {
  +                result = m.invoke(m_defaultInstance, convertedArgs[0]);
  +              } catch (Exception e) {
  +                throw e;
  +              } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(m, m_defaultInstance, convertedArgs[0]);
  +              }
  +              return result;
  +            } else                  
  +              return m.invoke(m_defaultInstance, convertedArgs[0]);
             }  
           }
   
  @@ -427,8 +493,19 @@
         try
         {
           m = MethodResolver.getElementMethod(m_classObj, localPart);
  -        if ( (null == m_defaultInstance) && !Modifier.isStatic(m.getModifiers()) )
  -          m_defaultInstance = m_classObj.newInstance();
  +        if ( (null == m_defaultInstance) && !Modifier.isStatic(m.getModifiers()) ) {
  +          if (TransformerImpl.S_DEBUG) {            
  +            transformer.getTraceManager().fireExtensionEvent(new ExtensionEvent(transformer, m_classObj));
  +            try {
  +              m_defaultInstance = m_classObj.newInstance();
  +            } catch (Exception e) {
  +              throw e;
  +            } finally {
  +              transformer.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(transformer, m_classObj));
  +            }
  +          } else 
  +            m_defaultInstance = m_classObj.newInstance();
  +        }
         }
         catch (Exception e)
         {
  @@ -443,7 +520,17 @@
   
       try
       {
  -      result = m.invoke(m_defaultInstance, new Object[] {xpc, element});
  +      if (TransformerImpl.S_DEBUG) {
  +        transformer.getTraceManager().fireExtensionEvent(m, m_defaultInstance, new Object[] {xpc, element});
  +        try {
  +          result = m.invoke(m_defaultInstance, new Object[] {xpc, element});
  +        } catch (Exception e) {
  +          throw e;
  +        } finally {
  +          transformer.getTraceManager().fireExtensionEndEvent(m, m_defaultInstance, new Object[] {xpc, element});
  +        }
  +      } else                  
  +        result = m.invoke(m_defaultInstance, new Object[] {xpc, element});
       }
       catch (InvocationTargetException e)
       {
  
  
  
  1.17      +56 -5     xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java
  
  Index: ExtensionHandlerJavaPackage.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJavaPackage.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ExtensionHandlerJavaPackage.java	30 Jan 2003 18:45:41 -0000	1.16
  +++ ExtensionHandlerJavaPackage.java	27 Aug 2003 23:24:56 -0000	1.17
  @@ -69,6 +69,7 @@
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.Stylesheet;
  +import org.apache.xalan.trace.ExtensionEvent;
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xpath.functions.FuncExtFunction;
   import org.apache.xpath.objects.XObject;
  @@ -293,7 +294,20 @@
                                             convertedArgs,
                                             exprContext);
           putToCache(methodKey, null, methodArgs, c);
  -        return c.newInstance(convertedArgs[0]);
  +        if (TransformerImpl.S_DEBUG) {
  +            TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +            trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, c, convertedArgs[0]));            
  +            Object result;
  +            try {
  +                result = c.newInstance(convertedArgs[0]);
  +            } catch (Exception e) {
  +                throw e;
  +            } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, c, convertedArgs[0]));
  +            }
  +            return result;
  +        } else
  +            return c.newInstance(convertedArgs[0]);
         }
   
         else if (-1 != lastDot) {                         // Handle static method call
  @@ -305,7 +319,7 @@
             methodArgs[i] = args.elementAt(i);
           }
           Method m = (Method) getFromCache(methodKey, null, methodArgs);
  -        if (m != null)
  +        if (m != null && !TransformerImpl.S_DEBUG)
           {
             try
             {
  @@ -339,7 +353,21 @@
                                        exprContext,
                                        MethodResolver.STATIC_ONLY);
           putToCache(methodKey, null, methodArgs, m);
  -        return m.invoke(null, convertedArgs[0]);
  +        if (TransformerImpl.S_DEBUG) {
  +            TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +            trans.getTraceManager().fireExtensionEvent(m, null, convertedArgs[0]);            
  +            Object result;
  +            try {
  +                result = m.invoke(null, convertedArgs[0]);
  +            } catch (Exception e) {
  +                throw e;
  +            } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(m, null, convertedArgs[0]);
  +            }
  +            return result;
  +        }
  +        else
  +            return m.invoke(null, convertedArgs[0]);
         }
   
         else {                                            // Handle instance method call
  @@ -384,7 +412,20 @@
                                        exprContext,
                                        MethodResolver.INSTANCE_ONLY);
           putToCache(methodKey, targetObject, methodArgs, m);
  -        return m.invoke(targetObject, convertedArgs[0]);
  +        if (TransformerImpl.S_DEBUG) {
  +            TransformerImpl trans = (TransformerImpl)exprContext.getXPathContext().getOwnerObject();
  +            trans.getTraceManager().fireExtensionEvent(m, targetObject, convertedArgs[0]);            
  +            Object result;
  +            try {
  +                result = m.invoke(targetObject, convertedArgs[0]);
  +            } catch (Exception e) {
  +                throw e;
  +            } finally {
  +                trans.getTraceManager().fireExtensionEndEvent(m, targetObject, convertedArgs[0]);
  +            }
  +            return result;
  +        } else       
  +            return m.invoke(targetObject, convertedArgs[0]);
         }
       }
       catch (InvocationTargetException ite)
  @@ -488,7 +529,17 @@
   
       try
       {
  -      result = m.invoke(null, new Object[] {xpc, element});
  +      if (TransformerImpl.S_DEBUG) {
  +          transformer.getTraceManager().fireExtensionEvent(m, null, new Object[] {xpc, element});
  +        try {
  +            result = m.invoke(null, new Object[] {xpc, element});
  +        } catch (Exception e) {
  +            throw e;
  +        } finally {            
  +            transformer.getTraceManager().fireExtensionEndEvent(m, null, new Object[] {xpc, element});
  +        }
  +      } else
  +        result = m.invoke(null, new Object[] {xpc, element});
       }
       catch (InvocationTargetException ite)
       {
  
  
  
  1.34      +4 -0      xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java
  
  Index: ElemExtensionCall.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ElemExtensionCall.java	1 Apr 2003 20:16:27 -0000	1.33
  +++ ElemExtensionCall.java	27 Aug 2003 23:24:56 -0000	1.34
  @@ -237,6 +237,8 @@
               throws TransformerException
     {
   
  +	if (TransformerImpl.S_DEBUG)
  +		transformer.getTraceManager().fireTraceEvent(this);
       try
       {
         transformer.getResultTreeHandler().flushPending();
  @@ -295,6 +297,8 @@
       {
         transformer.getErrorListener().fatalError(e);
       }
  +	if (TransformerImpl.S_DEBUG)
  +		transformer.getTraceManager().fireTraceEndEvent(this);
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org